|
View previous topic :: View next topic
|
| Author |
Message |
Donnov
New User
Joined: 16 Sep 2015 Posts: 1 Location: Brazil
|
|
|
|
Hi, idk if its possible:
I have a file with a numeric range and want to expand it.
Preferable using SORT only (if its possible)
Something like:
Input -----------------
00000000 00000003
00011001 00011050
Expected Output ----
00000000
00000001
00000002
00000003
00011001
00011002
...
00011050
Any ideas ?
Thnx in Advance |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You could, in one step, generate all the possible numbers.
In a second step, use RESIZE to split your records with a first/last marker.
In a third step, use JOINKEYS to match the files, with UNPAIRED,F1 (the generated numbers file).
In the main task, use WHEN=GROUP to define a group which starts at the first and ends at the last, PUSHing the marker to each record.
Use OUTFIL INCLUDE= to extract those that have been marked.
Whether it would be worth doing that rather than doing something simple in another language is up to you.
This also assumes that ranges don't cross. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
I don't know much sort tricks but I have something similar saved in my local PDS, see if this helps and I am sure Bill or others or yourself can help and suggest to what you want.
This will generate the numbers based on value in 12th position.
| Code: |
//STEP010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
000001 99
//SORTOUT DD DSN=&&T1,DISP=(NEW,PASS),UNIT=SYSDA
//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=(12,2) |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
To get the range:
| Code: |
INCLUDE COND=(12,2,ZD,LE,81,2,ZD,
AND,12,2,ZD,GE,5,2,ZD) |
My concern is that TS/OP shows eight-digt numbers, potentially just shy of 100m generated per pair (if the full value of the eight digits is needed). It would however readily work for overlapping ranges.
A single repeat to get sequence numbers, and generate the INCLUDE COND= (need a sequence to identify formatting for the first, subsequent and a "dummy" condition in TRAILER1 to finish with.
However, won't allow for overlapping ranges.
So, are overlapping ranges possible? Maximum value possible is? |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
ftp.software.ibm.com/storage/dfsort/mvs/sortpaug.pdf
| Code: |
REPEAT=n specifies the number of times each OUTFIL output record is to be repeated. The value for n starts at
2 (write record twice) and is limited to 28 digits (15 significant digits). |
I tried for 1-99999999 range and it worked. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
| Bill, You are right, it does overlap after certain significant digit. I have tried up to 3 repeat it works and then it overlaps. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|