IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Overflow error message during Division in SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Tue Apr 17, 2012 3:04 pm
Reply with quote

Hello,

I am facing an error message of WER215A OUTREC ARITHMETIC OVERFLOW

when I am performing division operation on 2 SFF fields. My first input, file 1, RECFM=FB, LRECL=589, Key is 1 to 7 CHAR, is

Code:

1001695001 2 20120316  +00000000007447940.7


and my second input, file 2, RECFM=FB, LRECL=589,Key is 1 to 7 CHAR, is

Code:

1001695001 2 20120323  +00000000000008565.8


My output file should be the value calculated as below,

(8565.8 / 7447940.7) * 100 = +0.12% and should look like,

Code:

1001695001 2 20120323  +0.12%


My current sort card is mentioned below,

Code:

  JOINKEYS FILES=F1,FIELDS=(1,7,CH,A)                             
  JOINKEYS FILES=F2,FIELDS=(1,7,CH,A)                             
  REFORMAT FIELDS=(F1:1,589,F2:1,589)                             
  SORT FIELDS=COPY                                               
  OUTREC FIELDS=(1:1,22,23:(613,20,SFF,DIV,24,20,SFF),MUL,+100,   
               EDIT=(ST.TT),SIGNS=(+,-))


I have used the parm of OVRFLO=RC4 to bypass the overflow error, but that has not helped.

Also, I have read in one of the tutorials that 'If an intermediate or final result of an arithmetic expression overflows 15 digits, the overflowing intermediate or final result will be truncated to 15 digits'. If this is the case, then why does the overflow error occur?

Is there any other way through which I can divide the SFF values by preventing the overflow? Or do I need to convert them to ZD before dividing?

Thanks for your help.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 17, 2012 3:06 pm
Reply with quote

Not DFSORT, is it, with WER messages.

EDIT: Make sure you look at the correct documentation. You have Syncsort, you'll have to consult whatever they provide.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 17, 2012 9:09 pm
Reply with quote

Hello,

If your organization is licensed to use Syncsort, all of the material is available free from Syncsort Support.
Back to top
View user's profile Send private message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Wed Apr 18, 2012 1:48 pm
Reply with quote

Bill and Dick,

I have tried the same job in one of my friend's organization which has DFSORT installed. According to him even he is facing the same overflow error at his site.

Meanwhile, I have dropped a mail to 'zos_tech@syncsort.com' requesting for SYNCSORT manuals. I have provided them with the license number and my organization details as well.

Hope to receive the manuals soon.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 18, 2012 8:20 pm
Reply with quote

Hello,

Does the overflow occur on the first record processed or have some records processed before the problem occurs? A divide by zero would always generate an overflow, would it not?

Also, when i divide/multiply the numbers you posted using the calculator on my pc, i get 0.1150089715402809 . . .
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Apr 18, 2012 8:42 pm
Reply with quote

If you have such huge numbers, I'd do the calculation in a programming language you are familiar with so that you can get the correct results within the parameters of the calculation.

I don't know what Synsort does, but, like Dick, I did the calculation on a PC and it came up with loads more than 15 digits, not necessarily relevant as you don't have the documentation for your product yet.

Also check on the rounding done by Syncsort, when you can.

If you think it might be to do with the SFF, which don't you try converting and see if anything changes?

Obviously verify (by "printing" them to sysout from the Sort) the values in the positions/lengths you are using.

When having the (* 100) I was always told to do it first. With big numbers you can loose significance at the right of the result.
Back to top
View user's profile Send private message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Thu Apr 19, 2012 1:21 pm
Reply with quote

Hi Dick and Bill,

The above problem has been solved, as mentioned by Dick, there was indeed value 0 in the second file, which during division was causing the Overflow error.

One more doubt for the same problem, in my input files I have such values in 26 columns, for which I need to perform the division in the same way as mentioned above. Now in order to by-pass the conidtion of having 0 in the columns of the second file, I am making use of IFTHEN and WHEN parameters. The problem here is, I am using around 26 IFTHEN and WHEN parameters, out of which only 2 are getting executed. For example,

File 1 looks like, values start from 24 and 45

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+
********************************* Top of Data *******************
1001695001 2 20120323  +00000000000008565.8 +00000000000012372.8
1001950001 2 20120323  +00000000000000000.0 +00000000000000000.0
1001978002 2 20120323  +00000000000000000.0 +00000000000000000.0
1002317001 2 20120323  +00000000000000000.0 +00000000000000113.8


