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

Problem with ADD function.


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

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon Feb 16, 2009 12:47 pm
Reply with quote

Hi,
I was trying to add few columns along the same row. I used the code as listed below using ice tool. My expected O/P is in the form of ZD but i was getting something different.

Code:

OUTREC IFTHEN=(WHEN=INIT,                                     
        OVERLAY=(406:C'00000{',412:C'00000{',                 
 418:(365,14,ZD,ADD,337,14,ZD,ADD,323,14,ZD,TO=ZD,LENGTH=14)))


Th I/P file has Lrecl of 433 (FB) and so as the O/P.
the fields which i want to sum up is of length 14. The corresponding Cobol declaration is "S9(10)V9(4)".

My field A,B,C has the following values:
A= 0000000209120M
B= 0000000000000{
C= 0000000000000{

My O/P is something like this: 2091204- (Even though the computed value is correct, it is not displayed as 0000000209120M).

Pls let me know whats wrong and pls try to suggest a solution in ICETool rather than in ice man or in other ... (Because this particular case is one of the condition which needs to be implemented in a single control card... )

Thanks in Advance.
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon Feb 16, 2009 4:38 pm
Reply with quote

I think the O/P is editted before they are displayed... Pls let me know if there is any way to display the ZD value as it is (without editting or formatting) ...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Feb 16, 2009 10:10 pm
Reply with quote

I'm not sure how you're getting what you say you're getting. M is X'D4' which is a -4. With TO=ZD, you should get a D sign. But your syntax does seem to have the parens in the wrong places. Try this:

Code:

  OUTREC IFTHEN=(WHEN=INIT,                                         
        OVERLAY=(406:C'00000{',412:C'00000{',                       
   418:(365,14,ZD,ADD,337,14,ZD,ADD,323,14,ZD),TO=ZD,LENGTH=14))   


You can also use TO=ZDF if you want an F sign for positive values or TO=ZDC if you want a C sign for positive values. For DFSORT, TO=ZDF and TO=ZD are equivalent.
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Tue Feb 17, 2009 2:29 pm
Reply with quote

Quote:

But your syntax does seem to have the parens in the wrong places
?


Ya..there braces wer not in places... I have corrected that.

Pls let me know how to identify whether there is a overflow or not ?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 17, 2009 10:22 pm
Reply with quote

Quote:
Pls let me know how to identify whether there is a overflow or not ?


Huh? Who said anything about overflow? Overflow of what?
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Wed Feb 18, 2009 6:22 pm
Reply with quote

I have to multiply a big number ( 9(10)V9(4) with another 9(10)V9(4) ) so i ll get a number larger than the 10 digits. If I mention the length as 10, will this not truncate the result. How do i make sure that there is no overflow/truncation in the result.Any specific method to identify.Pls clarify me on this.


Thanks,
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Feb 18, 2009 10:35 pm
Reply with quote

To avoid overflow, just use a LENGTH=n value that will allow for the largest result possible. The number of digits can be up to 31. n can be up to 44 (to allow for separators, etc). So, for example, you could use

...,TO=ZD,LENGTH=31
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 an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts how to use Tso outtrap external function All Other Mainframe Topics 8
Search our Forums:

Back to Top