Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1777
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: 965
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: 965
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: 1895
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

Senior Member


Joined: 07 Feb 2009
Posts: 1060
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: 965
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: 1777
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: 6968
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: 10327
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: 658
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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us