Page 1 of 1

Record from input file as header in output file

PostPosted: Fri May 30, 2008 12:13 pm
by Niha.R.Rai
I have two input files

F1:
*****************************************
XX12
*****************************************
F2:
*****************************************
A1234 Class
B1212 Class
D3440 School
C1234 Class
*****************************************

I want the output file to contain a header capturing '12' from File 1 and the detail records should be sorted from F2, the output should look like

F3:
*****************************************
Sequence : 12
A1234 Class
B1212 Class
C1234 Class
D3440 School
*****************************************

Does anyone know how to do this , can we use a join or something ? And I want it only in SYNCSORT or DFSORT as we are cannot use ICETOOL or ICEMAN .

Re: Record from input file as header in output file

PostPosted: Fri May 30, 2008 5:41 pm
by CICS Guy
Niha.R.Rai wrote:And I want it only in SYNCSORT or DFSORT as we are cannot use ICETOOL or ICEMAN .
Why can't you use them?

Re: Record from input file as header in output file

PostPosted: Fri May 30, 2008 9:08 pm
by Frank Yaeger
Niha,

Here's a DFSORT job that will do what you asked for:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTREC BUILD=(C'TARG,''',3,2,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  SORT FIELDS=(1,11,CH,A)
  OUTFIL REMOVECC,
    HEADER1=('Sequence : ',TARG)
/*


And I want it only in SYNCSORT or DFSORT as we are cannot use ICETOOL or ICEMAN.


PGM=ICEMAN invokes DFSORT or SYNCSORT so you can certainly use it.

If you have DFSORT, then you have ICETOOL. ICETOOL has been part of DFSORT since 1991.