mainframezosjcldfsort

Generate a report using DFSORT


I have a task to write a JCL job invoking ICETOOL/DFSORT to generate a report. The report takes a VSAM KSDS as input and generates a list of bank branches.

Each record in the BRANCHES KSDS is of the form

• 4-byte binary unsigned integer representing a 6-digit decimal branch sortcode (e.g. 420101)

• 1-byte EBCDIC flag: ◦ EBCDIC 'A' means the branch is owned by ZeusBank and all its accounts are held in the ACCOUNTS KSDS

◦ EBCDIC 'B' means the branch is not owned by ZeusBank so we do not hold its account information in the ACCOUNTS KSDS

• 32-byte EBCDIC character branch name (e.g. “ZEUSBANK FOOFORD BAR STREET” or “OTHERBANK QUUXHAM BAZ ROAD”), blank padded on the right.

The report should look like this

enter image description here

I'm pretty new to JCL so please forgive if the question is simple. Thanks.


Solution

  • You can try this:

    //STEPSORT EXEC PGM=SORT
    //SYSOUT DD SYSOUT=*
    //SYSPRINT DD SYSOUT=*
    //SORTIN DD DSN=DATASETNAME
    //SORTOUT DD SYSOUT=*
    //SYSIN DD *
    SORT FIELDS=(5,1,CH,A)
    OUTFIL HEADER2=(1:C'LIST OF WHATEVER BANK',4/,
    1:C'SORTCODE',10:C'FLAG',15:C'BRANCH',/,
    1:C'--------',10:C'----',15:C'------'),
    BUILD=(1:1,4,BI,TO=ZD,LENGTH=6,10:5,1,15:6,32)
    /*