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

SEQuence No. Inside a Group!


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
fredrick andrews

New User


Joined: 10 Jun 2010
Posts: 52
Location: chennai

PostPosted: Mon Feb 21, 2011 11:53 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 22, 2011 12:09 am
Reply with quote

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
View user's profile Send private message
fredrick andrews

New User


Joined: 10 Jun 2010
Posts: 52
Location: chennai

PostPosted: Tue Feb 22, 2011 12:24 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 22, 2011 12:34 am
Reply with quote

Yes, that's what I guessed and my solution gives that output.

Did you bother to try my solution?
Back to top
View user's profile Send private message
fredrick andrews

New User


Joined: 10 Jun 2010
Posts: 52
Location: chennai

PostPosted: Tue Feb 22, 2011 12:37 am
Reply with quote

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. icon_biggrin.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Cobol program with sequence number ra... COBOL Programming 5
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts calling a JCl inside a JCL JCL & VSAM 3
No new posts SRCHFOR ‘string’ command inside P... TSO/ISPF 14
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
Search our Forums:

Back to Top