How to add header using JCL SORT utility

Created on May 15, 2021, 5:34 a.m. - by Jack, Peter

I want to add header detail in the output file using SORT utility

Comments (4)

Srinivasan, Panneer Selvam
May 15, 2021, 5:39 a.m.

You need to give us more information like lrecl, recfm of the input and output file. 

Anyhow, what i can suggest you is, instead of creating new sort step to add header detail. you can modify the existing COBOL program to add header details on the output file.

Jack, Peter
May 15, 2021, 5:44 a.m.

Thanks Srinivasan. This file is not created by cobol program. we are receiving this file from the upstream distributed application via NDM transmission. 


Angel, Akash
May 16, 2021, 2:44 a.m.

Jack, You can add a Header by using the HEADER1 command in the SORT utility 

Angel, Akash
May 16, 2021, 2:47 a.m.

see this example code,

//STEP      EXEC PGM=SORT                                         
//SORTIN  DD   DSN=input file
//SORTOUT DD   DSN=output file
//SYSOUT  DD   SYSOUT=*                                           
//SYSIN   DD *                                                     
     OPTION COPY                                                   
      OUTFIL FNAMES=SORTOUT,                                       

Copyright 2020 by ibmmainframer. All Rights Reserved.