Comment-Uncomment JCL|Mainframewizard is a ibm mainframe training site providing mainframe tutorials for cobol programmers looking for mainframe jobs.

Comment/ Un comment  multiple lines in JCL

The following CLIST code can be used to comment/uncomment JCL code with ease. The instructions to use this are provided in the comments.

/********************************************************************** /* TITLE      : JCOM /*——————————————————————- /* FUNCTION   : TO BLOCK COMMENT OR UNCOMMENT THE JCL /*——————————————————————- /* AUTHOR     : /*——————————————————————- /* DESCRIPTION: THIS CLIST COMMENTS OR UNCOMMENTS THE DESIRED NUMBER /*            : OF JCL STATEMENTS. /*            : /*            : /*——————————————————————- /* HOW TO RUN : COPY THIS MEMBER TO THE PDS ALLOCATED TO SYSPROC. OPEN /*            : THE JOB IN WHICH YOU WISH TO COMMENT OR UNCOMMENT. /*            : TYPE ‘JCOM’ WITH PARMETER ON/OFF FOR COMMENTING AND /*            : UNCOMMENTING RESPECTIVELY ON THE COMMAND LINE AND GIVE /*            : ANY OF THE COMMANDS V,VN,VV AT THE LINE COMMAND AREA /*            : WHERE V IS A SINGLE LINE COMMAND, N IS THE NUMBER TO BE /*            : GIVEN TO COMMENT N NUMBER OF LINES, VV IS BLOCK COMMAND /*            : YOU CAN USE THIS AS ANY OTHER LINE COMMAND LIKE C,R,M /********************************************************************** ISREDIT MACRO (PARM1) NOPROCESS ISPEXEC CONTROL ERRORS RETURN ISREDIT PROCESS RANGE V IF &LASTCC >= 16 THEN EXIT CODE(&LASTCC)   ISREDIT (CMD) = RANGE_CMD ISREDIT FIND FIRST ‘//’ 1 /********************************************************************** /********* VALIDATING THAT IT IS A JCL BEFORE SCANNING  **************** /********************************************************************** IF &LASTCC NE 0 THEN + DO SET &ZEDSMSG = &STR(NOT VALID JCL) ISPEXEC SETMSG MSG(ISRZ001) GOTO ENDCLIST END /********************************************************************** /*STORING FIRST AND LAST LINE NUMBERS /********************************************************************** ISREDIT (FIRST) = LINENUM .ZFRANGE ISREDIT (LAST) = LINENUM .ZLRANGE /********************************************************************** /*GETTING TOTAL NO OF LINES /********************************************************************** SET TOT_LINES=&LAST – &FIRST + 1  IF &STR(&CMD) =  THEN +    DO     SET &ZEDSMSG = &STR(LINE COMMAND ‘V’ PENDING)     ISPEXEC SETMSG MSG(ISRZ001)     EXIT CODE(12)    END  IF &STR(&CMD) = &STR(V) THEN +    DO     ISREDIT X  ‘//*’ .ZFRANGE .ZLRANGE ALL     ISREDIT (EXLN,EXCNT) = EXCLUDE_COUNTS    ISREDIT C ‘/*’ ‘//*’ .ZFRANGE .ZLRANGE NX ALL    ISREDIT X  ‘//*’ .ZFRANGE .ZLRANGE ALL      IF &PARM1=ON | &PARM1= THEN +        DO         IF &EXCNT=&TOT_LINES THEN +           DO            SET &ZEDSMSG = &STR(LINES UNCOMMENTED)            ISPEXEC SETMSG MSG(ISRZ001)            ISREDIT C ‘//*’ ‘//’ .ZFRANGE .ZLRANGE ALL            ISREDIT RESET            ISREDIT LOCATE .ZFRANGE            EXIT CODE(1)           END         SET &ROWNO=&FIRST         ISREDIT C ‘//’ ‘//*’ .ZFRANGE .ZLRANGE NX ALL           DO WHILE &ROWNO