View previous topic :: View next topic
|
Author |
Message |
mfjude
New User
Joined: 09 Jan 2006 Posts: 20
|
|
|
|
I am analysing some client code.He has inserted variables in the linkage section but is not using them as parameters in procedure division using clause....Can these variables be used as simple working-storage variables now ? |
|
Back to top |
|
|
smiley Warnings : 1 New User
Joined: 08 Feb 2006 Posts: 27
|
|
|
|
Quote: |
I am analysing some client code.He has inserted variables in the linkage section but is not using them as parameters in procedure division using clause....Can these variables be used as simple working-storage variables now ? |
Hi jude,
can u pls explain??
is that variables not at all used in the program? |
|
Back to top |
|
|
mfjude
New User
Joined: 09 Jan 2006 Posts: 20
|
|
|
|
no the variable is used in the pgm.....it is assigned some address in the pgm ? |
|
Back to top |
|
|
smiley Warnings : 1 New User
Joined: 08 Feb 2006 Posts: 27
|
|
|
|
To my knowledge we used to declare a variable in LINKAGE section if we are using it to recieve/pass values from/to other programs.
Correct me if I am wrong!! |
|
Back to top |
|
|
small_world
New User
Joined: 22 Jul 2005 Posts: 24 Location: pune
|
|
|
|
hi jude,
to my knowledge we cant use a variable declared in linkage section as working storage variables.
|
|
Back to top |
|
|
small_world
New User
Joined: 22 Jul 2005 Posts: 24 Location: pune
|
|
|
|
what smiley said is right!!!! its only used to pass the values from other programs... |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Mfjude,
The variables in LINKAGE SECTION can be used as simple working storage under some conditions.
The most common use of the linkage section is to pass data from the calling and called programs. We are all familiar with that and require the PROCEDURE DIVISION USING reference.
It can also be used to receive parameters from the ?PARM=? on the jcl EXEC card. This is very similar to passing data from another program, in this case from the operating system, and also require the PROCEDURE DIVISION USING reference.
There is however, another way to use the LINKAGE SECTION that does not involve passing data from another program that does NOT require the PROCEDURE DIVISION USING reference.
If you have a subroutine that does a ?GETMAIN?, you can set the ?ADDRESS OF? linkage section variable to the address of the ?GETMAIN?d storage and then use that area as you would any other working storage. One reason for doing this would be to make the program reentrant, where the program/subroutine can call itself and still keep the working storage unique.
This also might be done if the program requires occasional storage for large tables. Or for whatever reason the programmer requires this type of storage.
It can also be used to access operating system tables/variables if you know the offsets.
So, in conclusion, you can have variables in the LINKAGE SECTION that are not declared in the PROCEDURE DIVISION USING and be legitimate.
Dave, |
|
Back to top |
|
|
mfjude
New User
Joined: 09 Jan 2006 Posts: 20
|
|
|
|
thanks.....it was really knowledgable |
|
Back to top |
|
|
|