Page 1 of 1

Add one record at the top

PostPosted: Wed Mar 14, 2012 2:53 pm
by Sushmita V
Hi,

Can you please suggets how to add one record at the top in a file.

Input File:


123|456|78900
123|456|78901
123|456|78902
123|456|78903
123|456|78904


My output should be:

ABC|DEF|XYZ
123|456|78900
123|456|78901
123|456|78902
123|456|78903
123|456|78904


Please help.

Thanks!

Re: Add one record at the top

PostPosted: Wed Mar 14, 2012 3:56 pm
by bodatrinadh
Use Header concept.

Re: Add one record at the top

PostPosted: Wed Mar 14, 2012 10:02 pm
by skolusu
Sushmita V,

The following DFSORT JCL will give you the desired results

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                             
123|456|78900                               
123|456|78901                               
123|456|78902                               
123|456|78903                               
123|456|78904                               
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
  OPTION COPY                               
  OUTFIL REMOVECC,HEADER1=('ABC|DEF|XYZ')   
//*