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

How to group the records and retrieve?


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

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Wed Mar 17, 2010 7:27 pm
Reply with quote

Hi All,

I have got a requirement to fecth only first set of records.

Example, I am having a file (80 bytes),

Code:

0EF PENS01001311   
1EF PENS01001311MONDAY
9EF PENS01001319Z   
0BC PENS01001311SBD
1BC PENS01001311TUESDAY
9BC PENS01001319Z   
0BC PENS01003311CO 
1BC PENS01003319WEDNESDAY 
9BC PENS01003319Z   


Set of records would be based on the value at first postion (0,1 and 9).

0-Header 1- detail and 9- Trailer. Like wise i may get n number of sets.

I would like to get only the first set of records.

I am getting date in the header record, can we use that string to stop fetching next record? else
can we group the records based on the value at postion 1 (0,1 and 9)and fecth the first group?

Please let me know if this can be done in SORT?
Back to top
View user's profile Send private message
Alexis Sebastian

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Wed Mar 17, 2010 8:16 pm
Reply with quote

Hi All,

I understood the concep GROUP from manuals and coded as below.
Code:

//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=GROUP,                     
                 BEGIN=(1,1,CH,EQ,C'0'),       
                 END=(1,1,CH,EQ,C'9'),         
                 PUSH=(81:ID=1))               
  OUTFIL INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
//*                                             


It worked fine. Please let me know if i can use anyother method?

Thanks in advance
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Mar 17, 2010 9:50 pm
Reply with quote

Alexis Sebastian,

That is the right way to do it , but remember that you are only using 1 byte ID which would repeat it after every 10 groups. So if you have more than 10 groups you would include the 1,11,21.... groups also.

I suggest to increase the ID to 8 bytes.

Code:

//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=GROUP,                     
                 BEGIN=(1,1,CH,EQ,C'0'),       
                 END=(1,1,CH,EQ,C'9'),         
                 PUSH=(81:ID=8))               
  OUTFIL INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)
//*
Back to top
View user's profile Send private message
Alexis Sebastian

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Sat Mar 20, 2010 11:54 pm
Reply with quote

Thank you. I understood.

Have a nice weekend!!!
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 only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Using Java/C/C++ to retrieve dataset ... Java & MQSeries 6
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top