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

Sequence number generation for multiple rec based on range


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

New User


Joined: 18 May 2007
Posts: 28
Location: Hyderabad

PostPosted: Fri Dec 24, 2021 3:55 pm
Reply with quote

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
Back to top
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1414

PostPosted: Fri Dec 24, 2021 4:57 pm
Reply with quote

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"
 . . . . . .
Back to top
View user's profile Send private message
sergeyken
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1414

PostPosted: Fri Dec 24, 2021 8:53 pm
Reply with quote

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"
 . . . . . .
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 Copy next subsquent records based on ... DFSORT/ICETOOL 5
No new posts How can I get Generation Nbr of GDG f... IBM Tools 0
No new posts Split Records based on length COBOL Programming 3
No new posts Find missing sequence for every key DFSORT/ICETOOL 3
No new posts Splitting a file into multiple files ... DFSORT/ICETOOL 7
Search our Forums:

Back to Top