Pass Parameters more than 32 byte in SBMJOB command using RQSDTA



Variable greater than 32 byte length will be truncated to 32 byte (including the trailing spaces) when a call command is submitted using SBMJOB CMD(CALL PGM(*LIBL/PGM1) PARM( &ERROR & USER ....) Since you are trying to pass the value of a variable to another job from your interactive job environment but the other wont share the same environment hence the variable values are not accessible. hence these values are sent as values to another job and the default length is 32 per variable in CMD.
When your RPG/CL/CBL program get these variable the Error will have 32 byte of Error and then the 32 of User and so on (result in undesirable effect).

One way to do it put a limiter value at the end of each variable so there is no trailing spaces, but the best way to do that is instead using SBMJOB CMD(CALL PGM(*LIBL/PGM1) PARM( &ERROR & USER ....)  use SBMJOB RQSDTA(CMDV)

Example shown below (CL Program) but similar can be done in RPG or COBOL build the command string and add that to the submit command string then run the CL command using the QCMDEXC

 DCL        VAR(&Q) TYPE(*CHAR) LEN(1) VALUE(X'7D')                          (X'7D ->  ' )

   CHGVAR     VAR(&CMDV) VALUE('CALL PGM(*LIBL/PGM1) + 
                PARM('  || &Q || &ERROR   || &Q  *BCAT &Q + 
                              || &USER    || &Q  *BCAT &Q + 
                              || &EMLTADR || &Q  *BCAT &Q + 
                              || &SUBJECT || &Q  *BCAT &Q + 
                              || &CONTENT || &Q  *BCAT &Q + 
                              || &SPLFILE || &Q  *BCAT &Q + 
                              || &CCADR   || &Q  *BCAT &Q + 
                              || &BCCADR  || &Q  *BCAT &Q + 
                              || &JOBNM   || &Q  *BCAT &Q + 
                              || &JOBUSR  || &Q  *BCAT &Q + 
                              || &JOBNBR  || &Q  *BCAT &Q + 
                              || &SPLNBR  || &Q || ')')     
   SBMJOB     RQSDTA(&CMDV) JOB(SNDEML) JOBD(*USRPRF) +     
                JOBQ(QSYS/QSYSNOMAX) USER(USERX)            

Comments

Popular posts from this blog

AS400 : Add a new line in text in email SNDSMTPEMM

AS400 Display: Radio Button (SNGCHCFLD)

AS400 Display File: Check Box (MLTCHCFLD)