|
View previous topic :: View next topic
|
| Author |
Message |
Alexis Sebastian
New User

Joined: 04 Mar 2010 Posts: 38 Location: DC
|
|
|
|
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 |
|
 |
Alexis Sebastian
New User

Joined: 04 Mar 2010 Posts: 38 Location: DC
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
Alexis Sebastian
New User

Joined: 04 Mar 2010 Posts: 38 Location: DC
|
|
|
|
Thank you. I understood.
Have a nice weekend!!! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|