Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Expand a numeric range

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Donnov

New User


Joined: 16 Sep 2015
Posts: 1
Location: Brazil

PostPosted: Fri Sep 18, 2015 6:27 pm    Post subject: Expand a numeric range
Reply with quote

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
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Sep 18, 2015 7:46 pm    Post subject: Reply to: Expand a numeric range
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Fri Sep 18, 2015 9:01 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Sep 18, 2015 10:50 pm    Post subject: Reply to: Expand a numeric range
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Sat Sep 19, 2015 1:42 am    Post subject:
Reply with quote

ftp://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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Sat Sep 19, 2015 3:42 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts To determine the range on a Alphanume... Prasanth Kumar COBOL Programming 3 Mon Feb 15, 2016 9:35 am
No new posts pass numeric value of length 14 to ti... Ralph Zbrog Java & MQSeries 4 Fri Jan 15, 2016 3:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us