Search code examples
mainframejcl

Can we add symbolic parameters in PDS members used in cataloged procedures?


I have JCL, which is executing one catalog procedure. In catalog procesdure one COBOL-DB2 pgm is being executed.


Below is my JCL

//A JOB (@),'CALL DB2',NOTIFY=&SYSUID
//JS010 EXEC TESTPROC

Below is my TESTPROC

//TESTPROC
//PS010 EXEC PGM=IKJEFT01,,DYNAMNBR=20
//STEPLIB DD DSN=TEST.LOADLIB,DISP=SHR
//SYSTSPRT DD SYSOUT=*                     
//SYSPRINT DD SYSOUT=*                     
//SYSUDUMP DD SYSOUT=*                     
//SYSTSIN  DD DSN=TEST.PDS(TESTPGM), 
//            DISP=SHR            
//SYSOUT DD SYSOUT=*

below is my SYSTIN data --TESTPGM

DSN SYSTEM(TEST)                    
RUN PROGRAM(TESTPGM) PLAN(TESTPLAN)
END 

My query is can I use symbolic parameters in place of TESTPGM and TESTPLAN in SYSTIN data member TESTPGM?

Regards, Saisha :)


Solution

  • As mentioned below you could have the PDS Member name become a symbolic value and then define each member in the PDS to point to a different program. Using your JCL as an example:

    //TESTPROC PROC MYPGM=
    //PS010 EXEC PGM=IKJEFT01,,DYNAMNBR=20
    //STEPLIB DD DSN=TEST.LOADLIB,DISP=SHR
    //SYSTSPRT DD SYSOUT=*                     
    //SYSPRINT DD SYSOUT=*                     
    //SYSUDUMP DD SYSOUT=*                     
    //SYSTSIN  DD DSN=TEST.PDS(&MYPGM), 
    //            DISP=SHR            
    //SYSOUT DD SYSOUT=*
    

    In the above example your EXEC statement would envoke the proc as:

    //JS010 EXEC TESTPROC,MYPGM=TESTPGM
    

    Another option, you could over-ride the SYSTSIN DD directly as follows:

    //A JOB (@),'CALL DB2',NOTIFY=&SYSUID
    //JS010 EXEC TESTPROC
    //PS010.SYSTSIN DD *
    DSN SYSTEM(TEST)                    
    RUN PROGRAM(TESTPGM) PLAN(TESTPLAN)
    END
    /*
    //
    

    One other suggestion... In your final implementation you might want to consider separating the

    DSN SYSTEM(TEST)
    

    from the

    RUN PROGRAM(TESTPGM) PLAN(TESTPLAN)
    END
    

    The reason is that you may find you want to run the program in multiple DB2 environments, not just SYSTEM(TEST). To do this, simply add another parameter DB2SYS= and modify as follows:

    //TESTPROC PROC DB2SYS=MYTEST,MYPGM=
    ...
    //SYSTSIN  DD DSN=TEST.PDS(&DB2SYS),DISP=SHR
    //         DD DSN=TEST.PDS(&MYPGM),DISP=SHR
    

    where PDS Member MYTEST has the DSN SYSTEM(TEST) statement already coded.