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

Change in values while passing values to para


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shaldrin M Pereira

New User


Joined: 13 Jul 2012
Posts: 6
Location: INDIA

PostPosted: Mon Jul 16, 2012 1:32 pm
Reply with quote

Hi

I have recently noticed a scenario in PL1

When i pass a value 999.99 through the arguments of a para, and display this value inside the para, the value changes from 999.99 to 9.99989E+02.

These are the details
AMOUNT is declared as FIXED DEC(7,2). When a pass the value 999.99 and call a para CALL CALC(AMT) and display the value AMT ( declared as FIXED DEC(7,2) ) the value is displayed as 9.99989E+02.

I noticed this scenario only in cases when the value is passed in 2 decimal places. When I pass values like 100.00 or 289.90, the values are displayed properly.

Any possible explanation for this ???
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Mon Jul 16, 2012 3:38 pm
Reply with quote

Show the declarations of the arguments in the calling routine, and of the parameters in the called routine. Copy and paste, using Code tags; do not re-type, attach screenshots, or use any other method of obscuring what you're actually doing/
Back to top
View user's profile Send private message
Shaldrin M Pereira

New User


Joined: 13 Jul 2012
Posts: 6
Location: INDIA

PostPosted: Mon Jul 16, 2012 4:30 pm
Reply with quote

Please take this example

AMOUNT FIXED DEC(13,2);
AMOUNT1 FIXED DEC(13,2) INIT 999.99;
AMT FIXED DEC(13,2);


AMOUNT = AMOUNT1;

CALL CHECK_AMT(AMOUNT)

CHEC_AMT: PROC(AMT);

PUT LIST 'THE AMOUNT IS :',AMT;

END CHECK_AMT;

The value is displayed in the spool as 9.99989E+02.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1049
Location: Richmond, Virginia

PostPosted: Mon Jul 16, 2012 5:18 pm
Reply with quote

How about also PUTting the value in your main program as well. Only then can you compare.
Back to top
View user's profile Send private message
Shaldrin M Pereira

New User


Joined: 13 Jul 2012
Posts: 6
Location: INDIA

PostPosted: Mon Jul 16, 2012 5:49 pm
Reply with quote

When i displayed the variable AMOUNT1 in the main program I got the value 999.99
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1049
Location: Richmond, Virginia

PostPosted: Mon Jul 16, 2012 8:25 pm
Reply with quote

Actual code would have DCL's, not just in main but also in the proc.

Your code as pointed out cannot compile.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Mon Jul 16, 2012 10:26 pm
Reply with quote

How did you declare AMT in your sub-routine? If you didn't then it will take the default characteristics which may be float but I do not know a I never entirely default a variable.
Back to top
View user's profile Send private message
Shaldrin M Pereira

New User


Joined: 13 Jul 2012
Posts: 6
Location: INDIA

PostPosted: Tue Jul 17, 2012 11:39 am
Reply with quote

I did not declare AMT in the subroutine, I have declared it in the main program. The AMT in subroutine will assume the declaration FIXED(13,2) ryte??
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1314
Location: Vilnius, Lithuania

PostPosted: Tue Jul 17, 2012 4:24 pm
Reply with quote

Shaldrin M Pereira wrote:
I did not declare AMT in the subroutine, I have declared it in the main program. The AMT in subroutine will assume the declaration FIXED(13,2) ryte??

And why would it?

You want to know why not? RTFM!
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1049
Location: Richmond, Virginia

PostPosted: Tue Jul 17, 2012 5:20 pm
Reply with quote

Even if you do not RTFM, since in many languages subroutines would be separately compiled, in general information from the calling routine would not be available.

Your assumption is wryng.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Tue Jul 17, 2012 7:27 pm
Reply with quote

"Assumption"? Even with RULES(LAXDCL), the compiler would have returned RC=4, and the TS should have read the messages and seen the problem; with RULES(NOLAXDCL), it would have returned RC=8!

This is another case of an ignorant and incompetent fraud with a worthless certificate from a scam "mainframe institute", hired by a body shop whose clients are greedy First World managers only interested in getting warm bodies for as low a price as possible, despite getting nothing in return icon_mad.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 17, 2012 8:02 pm
Reply with quote

Akatsukami wrote:

This is another case of an ignorant and incompetent fraud with a worthless certificate from a scam "mainframe institute", hired by a body shop whose clients are greedy First World managers only interested in getting warm bodies for as low a price as possible, despite getting nothing in return icon_mad.gif


should we blame the republicans for running the school
or democrats for lowering the standards? icon_lol.gif icon_lol.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Tue Jul 17, 2012 8:51 pm
Reply with quote

and the TS even works for ... Tata Consultancy Services icon_eek.gif

but as a partial excuse he does not list PL/1 as skill icon_cool.gif
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Tue Jul 17, 2012 9:10 pm
Reply with quote

Akatsukami wrote:
"Assumption"? Even with RULES(LAXDCL), the compiler would have returned RC=4, and the TS should have read the messages and seen the problem; with RULES(NOLAXDCL), it would have returned RC=8!

This is another case of an ignorant and incompetent fraud with a worthless certificate from a scam "mainframe institute", hired by a body shop whose clients are greedy First World managers only interested in getting warm bodies for as low a price as possible, despite getting nothing in return icon_mad.gif
I wonder who started the idiotic notion that programming is a commodity?

My pet theory (tongue in cheek, I am not trying to offend anyone) is that the idea was invented by managers who absolutely hated their programming step on the career ladder (yes children, once upon a time, virtually all IT project managers started their careers as programmers or operators (some did both)) because, frankly, they were no good at it.

Their lack of programming skills compared to their peers bred an inferiority complex that some carried up the career ladder with them. The good managers learned to appreciate and value the talent and skill required to be a competent programmer, but the others saw an opportunity for payback. "Anyone can write code, programmers are a dime a dozen". Or maybe it's not a question of payback; their perspective may have been skewed by the fact that their own lack of talent meant that they were only ever given trivial programming tasks to do. The meatier stuff went to the real programmers, so they never really learned what it takes to write a good program. icon_smile.gif
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Passing containers on START command CICS 4
No new posts how to eliminate null indicator value... DB2 7
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top