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
 

 

Passing value To a Called Pgm.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Vineet

New User


Joined: 14 Sep 2005
Posts: 18

PostPosted: Thu Oct 12, 2006 11:33 am    Post subject: Passing value To a Called Pgm.
Reply with quote

Hi All,
I have a small query. Lets say in a Cobol Pgm, in Working Storage Section I have Var. lets say:

01 VAR1 Pic x(3) value 'ABC' .

Now If I pass value of VAR1 to any called Pgm & in called Pgm value gets returned to VAR1 as 'XYZ', then during the execution of main Pgm.(After the Called Pgm), If I refer to Var1 what value will it be having 'ABC' or 'XYZ'. or does this mean that before the called Pgm. is encountered value of var1 going to be 'ABC' & after the called pgm. value going to be 'XYZ'.

Thanx
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Oct 12, 2006 11:46 am    Post subject:
Reply with quote

Hi Vineet,

Yeap u r right before the called Pgm encountered value of var1 going to be 'ABC' & after the called pgm. value going to be 'XYZ'.
Back to top
View user's profile Send private message
vin12pr
Warnings : 1

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Thu Oct 12, 2006 12:16 pm    Post subject: Re: Passing value To a Called Pgm.
Reply with quote

Hi,

It depends on how you pass the variable to the called program:

1) If you pass the variable by "CALL BY REFERENCE" ,the modified value of the variable is expected to be visible in the main program.

2) If you pass the variable by "CALL BY VALUE" , the modified value of the variable will not be visible in the main program.

Correct me if am wrong...

Thanks icon_smile.gif ,
Vinay
Back to top
View user's profile Send private message
Vineet

New User


Joined: 14 Sep 2005
Posts: 18

PostPosted: Thu Oct 12, 2006 12:50 pm    Post subject:
Reply with quote

Hi Ekta & Vinay thanx for the Help. I really Appreciate the effort you took to reply to my query. I have some more doubts.

1) Is it possible that while calling the called Pgm for the parameters we can have both "Call By Value" & "Call By Reference". For "Call By Value" does this means that we directly pass the value like:
Call "SubRout" using "ABC","XYZ"

And for "Call By Reference" does this mean that we pass value throug some Var. i.e. Call "SubRout" using Var1,Var2.

2) I red some where
if call by Reference: CALL PGM1 USING BY REFERENCE parm1
If Call by Value: CALL PGM1 USING BY VALUE parm1
If Call by Content: CALL PGM1 USING BY CONTENT parm1
what is meaning of "USING BY CONTENT"

Thanx
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Sun Oct 15, 2006 8:44 am    Post subject: Re: Passing value To a Called Pgm.
Reply with quote

Vineet,
First thing we dont code "Value" in Call statement of a Cobol program. I think above posts meant for Call by Content instead. And the changes in value of the variable should be as suugested by Vinay above.
Quote:
1) Is it possible that while calling the called Pgm for the parameters we can have both "Call By Value" & "Call By Reference".
Yes, you can have both Call by reference and Content in a single Call statement.
Quote:
For "Call By Value" does this means that we directly pass the value like:
Call "SubRout" using "ABC","XYZ"
And for "Call By Reference" does this mean that we pass value throug some Var. i.e. Call "SubRout" using Var1,Var2.
See here...
Quote:
2) I red some where
if call by Reference: CALL PGM1 USING BY REFERENCE parm1
If Call by Value: CALL PGM1 USING BY VALUE parm1
If Call by Content: CALL PGM1 USING BY CONTENT parm1
what is meaning of "USING BY CONTENT"
If you have gone thru above link... I dont think you are still looking for this answer... Are you?
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Could we identify the called modules ... elixir1986 COBOL Programming 5 Fri Jul 14, 2017 1:53 am
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 5 Tue Nov 29, 2016 9:25 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
This topic is locked: you cannot edit posts or make replies. How to supply called sub-program from... dchristensen JCL & VSAM 25 Wed Sep 14, 2016 11:36 pm


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