We help IT Professionals succeed at work.

Variables are Crossing into one another

Medium Priority
Last Modified: 2020-03-12
I am submitting a program from a CLLE program with 5 variables.  Inside the receiving program, the value from the second parameter is appearing in the first; the same for third to the second and so on.

The variables are relatively long; I allowed extra space in each of them to allow for growth and/or extended values.

When I call the second program (vs. SBMJOB) the variables behave.  I know it has something to do with the fact the variables are being passed by reference but I can't find how to keep it from happening.  Any suggestions?

Thank you for any help you're able to provide.

Watch Question

Dave FordSoftware Developer / Database Administrator

It would help if you posted snippets of your code ... at least the calling statement and the header fron the receiving program.
Drew StephensContractor


Thanks Dave, here is a simplified sample of my programming.

Interactive CL Driver program:

             DCL        VAR(&PARM1) TYPE(*CHAR) LEN(100) VALUE('/folder1')
             DCL        VAR(&PARM2) TYPE(*CHAR) LEN(20) VALUE('USERIDABC')
             DCL        VAR(&PARM3) TYPE(*CHAR) LEN(100) VALUE('rmt.site.com')
             DCL        VAR(&PARM4) TYPE(*CHAR) LEN(100) VALUE('/folder2')
             /*     */
             DCL        VAR(&PARM5) TYPE(*CHAR) LEN(100) VALUE('12345')
             /*     */
                          &PARM5)) JOB(SBMJOBABC) JOBD(*USRPRF) JOBQ(QBATCH4) +
                          JOBPTY(*JOBD) USER(SFTPUSR) ACGCDE(*USRPRF) +
                          SYSLIBL(*CURRENT) HOLD(*YES) SBMFOR(*CURRENT) /*   */

When the job is submitting and I look at the Batch Job's Job Log.  It looks like the respective parameters have the proper values.

                               Display Job Log                                  
                                                             System:   METALEX  
 Job . . :   SBMJOBABC     User . . :   SFTPUSR       Number . . . :   234877  
  .. CALL PGM(DRIVERBTCH) PARM('/folder1' 'USERIDABC' 'rmt.site.com' '/folder2'

Simplified Batch CL programming.

             PGM        PARM(&PARM1 &PARM2 &PARM3 &PARM4 &PARM5)

             DCL        VAR(&PARM1) TYPE(*CHAR) LEN(100)
             DCL        VAR(&PARM2) TYPE(*CHAR) LEN(20)
             DCL        VAR(&PARM3) TYPE(*CHAR) LEN(100)
             DCL        VAR(&PARM4) TYPE(*CHAR) LEN(100)
             DCL        VAR(&PARM5) TYPE(*CHAR) LEN(100)

             IF         COND(&PARM5 = ' ') THEN(DO)
                CALL       PGM(BATCHRPG) PARM(&PARM1 &PARM2 &PARM3 &PARM4)
             ELSE       CMD(DO)
                CALL       PGM(BATCHRPG) PARM(&PARM1 &PARM2 &PARM3 &PARM4 &PARM5)



When I look at the values of the respective fields via STRSRVJOB/STRDBG.

EVAL &PARM1                                                            
&PARM1 =                                                                
     1   '/folder1                         USERIDABC                  '
    61   '      rmt.site.com                     /'                    
 &PARM2 = 'USERIDABC           '  

  EVAL &PARM3                                                              
 &PARM3 =                                                                
      1   'rmt.site.com                     /folder2                   '  
     61   '      12345                            s'                      
 > EVAL &PARM4                                                              
   &PARM4 =                                                                
        1   '/folder2                         12345                      '  
       61   '      site.comE    /folder2E    12345»'  

 > EVAL &PARM5                                                              
   &PARM5 =                                                                  
        1   '12345                            site.comE    /folder2E    '  
       61   '12345»     network.comE    /DX014E    '                               

For some reason, the trailing BLANKS of the various parameters are not being sent or are being lost/ignored.

Any ideas?

Thanks again.

Theo KouwenhovenApplication Consultant

Parameters longer then afaik 32 positions give bizar result in the CL when calling is from a command line.

So you can do the following:

  1. Give the parameters the right length in the call , so add spaces upto the right length
  2. Add the VALUE() keyword to the DCL (with the required info)
  3. Make a command  for your CL or CLLE program

Option 1 is not doable with parameters of 100 positions
Option 2 is not flexible
So I would go for option 3