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

Problem with numeric operation in outfil. Need help.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bijoybabu83

New User


Joined: 15 Jan 2007
Posts: 36
Location: Kerala

PostPosted: Tue Oct 13, 2009 8:06 pm
Reply with quote

I am performing a numeric operation on some fields in a file of length 133 using OUTFIL.
The operation being performed is :-
1. Subtract two Zoned decimal fields in the input file at positions 54 to 63(54,10) and at position 64-73 (64,10).

2. Now divide the answer by the same field in 64-73 (64,10).

The two values are :- 0000009087 and 0000009012.

Please find the outfil statement that i have written to do the arithmetic calculation.

OUTFIL FNAMES=OUTPUT1,OUTREC=(1,73,74:(54,10,ZD,SUB,64,10,ZD),
DIV,64,10,ZD,EDIT=(STTTTTTTTT.TTTT),SIGNS=(,-),
LENGTH=15,45X).

For the above values, the output of this operation is 000000000.0000 whereas the actual values should be 0000000000.0800.

Please help me to find out why it is printing wrong values.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 13, 2009 9:07 pm
Reply with quote

bijoybabu83 wrote:

The two values are :- 0000009087 and 0000009012.

For the above values, the output of this operation is 000000000.0000 whereas the actual values should be 0000000000.0800.

Please help me to find out why it is printing wrong values.


how did you end up with 0000000000.0800?

(9087-9012)/9012 = 75/9012 = 0.008322237

If that is what you want then the following Control cards will give you the desired results

Code:

//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                               
  OUTFIL FNAMES=OUTPUT1,                                         
  OVERLAY=(74:(+10000,MUL,(54,10,ZD,SUB,64,10,ZD)),             
              DIV,64,10,ZD,EDIT=(STTTTTTTTT.TTTT),SIGNS=(,-),45X)
/*
Back to top
View user's profile Send private message
bijoybabu83

New User


Joined: 15 Jan 2007
Posts: 36
Location: Kerala

PostPosted: Wed Oct 14, 2009 3:07 pm
Reply with quote

Hi Skolusu, I really appreciate your help. Your solution is exactly what I wanted. Thank you so much
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts OUTFIL with SAVE option DFSORT/ICETOOL 7
No new posts Convert HEX to Numeric DB2 3
No new posts z/vm installation problem All Other Mainframe Topics 0
Search our Forums:

Back to Top