Generate sequence number based on quantity field



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Generate sequence number based on quantity field

Postby tivrfoa » Fri Jan 09, 2015 10:09 pm

Hello,

Input: id(1), name(10), quantity(2)

1chair     03
2pc        01
3tv        02


output: id(1), name(10), sequence(2)

1chair     01
1chair     02
1chair     03
2pc        01
3tv        01
3tv        02


It replicates the record based on the quantity field and generates a sequence number.
Could you please tell me how to do this using sort?

Thank you.
tivrfoa
 
Posts: 83
Joined: Wed Aug 22, 2012 6:35 pm
Has thanked: 58 times
Been thanked: 0 time

Re: Generate sequence number based on quantity field

 

Re: Generate sequence number based on quantity field

Postby Thampy » Fri Jan 09, 2015 10:57 pm

Please try the below JCL. The JCL uses two sort steps.

//STEP010  EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
1CHAIR     03                                                           
2PC        01                                                           
3TV        02                                                           
//SORTOUT   DD  DSN=&&T1,DISP=(NEW,PASS),SPACE=(TRK,(50,50),RLSE)       
//SYSIN  DD *                                                           
 OPTION COPY                                                           
 OUTFIL REPEAT=99,OVERLAY=(81:12,2,12:SEQNUM,2,ZD,RESTART=(1,11))       
//STEP020  EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&T1,DISP=(OLD,DELETE)                               
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN  DD *                                                           
 OPTION COPY                                                           
 INCLUDE COND=(12,2,ZD,LE,81,2,ZD)   
 OUTREC BUILD=(1,80)                 

These users thanked the author Thampy for the post:
tivrfoa (Fri Jan 09, 2015 11:09 pm)
Thampy
 
Posts: 35
Joined: Sat Sep 26, 2009 2:27 pm
Has thanked: 0 time
Been thanked: 3 times

Re: Generate sequence number based on quantity field

Postby tivrfoa » Fri Jan 09, 2015 11:12 pm

Thanks a lot Thampy. I thought it was not possible to do this using sort, but asked to make sure.
Amazing =D
tivrfoa
 
Posts: 83
Joined: Wed Aug 22, 2012 6:35 pm
Has thanked: 58 times
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post