Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need to have a seqnum restarted for every identical record.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Need to have a seqnum restarted for every identical record.
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: 578
Location: USA

PostPosted: Tue Feb 14, 2012 9:22 pm    Post subject:
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 Moderator


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

PostPosted: Wed Feb 15, 2012 12:42 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us