JCL Comment & Null

JCL Comments are used to provide additional information about the code. We use Comments because it helps other developers to understand more about the code.

Syntax to comment a line in JCL

//*

If you want to comment a line, simply code //* in the first 3 columns in a JCL. Similarly, If you want to comment multiple lines, you have to comment //* in the first 3 columns of each line.

Example for JCL Comment

//CRTGDG JOB (345),’TRAINOOL’,CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//************************************************************
//* DEFINE GDG BASE
//************************************************************
//STEP10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
DEFINE GDG ( NAME(MATEKS.SALES.WEEK) –
LIMIT(3) –
NOEMPTY –
NOSCRATCH )
/*
//

In the example above, the comments are from line 3 to line 5 i.e.

//************************************************************
//* DEFINE GDG BASE
//************************************************************

Tip: How to comment multiple lines

Consider the example above – 

//MATEKSD JOB (SORTRTL),’TUTORIALBRAIN’,MSGCLASS=C,CLASS=P,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//*
//*********************************************************
//* SORT THE INPUT FILE
//*********************************************************
//STEP1000 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SORTIN   DD DSN=MATEKS.TUTORIAL.SORTIN,DISP=SHR
//SORTOUT DD DSN=MATEKS.TUTORIAL.SORTOUT,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SORTWK01 DD SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA
//SORTWK02 DD SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA
//SORTWK03 DD SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA
//SYSIN DD *
   SORT FIELDS=(1,5,CH,A)
/*
//*********************************************************
//* MERGE 2 FILES INTO ANOTHER FILE
//*********************************************************
//STEP2000 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SORTIN01 DD DSN=MATEKS.TUTORIAL.IBRAIN1,DISP=SHR
//SORTIN02 DD DSN=MATEKS.TUTORIAL.IBRAIN2,DISP=SHR
//SORTOUT DD DSN=MATEKS.TUTORIAL.MERGED.BRAIN,
//     DISP=(NEW,CATLG,DELETE),
//     SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//     DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SORTWK01 DD SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA
//SORTWK02 DD SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA
//SORTWK03 DD SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA
//SYSIN DD *
   MERGE FIELDS=(1,4,CH,D,5,10,BI,D)
/*
//*

  • Similarly, if we want to comment STEP2000 at once without going to each line and manually commenting each line one by one. Because if we comment each line one by one, it is a time-consuming process.

So, shortcut to do this is-

  • Create a label at the start and end of STEP2000 with any name(say, .A and .B)
  • Now, change ‘//’ to ‘//*’ between label .A and .B by issuing the command – C ALL ‘//’ ‘//*’ .A .B
  • In the end, STEP2000 is commented out except one line where you can provide a comment for the line which has the sort card as –    MERGE FIELDS=(1,4,CH,D,5,10,BI,D)

JCL NULL statement

The JCL NULL statement is used to mark the end of a JCL.

Furthermore, it denotes two forward slashes in the first 2 columns and leaving the rest of the columns after that as empty. This means, if you place ‘//‘ in column 1 and 2 and keep other columns as empty, then it is treated as a Null Statement in JCL.

  • If we insert a JCL NULL statement(//) in a JCL, then all the steps or statements after this statement will be ignored during job execution.
  • Avoid coding this in a PROC until you are required to debug an error. We will discuss PROC once we move further in this tutorial.

JCL Interview Question and Answers

1.

//   IF RC=4 THEN  /*COMMENT*/
               CONTINUE
  //    ELSE   /*COMMENT*/
  //STEP1
 //     ENDIF  /*COMMENT*/

 

a. Comment cannot be coded after the statements
b. CONTINUE is not a JCL statement
c. no errors
d. you cannot leave a space between // and IF.

b. CONTINUE is not a jcl statement

2. How will u denote a Comment in a JCL?

a. //
b. //*
c. /*
d. *//

Tutorials for all brains!