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

Need to have a seqnum restarted for every identical record.


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

New User


Joined: 30 Dec 2011
Posts: 3
Location: AUstralia

PostPosted: Tue Feb 14, 2012 10:30 am
Reply with quote

Hi,
I was trying to add a sequence number to a file which has a Lrecl = 950.
I tried to use the restart parameter and later learnt that it has a limitation of Lrecl of 256.
Sample input record -

1-2-3-4-5 .... 948-949-950
AAAAAA .... A
AAAAAA .... A
BBBBBB .... B


1-2-3-4-5 .... 948-949-950
AAAAAA .... A 01
AAAAAA .... A 02
BBBBBB .... B 01

I was using a control card as below -

SORT FIELDS=(1,948,CH,A)
OUTFIL FNAMES=O1,OVERLAY=(949:SEQNUM,2,ZD,RESTART=(1,948))


Thanks...
Sam.

Can you please suggest me a alternate way ?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Feb 14, 2012 9:22 pm
Reply with quote

Sammmy,
See if below helps...

May be there is a better way, but the logic below is to use RESTART for the block of 256 bytes and assign sequence numbers. Later use these sequence numbers to make decision.
Code:
//STEP0001 EXEC PGM=SORT                                               
//SORTIN   DD   DISP=SHR,DSN=INPUT.FB950                               
//SORTOUT  DD   DSN=OUTPUT.FB950,                                       
//              DISP=(,CATLG,DELETE),                                   
//              UNIT=SYSDA                                             
//SYSIN DD *                                                           
 SORT FIELDS=(1,948,CH,A),EQUALS                                       
 OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(951:SEQNUM,8,ZD,RESTART=(001,256),   
                                   959:SEQNUM,8,ZD,RESTART=(257,256),   
                                   967:SEQNUM,8,ZD,RESTART=(513,256),   
                                   975:SEQNUM,8,ZD,RESTART=(769,180),   
                                   983:C'N')),                         
        IFTHEN=(WHEN=(951,8,ZD,EQ,1,OR,                                 
                      959,8,ZD,EQ,1,OR,                                 
                      967,8,ZD,EQ,1,OR,                                 
                      975,8,ZD,EQ,1),OVERLAY=(983:C'Y'))               
 OUTFIL IFTHEN=(WHEN=GROUP,BEGIN=(983,1,CH,EQ,C'Y'),PUSH=(949:SEQ=2)), 
        IFTHEN=(WHEN=INIT,BUILD=(1,950))                               
/*                                                                     
//SYSOUT DD SYSOUT=*                                                   
//*                                                                     

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: Wed Feb 15, 2012 12:42 am
Reply with quote

sqlcode1's solution is quite clever and only takes one pass. For simplicity, I would have used this OUTFIL statement:

Code:

 OUTFIL IFOUTLEN=950,
   IFTHEN=(WHEN=GROUP,BEGIN=(983,1,CH,EQ,C'Y'),PUSH=(949:SEQ=2))


FWIW, here's another DFSORT/ICETOOL solution. However, this one requires two passes:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/950)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/950)
//TOOLIN DD *
  SORT FROM(IN) USING(CTL1)
  COPY FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
   SORT FIELDS=(1,948,CH,A),EQUALS
   OUTFIL FNAMES=T1,REMOVECC,
     SECTIONS=(1,256,257,256,513,256,769,180,
       HEADER3=(1:'***'))
/*
//CTL2CNTL DD *
   INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'***'),
     PUSH=(949:SEQ=2))
   OUTFIL OMIT=(1,3,CH,EQ,C'***'),
    OVERLAY=(949:949,2,ZD,SUB,+1,TO=ZD,LENGTH=2)
/*
Back to top
View user's profile Send private message
Sammmy

New User


Joined: 30 Dec 2011
Posts: 3
Location: AUstralia

PostPosted: Wed Feb 15, 2012 7:00 am
Reply with quote

Thanks sqlcode1 and Frank... you Rock icon_smile.gif .. I will test them and update ...
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top