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

Group operations: When trailer record repeats multiple times


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

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Sun Jun 13, 2010 2:29 pm
Reply with quote

Hi there,

I would like to know how to go about the group operations when a trailer record repeats multiple times. We do not exactly know the number of times trailer is repeated in each record. So, we can take the occurence of next header to the end of the previous record.

i have gone through

ftp.software.ibm.com/storage/dfsort/mvs/sortugpf.pdf

the following example is given there.


Code:

OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),
END=(1,3,CH,EQ,C'TRL'),PUSH=(31:ID=1))
OUTFIL INCLUDE=(31,1,CH,NE,C' '),BUILD=(1,3)


for example my input looks like below
Code:

....5...10...15...20...25
header        0
body
body
trailer
header        1
body
body
trailer
trailer
header        1
body
body
trailer
trailer
trailer
header
body
trailer


input file is LRECL 120 FB. If pos 15 is '1' then write the entire record in the output LRECL 120 FB.

Expected output
Code:

....5...10...15...20...25
header        1
body
body
trailer
trailer
header        1
body
body
trailer
trailer
trailer


Your help is much appreciated
Back to top
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Mon Jun 14, 2010 7:46 am
Reply with quote

Based on position 15 on header lines, if it is 1 then copy the entire record to the output. Even if that record(Header/body/trailers) has multiple tailers all the trailers of that record should be in the output dataset.

All the header/Body/trailers will have a single trailer atleast.

But, we must consider the header of the next record to be the end of the previous record.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 14, 2010 8:01 am
Reply with quote

Hi Srini,

Please review the topic and see if what is here is what you want. Looks like Bill and i were updating at the same time.

Why is the 1-char field indented as additional records are shown?

Note - i've added a "ruler" to the data and i'm not sure the data matches the descripton. Let me know if something needs to be changed,

d
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 14, 2010 10:12 am
Reply with quote

As requested - changes are made,

d
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Jun 14, 2010 9:15 pm
Reply with quote

THINKSRINIII,

Assuming your input is FB recfm and 80 byte LRECL, use the following DFSORT control cards which will give you the desired results.

Code:

//SYSIN    DD *                                                       
  SORT FIELDS=COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),PUSH=(81:15,1))
  OUTFIL BUILD=(1,80),INCLUDE=(81,1,ZD,EQ,1)                         
//*
Back to top
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Tue Jun 15, 2010 2:17 pm
Reply with quote

Many thanks for your time Kolusu.. I am trying to incorporate this solution into the below post where we have used "BEGIN" and "END" to denote a record with ID and Sequence number

ibmmainframes.com/viewtopic.php?t=49220

I will let you the results.

Thanks
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 How to split large record length file... DFSORT/ICETOOL 9
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top