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

Processing Mutiple Header and trailer records in a file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Thu Feb 03, 2011 12:10 am
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top