Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us