CALL by reference and content.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Raunak Singh
Registered Member
Posts: 11
Joined: Wed Mar 26, 2014 4:49 pm

CALL by reference and content.

Post by Raunak Singh »

I'm confused in call by reference and content, which one is default. Can you please explain?

Regards
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: CALL by reference and content.

Post by Robert Sample »

From the Language Reference manual section on the CALL statement:
BY REFERENCE is assumed if you do not specify a BY CONTENT, BY REFERENCE, or BY VALUE phrase prior to the first parameter.
CALL BY REFERENCE passes the variable address to the subprogram, so if you change the value in the subprogram, the changed value will still be changed when the calling program regains control. CALL BY CONTENT passes a copy of the variable to the subprogram, so if you change the value in the subprogram, you do NOT change the value when the calling program regains control.
Raunak Singh
Registered Member
Posts: 11
Joined: Wed Mar 26, 2014 4:49 pm

Re: CALL by reference and content.

Post by Raunak Singh »

Thanks Robert.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”