From: Toby Miller To: All
I have a question for all of you RPG programmers out there:
Our software calls a CL program to submit a report (written in RPG) to batch. Is there anyway to have the RPG program to submit itself without having to call the CL program? Any help is appreciated.
From: Ernie Malaga To: Toby Miller
Yes, there's a way. You can call QCMDEXC from the RPG program. QCMDEXC requires two parameters:
* A character string containing the command to be executed. * A decimal value (15 digits, 5 decimals -- this is a must!) describing the length of the character string.
Therefore, all you need to do is execute the following in your RPG program:
CALL 'QCMDEXC' PARM CMD PARM CMDLEN 155
Variable CMD should have the following:
'SBMJOB CMD(CALL PGM(YOURLIB/RPGPGM) + PARM(...)) JOB(...) JOBQ(...)'
CMDLEN can have a number greater than the actual length of the string. For example, if CMD is a 64-character alpha variable, CMDLEN can contain the number 64 or any number greater than 64.
Care must be taken so that the RPG program doesn't go into an infinite loop submitting itself, however. That is, the RPG program must know when it's being run interactively and when it's already running in batch, so that when it submits itself, the submitted copy doesn't submit yet another. You can do this with a parameter; perhaps there's a better way. For example:
*ENTRY PLIST PARM ALWSBM 1 ALWSBM IFEQ 'Y' CALL 'QCMDEXC' PARM CMD PARM CMDLEN 155 MOVE '1' *INLR ELSE (etc)
LATEST COMMENTS
MC Press Online