In the BUILD operand of the INREC statement, you can use the SEQNUM field 
specification to create sequence numbers (e.g., in columns 15-20) and the MOD 
operator of the arexp field specification to create a grouping value (e.g., in 
columns 22-23) that loops between 0 and 3.  (If you really want 1 to 4, you can 
add an ADD operator.)  You would sort on the grouping value and discard the 
constructed fields in the OUTREC statement to get the output you describe.

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On Behalf Of 
Tim Hare
Sent: Monday, May 24, 2010 12:19 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: DFSORT question

Example input, RECFM=FB,LRECL=14:

DSK001 1009999
DSK002 3962002
DSK003 0001001
DSK005 2009999
DSK006 2009999
DSK008 0100000
DSK007 0001002
DSK004 0527192

Two fields: VOLSER in 1-6 and SIZE in 8-14.

I want to assign a 'sequence' number to the input from 1 to 4, so that I can
sort these into 4 groups, and within those groups descending order by size:

So for this group the input would be modified to have the sequence in 16 (for
example) resulting in a temporary work dataset of LRECL=16:

DSK001 1009999 1
DSK002 3962002 2
DSK003 0001001 3
DSK005 2009999 4
DSK006 2009999 1
DSK008 0100000 2
DSK007 0001002 3
DSK004 0527192 4

And the final output would be RECFM=FB,LRECL=14
DSK006 2009999
DSK001 1009999
DSK002 3962002
DSK008 0100000
DSK007 0001002
DSK003 0001001
DSK005 2009999
DSK004 0527192

The idea is to "balance" disk backup jobs by spreading the large volumes
across the (4) jobs evenly.  Doing the sort this way isn't "perfect" but it's 
closer to what is needed.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to