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
 

 

How to group the records and retrieve?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to group the records and retrieve?
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Need Help with : IFTHEN(WHEN=GROUP) Sumanta_89 DFSORT/ICETOOL 1 Wed Apr 19, 2017 5:23 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am


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