View previous topic :: View next topic
Author
Message
fredrick andrews New User Joined: 10 Jun 2010Posts: 52 Location: chennai
Hi Experts,
I have this requirement.
I tried this job card and got something different ..
File : 500 FB
Code:
JOB CARD
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1111
POEA
2222
3333
POEA
2222
3333
5555
****
5555
POEA
3333
5555
****
5555
POEA
2222
5555
7777
POEA
6355
4445
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'POEA'),
PUSH=(501:ID=8))
SORT FIELDS=(501,8,ZD,A)
/*
I am getting :
Code:
1111
POEA 00000001
2222 00000001
3333 00000001
POEA 00000002
2222 00000002
3333 00000002
5555 00000002
**** 00000002
5555 00000002
POEA 00000003
3333 00000003
5555 00000003
**** 00000003
5555 00000003
POEA 00000004
2222 00000004
5555 00000004
7777 00000004
POEA 00000005
6355 00000005
4445 00000005
But, I want something like this:
Code:
1111
POEA 00000001
2222 00000002
3333 00000003
POEA 00000001
2222 00000002
3333 00000003
5555 00000004
**** 00000005
5555 00000006
POEA 00000001
3333 00000002
5555 00000003
**** 00000004
5555 00000005
POEA 00000001
2222 00000002
5555 00000003
7777 00000004
POEA 00000001
6355 00000002
4445 00000003
Is this possible?
Appreciate all the help!
Thanks for looking.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
If would have been helpful if you'd explained the "rules" for getting from input to output, but based on what you've said, I'm guessing that these DFSORT control statements will give you what you want:
Code:
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'POEA'),
PUSH=(501:SEQ=8))
Back to top
fredrick andrews New User Joined: 10 Jun 2010Posts: 52 Location: chennai
Frank Yaeger wrote:
If would have been helpful if you'd explained the "rules" for getting from input to output, but based on what you've said, I'm guessing that these DFSORT control statements will give you what you want:
Code:
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'POEA'),
PUSH=(501:SEQ=8))
The 'POEA' record should be labelled 00000001
and the following records will have the sequence continuing 00000002 ,
00000003 , 00000004 and so on. This will happen till another 'POEA' record is encountered . The sequence again starts 00000001 and so on till the next 'POEA' record.
Code:
1111
POEA 00000001 -> Sequence starts
2222 00000002 -> Goes on
3333 00000003
POEA 00000001 -> Starts again
2222 00000002
3333 00000003
5555 00000004
**** 00000005
5555 00000006
POEA 00000001 -> Starts again
3333 00000002
5555 00000003
**** 00000004
5555 00000005
POEA 00000001
2222 00000002
5555 00000003
7777 00000004
POEA 00000001
6355 00000002
4445 00000003
Hope I am clear.
Thanks!
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Yes, that's what I guessed and my solution gives that output.
Did you bother to try my solution?
Back to top
fredrick andrews New User Joined: 10 Jun 2010Posts: 52 Location: chennai
Frank Yaeger wrote:
Yes, that's what I guessed and my solution gives that output.
Did you bother to try my solution?
Yes! It worker perfectly as expected.
Thanks again.
Back to top
Please enable JavaScript!