Midrange News for the IBM i Community

Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Do you "CALL" CL Commands from RPGIV?
has no ratings.
Published: 25 Jul 2013
Revised: 26 Jul 2013 - 1847 days ago
Last viewed on: 16 Aug 2018 (6721 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Do you "CALL" CL Commands from RPGIV? Published by: Bob Cozzi on 25 Jul 2013 view comments(6)

It seems to me that a huge number of RPG programmers are "closet" CL programmers. That is they call CL commands from within RPG instead of calling the appropriate API or procedure.

With the exception of a handful of CL commands that RPG and APIs do not support (and I do mean a handfull) why would you ever run a CL command from RPG?

Thoughts? Comments?

Return to midrangenews.com home page.
Sort Ascend | Descend


(Sign in to Post a Comment)
Posted by: GFuste
Premium member *
Jacksonville, FL
Comment on: Do you "CALL" CL Commands from RPGIV?
Posted: 5 years 22 days 10 hours 32 minutes ago

Because maybe it's easier to just run the command and monitor its completion rather than look up the appropriate API (if any) and then develop all the interfacing parms, and user indexes, etc. needed to run it.

I'll admit to using APIs quite often but it's just too easy to run a CL from RPG.

Just my 2 cents... 

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Do you "CALL" CL Commands from RPGIV?
Posted: 5 years 22 days 9 hours 1 minutes ago

Calls to CL programs? Sure. Single CL command? Few and far between. I know there are some OVRPRTF and corresponding DLTOVR, which aren't easily replaced. Maybe some lingering OPNQRYF somewhere that we haven't had a reason to touch. Can't really think of any others. (But haven't actually searched the code for QCMDEXC, etc.)

Posted by: bobcozzi
Site Admin ****
Comment on: Do you "CALL" CL Commands from RPGIV?
Posted: 5 years 22 days 6 hours 16 minutes ago
Edited: Thu, 25 Jul, 2013 at 14:08:32 (1848 days ago)

Here's what sparked the question: I have a customer using COZTOOLS. In COZTOOLS there is a "simple" (my opinion) sndinfMsg() function that will send a program message, relative to the procedure from which it is called. Yet the client sent me a support question that asked why SNDPGMMSG wasn't working when he passed it to my prototype for the C runtime "system" function (similar to QCMDEXC but with no length parameter required).

I asked why do you want to do that instead of SndInfMsg('Hello world')?

Has screwed up APIs so badly that even life-long OS/400 programmers are avoiding Procedure or should I say "Prototyped" calls in favor of CL commands.

Posted by: Viking
Premium member *
Comment on: Do you "CALL" CL Commands from RPGIV?
Posted: 5 years 22 days 4 hours 47 minutes ago

I have some OVRPRTF, ADDLIBLE, etc. in RPGs, and these are generally done using "system".

Other commands done similarly are those from 3rd-party vendors.  For example, we have several of the Gumbo products such as Gumbo Mail and SpoolMail, so these commands are easily done from RPG with "system" as well.

Posted by: Paulster
Premium member *
Sweden and The Netherlands
Comment on: Do you "CALL" CL Commands from RPGIV?
Posted: 5 years 21 days 20 hours 23 minutes ago

Yep, done that. Not all the time mind you but if your RPG is trying to work with a bought piece of software for FTP, E-mail etc that does not supply API's you kinda have no options. Same situation as Viking basically. Works fine, though error handling can be a pain in the backside.

On the IBM supplied commands only OVRDBF sounds like something I have used in the pre-free-era. But nowadays we can use RPG for that so this has become obsolete.

Posted by: Ringer
Premium member *
Comment on: Do you "CALL" CL Commands from RPGIV?
Posted: 5 years 21 days 11 hours ago
Edited: Fri, 26 Jul, 2013 at 10:12:33 (1847 days ago)

I don't know a lot of IBM APIs so yeah, I use CL commands unless there is no RPG opcode/BIF/sub-procedure and no CL command, then I learn the API. Is the speed difference that much between an API and corresponding CL command these days? Putting on my armor, crawling back under rock.

Chris Ringer

PS: I mean I call a CL program containing many commands to perform some function, like copy data to IFS, change owner, authorities, etc.