Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Change in values while passing values to para

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Change in values while passing values to para
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: 1738
Location: Bloomington, IL

PostPosted: Mon Jul 16, 2012 3:38 pm    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Mon Jul 16, 2012 5:18 pm    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Mon Jul 16, 2012 8:25 pm    Post subject:
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: 1712
Location: UK

PostPosted: Mon Jul 16, 2012 10:26 pm    Post subject:
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    Post subject:
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

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Tue Jul 17, 2012 4:24 pm    Post subject:
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

Active Member


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

PostPosted: Tue Jul 17, 2012 5:20 pm    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Tue Jul 17, 2012 7:27 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Jul 17, 2012 8:51 pm    Post subject: Reply to: Change in values while passing values to para
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: 641
Location: Whitby, ON, Canada

PostPosted: Tue Jul 17, 2012 9:10 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us