Home

Replace values in a file

The value in a file can be replaced in JCL using FINDREP command as shown below: Sample Input : Mainframe worddWordd of MainframeMainframeWorddlyHellowordd Mainframe! FINDREP command can be used to find and replace the contents in the input record.  //EXEC PGM=SORT //SYSPRINT DD SYSOUT=* //SYSOUT   DD SYSOUT=* //SORTIN   DD DSN=<input file>, //    […]

READ MORE

Join Contents of Files

Two files can be merged in JCL using JOINKEYS operand of SORT utility. This is similar to the JOIN clause in SQL DB2.  The sample JCL is used with both files mentioned in SORTJNF1 and SORTJNF2 and REFORMAT operand. The sort card is substituted as per the requirement. //EXEC PGM=SORT //SYSPRINT DD SYSOUT=* //SYSOUT   […]

READ MORE

Reverse the contents of a file 

The contents in an unsorted file can be reversed using the JCL SORT utility. This can be achieved by adding a temporary sequence number preferably after the logical file length and then trimming this sequence number using OUTREC build. //EXEC PGM=SORT//SYSPRINT DD SYSOUT=*//SYSOUT   DD SYSOUT=*//SORTIN   DD DSN=<input file>,//        DISP=SHR//SORTOUT  DD […]

READ MORE

Check File is Available

To check if a sequential File is available or not . This step may be required when the system is expecting a file to be created by another step or to be sent by an external source into the mainframe. This can be achieved with different JCL utilities such as IDCAMS etc 1.Using IDCAMS In […]

READ MORE

Check File is Empty

To check if a sequential File is empty is a usual step added in a job on practical scenario. The  general use cases for doing the same are :  This can be achieved with different JCL utilities such as ICETOOL, FILEAID, IDCAMS etc A.Using ICETOOL EMPTY operand with COUNT can be used to find if […]

READ MORE