Mainframe Utility: JCLSPLIT

Return to Mainframe Utilities Page

Module


ISREDIT MACRO (HELP)
ISPEXEC CONTROL ERRORS RETURN
/**** SET MESSAGE DISPLAY ON/OFF BASED ON THE DEBUG SWITCH ***/
ISPEXEC VGET (DBGSWTCH) PROFILE
IF &DBGSWTCH = &STR(ON) THEN CONTROL MSG LIST CONLIST SYMLIST NOFLUSH
ELSE CONTROL NOMSG NOLIST NOFLUSH NOPROMPT
/******************************************************************/
/* 'JCLSPLIT' EDIT MACRO. SPLIT UP A JCL DD LINE                  */
/* AUTHOR : DAVID LEIGH    DATE : 4-24-89                         */
/******************************************************************/

IF &HELP = &STR(HELP) THEN GOTO HELPSEC

ISREDIT (LN,CL) = CURSOR
ISREDIT CURSOR = 1 0
ISREDIT FIND NEXT P'=' 1 X
SET SAVECC = &LASTCC

IF &SAVECC > 0 THEN +
    DO
        SET SAVECC = 0
        ISREDIT CURSOR = &LN &CL
    END

SET LPAREN = &STR((
SET RPAREN = &STR())
SET GOODCNT = 0
SET BADCNT = 0

LOOP: +
ISREDIT (DATA) = LINE .ZCSR
IF &SUBSTR(1:2,&STR(&DATA)) = &STR(//) THEN
ELSE +
    DO
        SET BADCNT = &BADCNT + 1
        GOTO CONTINUE
    END

IF &SYSINDEX(&STR( DCB=&LPAREN.SYS3.DSCB,),&STR(&DATA)) > 0 THEN +
    DO
        SET BADCNT = &BADCNT + 1
        GOTO CONTINUE
    END

IF &SYSINDEX(&STR(/)&STR(/)&STR(*),&STR(&DATA)) = 1 THEN +
    DO
        SET BADCNT = &BADCNT + 1
        GOTO CONTINUE
    END

IF &SYSINDEX(&STR( LRECL=),&STR(&DATA)) > 0 THEN +
    DO
        SET BADCNT = &BADCNT + 1
        GOTO CONTINUE
    END

IF &SYSINDEX(&STR( RECFM=),&STR(&DATA)) > 0 THEN +
    DO
        SET BADCNT = &BADCNT + 1
        GOTO CONTINUE
    END

IF &SYSINDEX(&STR( BLKSIZE=),&STR(&DATA)) > 0 THEN +
    DO
        SET BADCNT = &BADCNT + 1
        GOTO CONTINUE
    END

IF &SYSINDEX(&STR( EXEC ),&STR(&DATA)) > 1 AND +
   &SYSINDEX(&STR(,),&STR(&DATA)) > 1 AND +
   &SYSINDEX(&STR(,),&STR(&DATA)) < +
   &SYSINDEX(&STR(=),&STR(&DATA)) THEN +
    DO
        SET A = &SYSINDEX(&STR(,),&STR(&DATA))
        IF &A > 0 THEN SET A = &A - 1
    END
ELSE +
    SET A = &SYSINDEX(&STR(=),&STR(&DATA))

IF &A = 0 THEN +
    DO
        SET BADCNT = &BADCNT + 1
        GOTO CONTINUE
    END

ISREDIT FIND '&&' .ZCSR .ZCSR ALL
IF &LASTCC = 0 THEN +
    DO
        ISREDIT CHANGE '&&' '¦' .ZCSR .ZCSR ALL
        ISREDIT (DATA) = LINE .ZCSR
        SET AMPER = YES
    END
ELSE SET AMPER = NO

SET B = &A
SET EOL = NO
SET Y = 0
SET LPCOUNT = 0
SET RPCOUNT = 0
DO WHILE &EOL = NO
    SET X = &SUBSTR(&B:&B,&STR(&DATA))
    IF &STR(&X) = &STR(&LPAREN) THEN SET LPCOUNT = &LPCOUNT + 1
    IF &STR(&X) = &STR(&RPAREN) THEN SET LPCOUNT = &LPCOUNT - 1
    IF &STR(&X) = &STR(,) AND &LPCOUNT = 0 THEN +
        DO
            SET Y = &Y + 1
            IF &Y = 1 THEN +
                SET LINE&Y = &SUBSTR(1:&B,&STR(&DATA))
            ELSE +
                SET LINE&Y = &STR(//             )+
                             &SUBSTR(&C:&B,&STR(&DATA))
            SET C = &B + 1
        END
    IF &SUBSTR(&B:72,&STR(&DATA)) >    THEN SET B = &B + 1
    ELSE +
        DO
            SET EOL = YES
            SET Y = &Y + 1
            IF &Y > 1 THEN +
                DO
                    SET GOODCNT = &GOODCNT + 1
                    SET LINE&Y = &STR(//             )+
                                 &SUBSTR(&C:&B,&STR(&DATA))
                    SET D = &STR(&&LINE&Y)
                    IF &SUBSTR(3:&LENGTH(&STR(&D)),&STR(&D)) <=  THEN +
                        SET Y = &Y - 1
                END
            ELSE +
                DO
                    SET BADCNT = &BADCNT + 1
                    GOTO CONTINUE
                END
        END
END

ISREDIT LINE .ZCSR = '&LINE1'
IF &AMPER = YES THEN ISREDIT CHANGE '¦' '&&' .ZCSR .ZCSR ALL

DO WHILE &Y > 1
    SET DATA = &STR(&&LINE&Y)
    IF &SYSINDEX(&STR('),&STR(&DATA)) > 0 THEN +
        DO
            ISREDIT LINE_AFTER .ZCSR = "&DATA"
            IF &ER = YES THEN ISREDIT CHANGE '¦' '&&' .ZCSR .ZCSR ALL
        END
    ELSE +
        DO
            ISREDIT LINE_AFTER .ZCSR = '&DATA'
            IF &ER = YES THEN ISREDIT CHANGE '¦' '&&' .ZCSR .ZCSR ALL
        END
    SET &Y = &Y - 1
END

CONTINUE: +
ISREDIT FIND NEXT P'=' 1 X
SET SAVECC = &LASTCC

IF &SAVECC = 0 THEN GOTO LOOP

SET ZEDLMSG = &STR(&GOODCNT LINE(S) SPLIT, &BADCNT LINE(S) BYPASSED)
ISPEXEC SETMSG MSG(UTLZ000)

EXIT

HELPSEC: +
CLEAR
WRITE *** HELP FOR EDIT MACRO 'JCLSPLIT' ***
WRITE
WRITE THE "JCLSPLIT" EDIT MACRO WILL SCAN "EXCLUDED" LINES IN A FILE
WRITE BEING EDITED AND FIND JCL LINES THAT CONTAIN MORE THAN 1
WRITE PARAMETER ON A GIVEN LINE.  THESE LINES ARE THEN SPLIT UP INTO
WRITE MULTIPLE LINES OF 1 PARAMETER PER LINE.  IF NO EXCLUDED LINES
WRITE EXIST, THE MACRO WILL ATTEMPT TO PROCESS THE LINE THAT THE CURSOR
WRITE IS ON WHEN THE MACRO IS INVOKED.  THE MACRO IS ABLE TO GO THROUGH
WRITE EVERY LINE IN THE FILE IF THEY ARE ALL "EXCLUDED".  WHEN A LINE
WRITE CAN BE SPLIT, IT IS SPLIT, AND WHEN IT CANNOT BE SPLIT, IT IS
WRITE BYPASSED. THE MACRO COUNTS THE NUMBER OF LINES IT PROCESSES AND
WRITE THE NUMBER IT BYPASSES AND DISPLAYS THE COUNTS AT THE END OF THE
WRITE PROCESSING.
WRITE
WRITE BASIC SYNTAX :
WRITE
WRITE COMMAND ===> JCLSPLIT
WRITE XX0100 //DD1       DD DSN=PCWCA.PWBAT.DEALER.CSIINFO(0),DISP=SHR
WRITE 000200 //DD2       DD DSN=PCWCA.PWBBU.DEALER.CSIINFO(+1),
WRITE 000300 //             UNIT=SYSDA,
WRITE 000400 //             DISP=(NEW,CATLG,DELETE),
WRITE 000500 //             DCB=(SYS3.DSCB,
WRITE 000600 //             LRECL=1128,BLKSIZE=14664,RECFM=FB),
WRITE 000700 //             SPACE=(CYL,(2,5),RLSE)
WRITE 000800 //*
WRITE XX0900 //PS130   EXEC PGM=PWBPEF05,REGION=640K
WRITE
WRITE RESULT :
WRITE
WRITE COMMAND ===>
WRITE 2 LINE(S) SPLIT, 7 LINE(S) BYPASSED
WRITE 000100 //DD1       DD DSN=PCWCA.PWBAT.DEALER.CSIINFO(0),
WRITE 000200 //             DISP=SHR
WRITE 000300 //DD2       DD DSN=PCWCA.PWBBU.DEALER.CSIINFO(+1),
WRITE 000400 //             UNIT=SYSDA,
WRITE 000500 //             DISP=(NEW,CATLG,DELETE),
WRITE 000600 //             DCB=(SYS3.DSCB,
WRITE 000700 //             LRECL=1128,BLKSIZE=14664,RECFM=FB),
WRITE 000800 //             SPACE=(CYL,(2,5),RLSE)
WRITE 000900 //*
WRITE 001000 //PS130   EXEC PGM=PWBPEF05,
WRITE 001100 //             REGION=640K
WRITE
WRITE SPECIAL NOTES : THE RESULTING "SPLIT" LINE WILL NOT NECESSARILY
WRITE                 LINE UP WITH THE PREVIOUS LINE.  INSTEAD, THE
WRITE                 MACRO ALWAYS PUTS THE PARAMETER IN THE RESULTING
WRITE                 NEW LINE IN COLUMN 16 PER VOLUME 5 STANDARDS.
WRITE
WRITE *** END OF HELP *** NO PROCESSING PERFORMED ***
EXIT
            


Documentation


 This utility will read all the JCL lines that are excluded in a file of JCL and
 attempt to split lines that contain more than one parameter per line into 2 or
 more lines, and line up the parameters in the proper columns.
            


Leave a Reply

Your email address will not be published. Required fields are marked *