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

Help Required in DFSORT while setting the SEQNUM


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 134
Location: India

PostPosted: Tue Nov 09, 2010 2:44 pm
Reply with quote

Hi,

I am using the following JCL:

Code:

//S1 EXEC PGM=SORT           
//SYSOUT DD SYSOUT=*         
//SORTIN DD *                 
111
111
111
111
222
222
333
444
444
555
666
666
666
/*
//SORTOUT DD SYSOUT=*                                           
//SYSIN DD *                                                   
  SORT FIELDS=(1,30,CH,A),EQUALS                               
  INREC IFOUTLEN=74,                                           
   IFTHEN=(WHEN=INIT,                                           
    OVERLAY=(71:SEQNUM,7,ZD,RESTART=(1,4))),                   
   IFTHEN=(WHEN=GROUP,BEGIN=(71,7,ZD,EQ,1),END=(71,7,ZD,EQ,4), 
    PUSH=(71:ID=7)),                                           
   IFTHEN=(WHEN=INIT,BUILD=(1,70,71:71,7,ZD,TO=ZD,LENGTH=4))   
/*                                                             


Here it is giving the o/p like:

Code:

 COMMAND INPUT ===>                                            SCROLL ===> CSR 
********************************* TOP OF DATA **********************************
111                                                                   0001     
111                                                                   0001     
111                                                                   0001     
111                                                                   0001     
222                                                                   0002     
222                                                                   0002     
333                                                                   0003     
444                                                                   0004     
444                                                                   0004     
555                                                                   0005     
666                                                                   0006     
666                                                                   0006     
666                                                                   0006     
******************************** BOTTOM OF DATA ********************************


But I need the o/p in the following way:
Code:

 COMMAND INPUT ===>                                            SCROLL ===> CSR 
********************************* TOP OF DATA **********************************
111                                                                   0001     
111                                                                   0001     
111                                                                   0001     
111                                                                   0001     
222                                                                   0002     
222                                                                   0002     
333                                                                   0003     
444                                                                   0004     
444                                                                   0004     
555                                                                   0001     
666                                                                   0001     
666                                                                   0002     
666                                                                   0002     
******************************** BOTTOM OF DATA ********************************


In other words, I want the SEQNUM to restart from 0001 once the seqnum reaches to 0004. Can anybody please help me out and suggest how to acheive this? I will be very thankful

Thanks
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Nov 09, 2010 11:02 pm
Reply with quote

Gagangarg,

Use the following DFSORT control cards. I am not sure as to why you are sorting. If your aim to assign the seqnum after sorting then you need to use OUTREC instead of INREC.

Code:

//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFOUTLEN=74,                                         
  IFTHEN=(WHEN=INIT,OVERLAY=(75:SEQNUM,4,ZD,RESTART=(1,4))),
  IFTHEN=(WHEN=GROUP,BEGIN=(75,4,ZD,EQ,1),PUSH=(71:ID=4)),   
  IFTHEN=(WHEN=(71,4,ZD,GT,4),                               
  OVERLAY=(71:71,4,ZD,MOD,+4,EDIT=(TTTT)),HIT=NEXT),         
  IFTHEN=(WHEN=(71,4,ZD,EQ,0),OVERLAY=(71:C'0004'))         
//*
Back to top
View user's profile Send private message
GaganGarg

Active User


Joined: 31 Mar 2010
Posts: 134
Location: India

PostPosted: Wed Nov 10, 2010 8:43 am
Reply with quote

Thanks Skolusu. It worked like a charm. Thanks for the timely help. 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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts DFSORT GUID DFSORT/ICETOOL 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top