You are on page 1of 5

Align JCL

Overview

This Rexx tool can be used for formatting and alignment of the JCL statements to follow JCL
coding standards. (I.e. to align the 'JOB','DD' and 'EXEC' statement in 10th column). The tool can be
executed by the line command ‘TSO JCLALIGN’. It gets the location of the JCL in the format of
‘PDS(MEM)' and aligns the JCL statement according to the JCL coding rules

Tool to align JCL statements

Objective of the tool

 This Rexx tool can be used for formatting and alignment of the JCL statements to follow JCL
coding standards

Procedure to use the tool

 The below screen shots explain the usage of the tool


 Below screen shows the JCL statements before execution of the tool
 This Rexx tool can be executed by the line command ‘TSO JCLALIGN’

 This will ask for the PDS and member name where the JCL is present
 The tool will align the JCL statement according to the JCL coding rules
 The below screen shot shows the JCL after alignment
SOURCE CODE OF THE REXX TOOL WHICH ALIGNS JCL STATEMENTS

 Given below is the source code of the Rexx tool to align JCL statements

/****REXX***/

SAY 'ENTER THE JCL IN THE FORMAT -- PDS(MEM):'


/****ALLOCATING DD TO A LOGICAL NAME 'INPUTD'****************/
PULL INPUTDSN
/***INPUTDSN = INPUTDD ||'(' || INPUTMM || ')' ***********************/
"ALLOC FI(INPUTD) DA("INPUTDSN") SHR REUSE"

/****OPENING INPUTD AND ASSIGNING TO A ARRAY 'DATA' ********/


"EXECIO * DISKRU INPUTD (STEM DATA. FINIS"

/****PROGRAMMMING********************************************/

/****FINDING NO OF RECORDS*************************************/
LEN=DATA.0
/****UPPERCASING ALL THE RECORDS***************************/
DO I = 1 TO LEN
UPPER DATA.I
PARSE VAR DATA.I WORD1 WORD2 WORD3
IF (WORD2 = 'JOB') | (WORD2 = 'DD') | (WORD2 = 'EXEC') THEN
DO
LEN1 = LENGTH(WORD1)
DO
IF LEN1 < 10 THEN
DO
LEN3 = 10 - LEN1
DO J = 1 TO LEN3
IF WORD2 = 'JOB'
THEN WORD1 = WORD1||'X'
ELSE WORD1 = SUBSTR(WORD1,1,10' ')
END
END
IF LEN1 > 10 THEN
IF POS('.',WORD1) = 0 THEN
DO
SAY 'IN CORRECT DD/JOB NAME IN ' DATA.I
WORD1 = SUBSTR(WORD1,1,10)
END
IF WORD2 = 'JOB' THEN WORD2 = 'JOB'
IF WORD2 = 'DD' THEN WORD2 = 'DD'
IF WORD2 = 'EXEC' THEN WORD2 = 'EXEC'
DATA.I = WORD1 WORD2 WORD3
END
END
END

/****OVERWRITING THE FORMATTED JCL IN THE SAME DATA SET *****/


/**"ALLOC FI(OUTPUTD) DA('"INPUTDD"') SHR REUSE" ************/
/**"ALLOC FI(OUTPUTD) DA('ISDXO96.REXX.JCL.OUTPUT') SHR REUSE"***/

"EXECIO * DISKW INPUTD (STEM DATA. FINIS"

/****FRREING THE PHYSICAL DATASET******************************/


"FREE DD(INPUTD)"

You might also like