View previous topic :: View next topic
|
Author |
Message |
Shaldrin M Pereira
New User
Joined: 13 Jul 2012 Posts: 6 Location: INDIA
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Shaldrin M Pereira
New User
Joined: 13 Jul 2012 Posts: 6 Location: INDIA
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
How about also PUTting the value in your main program as well. Only then can you compare. |
|
Back to top |
|
|
Shaldrin M Pereira
New User
Joined: 13 Jul 2012 Posts: 6 Location: INDIA
|
|
|
|
When i displayed the variable AMOUNT1 in the main program I got the value 999.99 |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Shaldrin M Pereira
New User
Joined: 13 Jul 2012 Posts: 6 Location: INDIA
|
|
|
|
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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1314 Location: Vilnius, Lithuania
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
"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 |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
should we blame the republicans for running the school
or democrats for lowering the standards? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
and the TS even works for ... Tata Consultancy Services
but as a partial excuse he does not list PL/1 as skill |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
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 |
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. |
|
Back to top |
|
|
|