# Sequence number generation for multiple rec based on range

Author Message

New User

Joined: 18 May 2007
Posts: 28

 Posted: Fri Dec 24, 2021 3:55 pm Please i have below requirement to generate a sequence number, which has range of start and end numbers. Please can you help on giving a JCL using any sort technique to achieve it. Input: UniqueNumber1 123 125 UniqueNumber4 001 003 UniqueNumber2 006 006 Output: UniqueNumber1 123 UniqueNumber1 124 UniqueNumber1 125 UniqueNumber4 001 UniqueNumber4 002 UniqueNumber4 003 UniqueNumber2 006
sergeyken

Senior Member

Joined: 29 Apr 2008
Posts: 1652

Posted: Fri Dec 24, 2021 4:57 pm

Reminder #123456: Use CODE tags when presenting any code, or any data in your posts

Use REXX, not DFSORT (and not JCL!!!)
 Code: . . . . . . "EXECIO 0 DISKR SORTIN (OPEN" "EXECIO 0 DISKW SORTOUT (OPEN" "NEWSTACK" Do I = 1 By 1    "EXECIO 1 DISKR SORTIN"    If RC != 0 Then Leave I    Parse Pull UniqNum Start Stop .    Do J = Start To Stop       Queue UniqNum Right( J, 3, '0' )    End J    "EXECIO" Queued() "DISKW SORTOUT" End I "DELSTACK" "EXECIO 0 DISKR SORTIN (FINIS" "EXECIO 0 DISKW SORTOUT (FINIS"  . . . . . .
sergeyken

Senior Member

Joined: 29 Apr 2008
Posts: 1652

Posted: Fri Dec 24, 2021 8:53 pm

Another version, for relatively small number of records.
 Code: . . . . . . "NEWSTACK" "EXECIO * DISKR SORTIN (FINIS" InputSize = Queued() Do I = 1 To InputSize    Parse Pull UniqNum Start Stop .    Do J = Start To Stop       Queue UniqNum Right( J, 3, '0' )    End J End I "EXECIO" Queued() "DISKW SORTOUT (FINIS" "DELSTACK"  . . . . . .
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics Extract record using 2 input file int... JCL & VSAM 2 Construct new record using specific f... DFSORT/ICETOOL 6 Finding faulty logic Subscript out of... COBOL Programming 5 COBOL Ascending and descending sort n... COBOL Programming 5 Count the number of characters in a f... CA Products 1
Search our Forums:

 IBMMainframes.com is not an official and/or affiliated with IBM® in anyway Board Rules | FAQ | Downloads | Wiki | SiteMap | Contact Us