|
View previous topic :: View next topic
|
| Author |
Message |
kushkush
New User
Joined: 30 Jun 2005 Posts: 37 Location: Germany
|
|
|
|
I need to extract data starting from 07:24 at position 1 to next 07:24 at position 1.
This job is working:
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
07:09
07:14
07:19
07:24
09:44
10:49
07:09
07:14
07:24
08:09
08:14
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,5,CH,EQ,C'07:24'),
PUSH=(81:ID=3),HIT=NEXT,
END=(1,5,CH,EQ,C'07:24'))
OUTREC IFTHEN=(WHEN=GROUP,
BEGIN=(81,3,CH,EQ,C'001'),
PUSH=(85:ID=1),
END=(81,3,CH,EQ,C'002'))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(85,1,CH,EQ,C'1'),
BUILD=(1,80)
END
/*
|
Result:
| Code: |
07:24
09:44
10:49
07:09
07:14
07:24
|
Is there a better way?
Thanks |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,5,CH,EQ,C'07:24'),END=(1,5,CH,EQ,C'07:24'),
PUSH=(81:ID=3)),
IFTHEN=(WHEN=GROUP,BEGIN=(81,3,ZD,EQ,+1),END=(81,3,ZD,EQ,+2),
PUSH=(81:81,3))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(81,3,ZD,EQ,+1),
REMOVECC,
BUILD=(1,80)
END |
|
|
| Back to top |
|
 |
kushkush
New User
Joined: 30 Jun 2005 Posts: 37 Location: Germany
|
|
|
|
| Thank you. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
May not be elegant but get you what you needed in one Group.
| Code: |
//S1 EXEC PGM=SORT
//SORTLIST DD SYSOUT=*
//SORTIN DD *
07:09
07:14
07:19
07:24
09:44
10:49
07:09
07:14
07:24
08:09
08:14
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'07:24'),PUSH=(81:ID=1))
OUTFIL OUTREC=(1,80),INCLUDE=(81,1,ZD,EQ,1),TRAILER1=(C'07:24')
|
Output:
| Code: |
********************************* TOP OF DATA **********************************
07:24
09:44
10:49
07:09
07:14
07:24
******************************** BOTTOM OF DATA ******************************** |
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Rohit Umarjikar wrote: |
| May not be elegant but get you what you needed in one Group. |
Looks good to me.  |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
| Joerg.Findeisen wrote: |
| Rohit Umarjikar wrote: |
| May not be elegant but get you what you needed in one Group. |
Looks good to me.  |
Thanks Joerg. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1442 Location: Bamberg, Germany
|
|
|
|
| Depending on the presence of the Eyecatcher as end of a section, additional data may be added. IMHO a more general approach would make sense to use, also when not only one section is to be captured. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
| That’s just for one selection specially the first one as asked. If anything changes then a more generic solution is certainly required. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|