Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Processing Mutiple Header and trailer records in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sasidarauthur

New User


Joined: 13 Jul 2006
Posts: 5
Location: chennai

PostPosted: Wed Feb 02, 2011 11:49 pm    Post subject: Processing Mutiple Header and trailer records in a file
Reply with quote

Hi,
I stucked up with processing mutiple header and trailer records
in a single file
here is the requirement

I/P:
HDR000325
abcd Y
CDEF N
sdfg N
adbf Y
TRL00032500004
HDR000326
1234 Y
asde Y
sdfgk N
adbfh Y
2345 N
TRL00032600005

I nee output as below

HDR000325
abcd Y
adbf Y
TRL00032500002
HDR000326
1234 Y
asde Y
adbfh Y
TRL00032600003

Any type of suggestions using Sync or DFsort helps. Icetool is not available for me to use

thanks a lot for help

Sasidar
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Feb 03, 2011 12:10 am    Post subject:
Reply with quote

What is the RECFM and LRECL of your input file?

What are the "rules" for getting from input to output?

What is the starting position, length and format of the relevant fields in your input records?
Back to top
View user's profile Send private message
sasidarauthur

New User


Joined: 13 Jul 2006
Posts: 5
Location: chennai

PostPosted: Thu Feb 03, 2011 12:18 am    Post subject:
Reply with quote

Hi Frank,

Recfm is FB and 80 LRECL
1. There will eiter Y or N in the 80th charater of the file for all detailed records
2. For Header and trailer 80th caracter is spaces
3. Header will start with 'HDR' followed by Seq number (in ex: 000325)
4. Trailer will start with 'TRL' followed by seq number followed by records count for respective sequence number

Output should have all the detailed records with a Y in 80th caracter under respective header Trailer sequence

Please let me know if you need any further info thanks
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Feb 03, 2011 1:50 am    Post subject: Reply to: Processing Mutiple Header and trailer records in a
Reply with quote

sasidarauthur,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=your input FB 80 lrecl file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  INCLUDE COND=(80,1,CH,EQ,C'Y',OR,(1,3,SS,EQ,C'HDR,TRL'))       
  SORT FIELDS=COPY                                               
  INREC IFOUTLEN=80,                                             
  IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(81:SEQ=5)), 
  IFTHEN=(WHEN=(1,3,CH,EQ,C'TRL'),                               
  OVERLAY=(10:81,5,ZD,SUB,+2,M11,LENGTH=5))                     
/*
Back to top
View user's profile Send private message
sasidarauthur

New User


Joined: 13 Jul 2006
Posts: 5
Location: chennai

PostPosted: Thu Feb 03, 2011 7:57 am    Post subject:
Reply with quote

Thanks Kolusu, it is working good for my requirement.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us