Tuesday, November 15, 2011

Example of skeleton JCL

A skeleton JCL or JCL skel is a JCL template that another program can use with certain parameter and create dynamic JCL on the fly. Today I will show how skeletal JCL works with a simple example. Here is one example of skeleton JCL.

/* replace  all variables of JCL SKEL*/
&USER   = J12345
&JOBNAME   = J12345A
&FILE1 = N12345.F1
&FILE2 = N12345.F2
&FILE2 = N12345.F3
&FILE3 = N12345.F4
&IND = Y
/* write to the output dataset from skelton */
/* The JCL SKEL is in N12345.REXX.SKELL(JCLSKEL)*/
/* SUBJCL is the member name containing runtime JCL and will be created in N12345.DYNAM.JCL*/
ADDRESS ISPEXEC
"ISPEXEC LIBDEF ISPSLIB DATASET ID('"N12345.REXX.SKELL"')"
"ISPEXEC LIBDEF ISPFILE DATASET ID('"N12345.DYNAM.JCL"')"
"FTOPEN"
"FTINCL JCLSKEL"
"FTCLOSE NAME(SUBJCL) LIBRARY(ISPFILE)"
 CALL SUB
/* EXIT */
;END
SUB:
/*Function to submit a job*/


Above JCL skel has 7 variables  which are to be replaced with real values during run time and the calling program will pass actual values to use the above JCL skel. Above example also shows conditional use of a step which will be used only when the indicator variable is set to 'Y'. Please notice the second step of the JCL is within )SEL and )ENDSEL tag giving the calling program choice to use that step or not according to the requirement.

The calling program can be any module. Most cases you will use a JCL skel from a REXX code. Please see below REXX code snippet which uses the above JCL skel.


/&JOBNAME JOB (1200,4352),'John',
// MSGLEVEL=1,CLASS=A,NOTIFY=&USER,
// MSGCLASS=J 
//*
//* EXAMPLE STEP01 
//STEP01 EXEC PGM=PRG01
//INP DD DSN=&FILE1,
//  DISP=SHR 
//* 
//OUP DD DSN=&FILE2, 
//         DISP=(,CATLG,DELETE),SPACE=(CYL,(5,5),RLSE), 
//         DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//*
//* EXAMPLE STEP02   
)SEL &IND = Y
//STEP02 EXEC PGM=PRG02
//INP DD DSN=&FILE3,
//  DISP=SHR 
//* 
//OUP DD DSN=&FILE4
//               DISP=(,CATLG,DELETE),SPACE=(CYL,(5,5),RLSE), 
//       DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
)ENDSEL


1 comment: