IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Merge Header and trailer Records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vsrao_2k

New User


Joined: 12 Dec 2005
Posts: 13

PostPosted: Tue Jan 26, 2010 12:11 am
Reply with quote

Hi Frank,

I am having a flat file of length 80(LRECL). I am having Header,Trailer and detailed records in the file of same length. I want the date from header record + No.of records from the trailer record. How to do this using ICETOOL?

I have included INCLUDE COND(1,3,CH,EQ,C'PID',OR,
1,3,CH,EQ,C'TRL') which will filter Header and trailer records.

But I want header record date which is at 10,6 + Total no.of records from trailer record 10,6 in the same record in the output file.

Please suggest me.

Thanks
Sreenivas.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Jan 26, 2010 12:39 am
Reply with quote

Please post a sample of your input and what you want the output to look like.
Please post lrecl and recfm of the input and output.
Back to top
View user's profile Send private message
vsrao_2k

New User


Joined: 12 Dec 2005
Posts: 13

PostPosted: Tue Jan 26, 2010 1:05 am
Reply with quote

Input file: LRECL=80 and RECFM=FB
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
PID=STCA 100122 START   3.0.0                   -->header record
S0000990390011350006 428418102   ASUPVS4111111111111111   
S0000990390011350006 428418102   ASUPVS4111111111111111   
S0000990390017580002 968189005   ASUPVS5111111111111111   
S0000990390001780000 132618703   ASUPVS8111111111111111   
S0000990390011350006 528418102   ASUPVS4111111111111111   
S0000990390017580002 111189005   ASUPVS5111111111111111   
S0000990390001780000 132618703   ASUPVS7111111111111111   
S0000990390011350006 428434321   AsUPVS4111111111111111   
S0000990390017580002 968189005   ASUPVS5111111111111111   S0000990390001780000 192618703   AsUPVS6111111111111111--->detailed records
TRL=ENDS 000010 ------------->trailer record   

OUTPUT file: LRECL=80 and RECFM=FB
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-
100122 000010
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Jan 26, 2010 1:40 am
Reply with quote

Will there be multiple sets of HDR/DETAIL/TRL groups in a single input?
Back to top
View user's profile Send private message
vsrao_2k

New User


Joined: 12 Dec 2005
Posts: 13

PostPosted: Tue Jan 26, 2010 2:05 am
Reply with quote

No. There is be always only header and one trailer record will be available in the file. But Detailed records will be N.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 26, 2010 2:45 am
Reply with quote

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

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
   OPTION COPY
   INCLUDE COND=(1,3,SS,EQ,C'PID,TRL')
   INREC IFOUTLEN=80,
    IFTHEN=(WHEN=(1,3,CH,EQ,C'PID'),
     BUILD=(10,6)),
    IFTHEN=(WHEN=NONE,BUILD=(8:10,6))
   OUTREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(1:1,6))
   OUTFIL STARTREC=2,ENDREC=2
/*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Jan 26, 2010 3:24 am
Reply with quote

Even this sort card will do too
Code:

//SYSIN    DD *                                                       
  OPTION COPY                                                         
  INCLUDE COND=(1,3,SS,EQ,C'PID,TRL')                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'PID'),PUSH=(81:10,6))   
  OUTFIL BUILD=(81,6,X,10,6),INCLUDE=(1,3,CH,EQ,C'TRL')               
/*                                                                     
Back to top
View user's profile Send private message
vsrao_2k

New User


Joined: 12 Dec 2005
Posts: 13

PostPosted: Tue Jan 26, 2010 3:15 pm
Reply with quote

Thank you. Both solutions are working good. Thanks once again.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top