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

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

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

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top