|
View previous topic :: View next topic
|
| Author |
Message |
surendra_giddaluru
New User
Joined: 17 May 2007 Posts: 8 Location: chennai
|
|
|
|
Hi,
I am facing some difficulty while doing division operation using DFSORT. I have to calculate the percentage rate. My input looks like as below, and it is an FB file (80 LRECL)
| Code: |
----+----1----+----2----+----3----+--
AAAAAAAA 000000029 000000456
BBBBBBBB 000000010 000000050
CCCCCCCC 000123452 000123452
DDDDDDDD 000006782 000007986
EEEEEEEE 000000000 000000010
FFFFFFFF 000069032 000071236
GGGGGGGG 000000032 000005405 |
My output should be of the form:
| Code: |
| Match Rate 6.35964 | AAAAAAAA
| Match Rate 20.00000 | BBBBBBBB
| Match Rate 100.00000 | CCCCCCCC
| Match Rate 84.92361 | DDDDDDDD
| Match Rate 0.00000 | EEEEEEEE
| Match Rate 96.90605 | FFFFFFFF
| Match Rate 0.59204 | GGGGGGGG |
I have used the following SORT to generate the output. It is working fine with all records except for ‘EEEEEEEE’ record, because of all zeroes in the 11 position to 19 position. And I am getting an OUTREC ARITHMETIC OVERFLOW error message. So Please provide me a solution to overcome this problem.
| Code: |
//STEP001 EXEC PGM=SYNCTOOL,REGION=2048K
//SORTWK01 DD UNIT=SYSDA,SPACE=(TRK,2)
//SORTWK02 DD UNIT=SYSDA,SPACE=(TRK,2)
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//IN1 DD DISP=SHR,DSN=INPUT FILE
//*
//OUTDD DD DSN=OUTPUT FILE,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(20,20),RLSE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=80)
//TOOLIN DD *
COPY FROM(IN1) TO(OUTDD) USING(CTL1)
//CTL1CNTL DD *
OUTREC FIELDS=(C' | Match Rate ',
((11,9,ZD,MUL,+10000000),DIV,25,9,ZD),EDIT=(IIIIT.TTTTT),
C' |',30X,1,8)
/* |
Thanks,
Surendra. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Actually, when I ran this job with DFSORT's ICETOOL, it did not get any error message and produced this output:
| Code: |
| MATCH RATE 6.35964 | AAAAAAAA
| MATCH RATE 20.00000 | BBBBBBBB
| MATCH RATE 100.00000 | CCCCCCCC
| MATCH RATE 84.92361 | DDDDDDDD
| MATCH RATE 0.00000 | EEEEEEEE
| MATCH RATE 96.90605 | FFFFFFFF
| MATCH RATE 0.59204 | GGGGGGGG
|
Since you have PGM=SYNCTOOL, it appears you're actually using Syncsort's SYNCTOOL rather than DFSORT's ICETOOL. Syncsort is getting the error message, not DFSORT.
I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
I'm moving this thread to the JCL Forum. |
|
| Back to top |
|
 |
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
surendra_giddaluru,
I tried with your code and input posted by you with SYNCSORT. It shows the output as FRANK's posted.
| Quote: |
| And I am getting an OUTREC ARITHMETIC OVERFLOW error message. |
I got the "OUTREC ARITHMETIC OVERFLOW error message" when i tried to divide a number by zero.
Please check with your input whether you have zeros in 25,9.
Use SYNCSORT instead of SYNCTOOL and reformat the fields in INREC for your requirement. It will be more efficient when doing a run with large number of records.
| Code: |
// EXEC PGM=SYNCSORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAA 000000029 000000456
BBBBBBBB 000000010 000000050
CCCCCCCC 000123452 000123452
DDDDDDDD 000006782 000007986
EEEEEEEE 000000000 000000010
FFFFFFFF 000069032 000071236
GGGGGGGG 000000032 000005405
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FIELDS=(C' | MATCH RATE ',
((11,9,ZD,MUL,+10000000),DIV,25,9,ZD),EDIT=(IIIIT.TTTTT),
C' |',30X,1,8)
/*
// |
Output:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
******************************** Top of Data ***********************************
| MATCH RATE 6.35964 | AAAAAAAA
| MATCH RATE 20.00000 | BBBBBBBB
| MATCH RATE 100.00000 | CCCCCCCC
| MATCH RATE 84.92361 | DDDDDDDD
| MATCH RATE 0.00000 | EEEEEEEE
| MATCH RATE 96.90605 | FFFFFFFF
| MATCH RATE 0.59204 | GGGGGGGG
******************************* Bottom of Data ******************************** |
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
It is also possible that your version of Syncsort is either not up to date or missing some fix(es). I'd suggest opening an issue with Syncsort support to determine why your process did not work correctly.
As suggested, make sure that the input is what it should be. |
|
| Back to top |
|
 |
surendra_giddaluru
New User
Joined: 17 May 2007 Posts: 8 Location: chennai
|
|
|
|
Hi Frank and Sankar thanks a lot for your suggestions. I tried with SYNCTOOL and SYSNSORT both are working fine, thanks. I have one more issue. My input file will sometimes have all zeroes in both (11,9) and (25,9) positions. I tried using SYNCTOOL and SYNCSORT both the times it got abended with 'ARITHMETIC OVERFLOW' error message. The input I used is as below. Please provide me with some solution.
----+----1----+----2----+----3----+--
AAAAAAAA 000000029 000000456
BBBBBBBB 000000010 000000050
CCCCCCCC 000123452 000123452
DDDDDDDD 000006782 000007986
EEEEEEEE 000000000 000000000
FFFFFFFF 000069032 000071236
GGGGGGGG 000000032 000005405 |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You need to ensure that there will not be a divide by zero.
What should happen when both numbers are zero? |
|
| Back to top |
|
 |
surendra_giddaluru
New User
Joined: 17 May 2007 Posts: 8 Location: chennai
|
|
|
|
Hi,
I am rewriting a COBOL program which is currently running for a long time. So now I am doing file processing in the COBOL program and for generating the report, which needs to sum the individual accounts and also needs to calculate the percentage match rate for each account, I am using the SORT. So in my old COBOL program when ever the values in (11,9) and (25,9) positions are zeroes we are moving 0.0000 to the Match Rate without doing any division operation for that perticular account.
Now I think we need to verify these values before calculating the match Rate. Atleast the values in (25,9) position, so that the SORT will not fail. If the values in (25,9) position is zeroes I need to move 0.0000 explicitly without doing the division operation for calculating the Match Rate. Hope I am clear this time. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Helllo,
| Quote: |
| I am rewriting a COBOL program which is currently running for a long time. |
How many records are being processed? How long is a "long time"?
What does this COBOL code do that the sort does not do or does differently?
If the code is to read the file and create summary statistics, i believe they should run a similar length of time. The COBOL code may use a bit more cpu, but wall-time should be quite similar as most of the time should be spent doing i/o.
I don't know how to tell Syncsort to conditionally bypass the calculation. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| Quote: |
| I don't know how to tell Syncsort to conditionally bypass the calculation. |
Try this code:
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=((11,9,ZD,NE,0),AND,(25,9,ZD,NE,0)),
BUILD=(C' | MATCH RATE ',
((11,9,ZD,MUL,+10000000),DIV,25,9,ZD),
EDIT=(IIIIT.TTTTT),C' |',30X,1,8)),
IFTHEN=(WHEN=((11,9,ZD,EQ,0),AND,(25,9,ZD,EQ,0)),
BUILD=(C' | MATCH RATE 0.00000 |',
30X,1,8))
/*
|
|
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| ... Forgot to mention that the above code requires SyncSort for z/OS 1.2.1 or later. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Alissa,
Which Syncsort publication has the writeup for IFTHEN?
My downloaded doc does not have IFTHEN.
Thanx,
d |
|
| Back to top |
|
 |
surendra_giddaluru
New User
Joined: 17 May 2007 Posts: 8 Location: chennai
|
|
|
|
Thank you so much Alissa Margulies, its working fine.
Thanks,
Surendra. |
|
| Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
| dick scherrer wrote: |
| Which Syncsort publication has the writeup for IFTHEN? My downloaded doc does not have IFTHEN. |
Hi Dick,
The SyncSort for z/OS 1.2 Addendum contains the BUILD, IFTHEN, IFOUTLEN, and OVERLAY Parameters.
If you have a SyncSort Online Customer Support Account, you can download the file named "SyncSort 1.2 Programmers Guide Add.pdf"
Regards, |
|
| Back to top |
|
 |
mmt_bit
New User
.jpg)
Joined: 15 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
There is a field 9(13) comp-3 (7 bytes long).
I need to convert this to a S9(11)v9(2) or DB2 DECIMAL(13,2). (also 7 bytes long)
INPUT: 12868 (X'0000000012868F')
Control statement logic:
1,7,PD,DIV,+100,LENGTH=7
Output: 1.28
Desired output: 128.68
Why its getting divided by 10000, when I am dividing by 100? What is the correct control statement? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Don't tag a new question onto the end of an old topic.
A packed-decimal field on a file has no decimal places, implicit or explicit. You don't have to convert your data. When you define your field in your code, define with the decimal places and everything will be fine (from your example).
With your parameters you are making it 100 times too small, because you are dividing by 100. Leave it alone.
Why is your field unsigned (F in the sign nibble, not C for positive (or D for negative))? If this is correct, make sure you define your data as unsigned as well as having the two decimal places. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|