SORT CARD, SUM Fields Option is used to do the following functionalities: Eliminate the Duplicates based on a specific field/vale position. Eliminate the duplicates from the entire record. SUM Up the values of specific positions while eliminating the Duplicates. SUM up the values of specific positions and place the Sum in a different position while
Converting VB file to FB or FB file to VB format is a common requirement. JCL SORT utility has the FTOV & VTOF options to convert the datasets as reuired. Converting from FB to VB //STEP1 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=MHY.TEST.SORTIN,DISP=SHR //SORTOT DD DSN=MHY.TEST.VB.OUT,DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA,SPACE=(CYL,(10,5),RLSE) Notes: No need to give any
This SORT example is to add Header and Trailer to the sorted file along with the total number of records. Header –> A Name along with the current System date Trailer–> A static message along with number of input records count Example Sort Card: //JOBRPT09 JOB MSGLEVEL=(1,1),MSGCLASS=X //********************************************************************** //* ADDING HEADER AND TRAILER ALONG WITH
JCL Trick to write the output file in reverse order of input using SORT. If the input file has some records in Random order ( not in sorted order) and if the out file needs to be written exactly in reverse order. This can be achieved by using the SORT Overlay along with OUTREC BUild.