Comment/Un comment Multiple lines in COBOL code
This tool can come handy if you have to do a lot of commenting and un commenting in a COBOL module. Doing it manually is not my way so here’s another freebie for all you guys hungry for mainframe tools.
To use this clist you need to copy the code in a PDS allocated to Sysproc and then issue a “command line command” CCOM with parameters ON/OFF for commenting/un commenting respectively, and issue a “line command”
V- Single line command
Vn – n is the number of lines to be commented/uncommented
VV- It is a block command, the lines between a block will be commented / un commented.
/********************************************************************** /* TITLEÂ Â Â Â Â : CCOM /*——————————————————————- /* FUNCTIONÂ Â : TO BLOCK COMMENT OR UNCOMMENT COBOL STATEMENTS /*——————————————————————- /* AUTHORÂ Â Â Â : mainframewizard.com /*——————————————————————- /* DESCRIPTION: THIS CLIST COMMENTS OR UNCOMMENTS THE DESIRED NUMBER /*Â Â Â Â Â Â Â Â Â Â Â : OF COBOL STATEMENTS. /*Â Â Â Â Â Â Â Â Â Â Â : /*Â Â Â Â Â Â Â Â Â Â Â : /*——————————————————————- /* HOW TO RUN : COPY THIS MEMBER TO THE PDS ALLOCATED TO SYSPROC. OPEN /*Â Â Â Â Â Â Â Â Â Â Â : THE COBOL PROGRAM YOU WISH TO COMMENT OR UNCOMMENT. /*Â Â Â Â Â Â Â Â Â Â Â : TYPE ‘CCOM’ 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 ‘IDENTIFICATION DIVISION’ ALL /********************************************************************** /********* VALIDATING THAT IT IS A COBOL PROGRAM BEFORE RUNNING********* /********************************************************************** IF &LASTCC NE 0 THEN + DO SET &ZEDSMSG = &STR(NOT VALID COBOL) 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Â ‘*’ 7 .ZFRANGE .ZLRANGE ALL Â Â Â ISREDIT (EXLN,EXCNT) = EXCLUDE_COUNTS Â Â Â Â IF &PARM1=ON | &PARM1= THEN + Â Â Â Â Â Â DO Â Â Â Â Â Â Â IF &EXCNT=&TOT_LINES THEN + Â Â Â Â Â Â Â Â Â DO Â Â Â Â Â Â Â Â Â Â SET &ZEDSMSG = &STR(LINES UNCOMMENTED) Â Â Â Â Â Â Â Â Â Â ISPEXEC SETMSG MSG(ISRZ001) Â Â Â Â Â Â Â Â Â Â ISREDIT C ‘*’ ‘ ‘ 7 .ZFRANGE .ZLRANGE ALL Â Â Â Â Â Â Â Â Â Â ISREDIT RESET Â Â Â Â Â Â Â Â Â Â ISREDIT LOCATE .ZFRANGE Â Â Â Â Â Â Â Â Â Â EXIT CODE(1) Â Â Â Â Â Â Â Â Â END Â Â Â Â Â Â Â SET &ROWNO=&FIRST Â Â Â Â Â Â Â Â Â DO WHILE &ROWNO