Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Feb 09, 2004 11:45 am Post subject:
Subra,
Do you want to round only when 3rd digit in the decimal portion exceeds 5 ? or do you want to round to the next number what ever might be the value in the 3 digit.?
i.e
Code:
2475.7563 rounded to 2475.76
2475.7533 rounded to 2475.75 ?? or
2475.7533 rounded to 2475.76
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Feb 09, 2004 12:12 pm Post subject:
Subra,
Please show your DFSORT/ICETOOL job, and an example of your input records and what the output should look like. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
2. Your Toolin statement points to sort from DETAIL, but there is no DD name corresponding to it. You either need to change the toolin statement to the following
Code:
SORT FROM(FILEIN) TO(DTLTTL) USING(MRGE)
or change the
Code:
//FILEIN DD DSN=&&VARDATA,DISP=(OLD,PASS)
to
Code:
//DETAIL DD DSN=&&VARDATA,DISP=(OLD,PASS)
3. You don't require hardcoded LRECL on the Output file definition.Sort automatically calculates the output lrecl.
4. You don't require FNAMES=DTLTTL as your TOOLIN statement already specified the output dataset name.
5. I don't think FILSZ=E3000000 parameter will make any difference to a file on DASD. Frank can you correct me if this is true.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Feb 09, 2004 3:18 pm Post subject:
Kolusu,
4. Actually, Subra does need FNAMES=DTLTTL, but doesn't need TO(DTLTTL).
5. You're right that FILSZ=En is not needed.
Actually, SUM isn't needed.
I'm working on the DFSORT/ICETOOL job. I'll post it when I'm done testing it (unless Kolusu beats me to it). _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Feb 09, 2004 3:59 pm Post subject:
Subra,
I think this DFSORT/ICETOOL job will do what you want. It's a bit tricky since you want the totals, which can be positive or negative, rounded up. Arithmetic expressions can be used in INREC and OUTREC, but not in TRAILERx, so we can't do the rounding directly when getting the totals. Also, we have to use +5 to round up positive totals and -5 to round up negative totals.
There's no reason to use SUM since TOT does the totalling. I kept your SORT statement because it will put the last key in the final total record. If you don't care which key is in the final total record, you can do this with COPY instead of SORT. Anyway, try this and see if it does what you want.
Code:
//SORTTTL EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEIN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//DTLTTL DD DSN=... output file
//TOOLIN DD *
SORT FROM(FILEIN) USING(MRGE)
COPY FROM(T1) USING(CTL1)
/*
//MRGECNTL DD *
* Sort so record with last key is displayed in total record.
SORT FIELDS=(1,6,CH,A)
* Create totals in the form sddddddddddddddd
* where s is + or - and each d is 0-9
OUTFIL FNAMES=T1,NODETAIL,REMOVECC,
TRAILER1=(1,6,11:TOT=(50,8,PD,M26),31:TOT=(58,8,PD,M26))
//CTL1CNTL DD *
* Drop the last digit from the total to give totals in the
* form sdddddddddddddd. Create a +5 constant for a positive
* total or a -5 constant for a negative total.
INREC FIELDS=(1,6,11:11,15,31:31,15,
51:11,1,C'5',61:31,1,C'5')
* Round each total up by adding +5 or -5 as appropriate.
OUTREC FIELDS=(1,6,11:11,15,FS,ADD,51,2,FS,M26,
31:31,15,FS,ADD,61,2,FS,M26)
* Create final total record using sign and 14 digits where
* 14th digit has been rounded up if appropriate.
OUTFIL FNAMES=DTLTTL,NODETAIL,
OUTREC=(1,46,132:X),
TRAILER1=(1:C'TOTAL$',5X,1,6,
70:TOTAL=(11,15,FS,EDIT=(SIIIIIIIIIIII.II),SIGNS=(,-,,)),
88:TOTAL=(31,15,FS,EDIT=(SIIIIIIIIIIII.II),SIGNS=(,-,,)))
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Feb 09, 2004 4:20 pm Post subject:
Frank,
A quick question for beating me to post the solution . can you explain as to what you meant by
Quote:
Also, we have to use +5 to round up positive totals and -5 to round up negative totals.
I mean I don't understand what is so different between a positive and a negative total.
Let us say the totals are as follows(with edit mask)
Code:
ABC -24765.7766 34567.7733
Now if I undestand the requirements correctly , the rounding should be done as follows.
Code:
ABC -24765.78 34567.77
The same holds good for positive numbers.
The solution I had in mind was to use sum and add a constant(outrec fields) value of S000000000000.0100 to the totals if the 3 decimal digit is However both solutions requires 2 passes.
Thanks kolusu For the inputs. Actually I tailored the JCL and pasted . So the Error #2 and 4 happened. Error#1 ,3, and 5 are implemented in my JCL. I am really impressed on the Feb 2003, DFSORT Release with SPLICE operator. So I am designing a big process thru ICETOOL.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Feb 09, 2004 4:48 pm Post subject:
Kolusu,
Say we want to round 776 to 78 and -776 to -78.
If we add +5 to 776, we get 781. We can throw away the last digit and get the 78 we want.
If we add -5 to -776, we get -781. We can throw away the last digit and get the -78 we want.
But if we add +5 to -776, we get -771 and if we throw away the last digit, we get -77, which is not what we want.
I don't understand how adding .0100 would work. If you add .0100 to 34567.7733 and throw away the last two digits, you get 34567.78, but you want 34567.77. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Feb 09, 2004 6:49 pm Post subject:
Subra,
You're welcome. I'm glad you like SPLICE. It's been a big hit all around. 8) _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum