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

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


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue May 11, 2010 4:06 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Batch call online program, EXCI task ... CICS 3
No new posts CSQBGET - Call giving completion code... COBOL Programming 3
No new posts Infosphere Optim - unable to save Col... IBM Tools 0
Search our Forums:

Back to Top