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
 

 

PL/1 procedures are both; call by value and call by referenc

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
donateeye
Warnings : 2

New User


Joined: 01 Jun 2007
Posts: 62
Location: chennai

PostPosted: Tue May 11, 2010 3:04 pm    Post subject: PL/1 procedures are both; call by value and call by referenc
Reply with quote

The calls are by reference only when the parameters exactly match the argument decalaration in the called proc. Else, it would become call by value.

i.e; In Call by value, if you send a value as a parm, the called proc uses it, processes it, but when its completed, the called proc sends back the original (sent) value. In Call by reference, the original value is replaced by the computed value (means, whatever changed in the called proc)


This is my understanding... Please advice if I am right....
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Tue May 11, 2010 4:06 pm    Post subject:
Reply with quote

Is it really that hard for you to click on the manuals link at the top of the page, find the PL/I Language Reference, and find:
Quote:
6.8.1 Using BYVALUE and BYADDR

Unless an argument is passed BYVALUE, a reference to an argument, not its value, is generally passed to a subroutine or function. This is known as passing arguments by reference, or BYADDR. A reference to a parameter in a procedure is a reference to the corresponding argument. Any change to the value of a parameter is actually a change to the value of the corresponding argument. However, this is not always possible or desirable. Constants, for example, should not be altered by an invoked procedure. For arguments that should not change, a dummy argument containing the value of the original argument is passed. Any reference to the parameter then is a reference to the dummy argument and not to the original argument.

When you specify BYADDR, the compiler puts the address of the corresponding argument in the parameter list. When you specify BYVALUE, puts the value of the argument in the parameter list.

When you specify BYVALUE, a dummy argument is notcreated; however, as is also true for dummy arguments, any change to the corresponding parameter in the called routine will not be visible in the calling routine.

BYVALUE can be specified only for scalar arguments and parameters that have lengths and sizes known at compile time.

A BYVALUE argument should be one that could reasonably be passed in a register. Hence its type should be one of

* REAL FIXED BIN

* REAL FLOAT

* POINTER

* OFFSET

* HANDLE

* LIMITED ENTRY

* FILE

* ORDINAL

* CHAR(1)

* WCHAR(1)

* ALIGNED BIT(n) with n less than or equal to 8
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 Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Is possible to call subprogram from c... cmsmoon COBOL Programming 3 Fri Aug 05, 2016 6:46 pm
No new posts PCOMM macro to call another PCOMM macro boyti ko All Other Mainframe Topics 4 Tue Jul 12, 2016 4:30 pm


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