1,150 pts.
 QCMDEXC
Hi, i have built a small application using CL to convert date to required format. When i want to accomplish the same from RPGLE program with a display file to input date i wanted to call CVTDAT command from the RPG program. But i am geting error saying this command can't be issued in this set...is my approach true what else should i do to get this right? Pl advice... thanks

Software/Hardware used:
ASKED: August 12, 2008  10:39 AM
UPDATED: August 13, 2008  4:50 PM

Answer Wiki:
Hi, The CVTDAT command can only be used from a CL program or REXX procedure, this is because it is passed variables from the command line (not as parameters from a call) and expects to return the resulting variable to the CL program/REXX procedure. You could use a small CL program to receive the parameters from your RPG program, execute the CVTDAT command and return the result to your RPG program. Although you may be able to achieve the same result using the built in functions of ILE/RPG. It depends what you're trying to do. Regards, Martin Gilbert.
Last Wiki Answer Submitted:  August 12, 2008  10:52 am  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi Martin
thanks a lot. So i can’t use those commands which return some value i hope and similarly can’t i use the SNDPGMMSG too?

thanks
Ram

 1,150 pts.

 

Hi,

You’re right – you can’t use SNDPGMMSG directly from the RPG program – but you can via a CL program. A lot of people make their own small CL programs for these sort of tasks – sometimes people create service programs which include a lot of the common tasks.

Regards,

Martin Gilbert.

 23,625 pts.

 

Hi,
can’t i call them using QCMDEXC API from RPG programs?both CVTDAT and SNDMSG? Actually i am using the QCMDEXC call. But still got those error messages.

thanks again
Ram

 1,150 pts.

 

Hi,

They won’t work from QCMDEXC (whether you use API or CALL), because they work with CL variables – QCMDEXC doesn’t use CL variables – it passes the values as parameters.

Probably best to make a couple of small CL program called CVTDATC, SNDPGMC, etc and use these from your RPG. The CL programs only have to accept/return parameters and run the commands.

Regards,

Martin.

 23,625 pts.

 

What kind of date conversion could you possibly need that CL can do, but RPG can’t ? RPG has very powerful date support.

 3,115 pts.

 

My recommendation after a lot of date work is to do everything in RPG.
RPG is feature rich when it comes to handling dates.
Why complicate it with a call to a CL program?

 5,525 pts.