|
The reason the 5001 field is defined inside the CL is because the last
character is used to pad the field when submitting to batch.
When the program runs it only references the first 5000 characters and
never needs to remove the padded 'X' (or whatever character was used).
This extra character takes care of the CL to CL submission issue when--
you have fields defined over 64 bytes long.
On CRPence Friday, May 25, 2012 10:42 AM wrote:
<<SNIP>>
I might suggest however, that if CONST is going to be used on the
prototype, then probably just as well to code the 5001 size in the
RPG program for the prototype of the invoked CL procedure. There is
little reason to copy the nearly 5K bytes from one place to another
again; i.e. such a copy would have been done already on the call
interface, as dictated by the CONST on the PR, so there is no reason
to copy that data into yet another temporary location in the CLProc.
<<SNIP>>
On 25 May 2012 08:04, Hiebert, Chris wrote:
I will usually wrap a submitted RPG job with a CL program and code
the CL program to be able to submit itself.
/* submitter program PROVSN_SUB */
PGM PARM(&SUBMIT &INPUTDS)
DCL VAR(&SUBMIT) TYPE(*CHAR) LEN(1)
DCL VAR(&INPUTDS) TYPE(*CHAR) LEN(5000)
/* Output defined as 1 char larger than input */
DCL VAR(&OUTDS) TYPE(*CHAR) LEN(5001)
IF COND(&SUBMIT *EQ 'Y') THEN(DO)
CHRVAR VAR(&OUTDS) VALUE(&INPUTDS)
/* Set a char after the last byte to pad for CL variables */
CHGVAR VAR(%SST(&OUTDS 5001 1)) VALUE('X')
SBMJOB CMD(CALL PGM(PROVSN_SUB) PARM('N' &OUTDS)) +
JOB(NMS) JOBQ(QBATCH4)
ENDDO
ELSE CMD(DO)
CALL PGM(PROVSN_NMS) PARM(&INPUTDS)
ENDDO
ENDPGM
Then you just need to prototype the call:
D submitprovsn PR EXTPGM('PROVSN_SUB')
D SUBMIT 1A CONST
D DATA 5000A CONST
<<SNIP>>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.