Working Storage, linkage section and values.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Anil Khanna
Registered Member
Posts: 15
Joined: Wed Aug 07, 2013 12:09 am

Working Storage, linkage section and values.

Post by Anil Khanna »

Hello all,

I've question which I'm not sure of, when a program is dynamically linked, are the values retained in working storage if that program is called multiple time from the same source? Please help.
User avatar
Marso
New Member
Posts: 2
Joined: Sun Jun 08, 2014 1:00 pm

Re: Working Storage, linkage section and values.

Post by Marso »

Yes they are.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Working Storage, linkage section and values.

Post by Robert Sample »

In general, yes. However, it is possible to use INITIAL in the IDENTIFICATION DIVISION of the subprogram or CANCEL in the PROCEDURE DIVISION of the calling program to reset a subprogram to its initial state in which case any changes to variables would NOT be retained.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Working Storage, linkage section and values.

Post by William Collins »

Also note the values in the LOCAL-STORAGE SECTION are reset on each entry into a program, if you use LOCAL-STORAGE (this is with or without IS INITIAL).
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.”