View previous topic :: View next topic
|
Author |
Message |
madishpa
New User
Joined: 18 May 2007 Posts: 28 Location: Hyderabad
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2154 Location: USA
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2154 Location: USA
|
|
|
|
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 |
|
|
|