File 2 looks like,values start from 613 and 634

Code:

9----+----0----+----1----+----2----+----3----+----4----+----5----
********************************* Top of Data *******************
1001695001 2 20120316  +00000000007447940.7 +00000000008149379.6
1001950001 2 20120316  +00000000000012992.0 +00000000000005504.0
1001978002 2 20120316  +00000000000000000.0 +00000000000000480.0
1002317001 2 20120316  +00000000000043013.9 +00000000000061846.3


Please note here that I have joined these 2 files using join keys and the record length of each file is 589, format FB.

Now, with the below sort card,

Code:

SORT FIELDS=COPY                                                     
OUTREC IFTHEN=(WHEN=(613,20,SFF,NE,0),                               
       BUILD=(1:1,22,24:((24,20,SFF,MUL,+100000),DIV,613,20,SFF),   
       EDIT=(SIIT.TTT),SIGNS=(+,-),C'%')),                           
       IFTHEN=(WHEN=(634,20,SFF,NE,0),                               
       BUILD=(45:((45,20,SFF,MUL,+100000),DIV,634,20,SFF),           
       EDIT=(SIIT.TTT),SIGNS=(+,-),C'%')),                           
       IFTHEN=(WHEN=(613,20,SFF,EQ,0),BUILD=(1:1,22,26:C'+0.000%')) 


My output is looking like,

Code:

1001695001 2 20120323    +0.115%                     
1001950001 2 20120323    +0.000%                     
                                              +0.000%
1002317001 2 20120323    +0.000%                     


Not sure why the 5th column for 3 records is empty and why the 4 columns are empty for 3rd record.

Please advise.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 19, 2012 1:50 pm
Reply with quote

I don't know about Syncsort, but with multiple conditional hits on the same record, you'd need HIT=NEXT.
Code:

SORT FIELDS=COPY                                                     
OUTREC IFTHEN=(WHEN=(613,20,SFF,NE,0),                               
       BUILD=(1:1,22,24:((24,20,SFF,MUL,+100000),DIV,613,20,SFF),   
       EDIT=(SIIT.TTT),SIGNS=(+,-),C'%')£),                           
       IFTHEN=(WHEN=(634,20,SFF,NE,0),                               
       BUILD=(45:((45,20,SFF,MUL,+100000),DIV,634,20,SFF),           
       EDIT=(SIIT.TTT),SIGNS=(+,-),C'%')£),                           
       IFTHEN=(WHEN=(613,20,SFF,EQ,0),BUILD=(1:1,22,26:C'+0.000%'))  )


For the second IFTHEN to operate when the first is true for that record, you need HIT=NEXT where I have put the £. Same thing with the third and second.

That's how DFSORT does it, anyway.

EDIT: Remember to check in the documentation, when you get it, how the rounding is done.
Back to top
View user's profile Send private message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Thu Apr 19, 2012 2:08 pm
Reply with quote

Bill,

Have used the HIT=NEXT as suggested by you, after checking the SYNSORT manuals,

Code:

SORT FIELDS=COPY                                                   
OUTFIL IFTHEN=(WHEN=(613,20,SFF,NE,0),                             
       BUILD=(1:1,22,24:((24,20,SFF,MUL,+100000),DIV,613,20,SFF), 
       EDIT=(SIIT.TTT),SIGNS=(+,-),C'%'),HIT=NEXT),               
       IFTHEN=(WHEN=(634,20,SFF,NE,0),                             
       BUILD=(45:((45,20,SFF,MUL,+100000),DIV,634,20,SFF),         
       EDIT=(SIIT.TTT),SIGNS=(+,-),C'%'),HIT=NEXT),               
       IFTHEN=(WHEN=(613,20,SFF,EQ,0),BUILD=(1:1,22,26:C'+0.000%'))


But, I have got a completely different output now,

Code:

1001695001 2 20120323    +0.000%   
1001950001 2 20120323    +0.000%   
                         +0.000%   
1002317001 2 20120323    +0.000%   
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 19, 2012 2:27 pm
Reply with quote

Well I stopped looking when I saw the HIT=NEXT missing.

Have a close read in the manual of the way BUILD works. Bear in mind what your data is showing you. Do some other "experiments". Continue until you fully understand what happens when you do more than one BUILD on the same record.

Then consider how to use OVERLAY for your purpose.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top