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

regarding variables in linkage section.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mfjude

New User


Joined: 09 Jan 2006
Posts: 20

PostPosted: Fri Feb 17, 2006 12:30 pm
Reply with 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 ?
Back to top
View user's profile Send private message
smiley
Warnings : 1

New User


Joined: 08 Feb 2006
Posts: 27

PostPosted: Fri Feb 17, 2006 2:49 pm
Reply with quote

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
View user's profile Send private message
mfjude

New User


Joined: 09 Jan 2006
Posts: 20

PostPosted: Fri Feb 17, 2006 3:25 pm
Reply with quote

no the variable is used in the pgm.....it is assigned some address in the pgm ? icon_sad.gif
Back to top
View user's profile Send private message
smiley
Warnings : 1

New User


Joined: 08 Feb 2006
Posts: 27

PostPosted: Fri Feb 17, 2006 3:54 pm
Reply with quote

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
View user's profile Send private message
small_world

New User


Joined: 22 Jul 2005
Posts: 24
Location: pune

PostPosted: Fri Feb 17, 2006 4:07 pm
Reply with quote

hi jude,
to my knowledge we cant use a variable declared in linkage section as working storage variables.

icon_confused.gif
Back to top
View user's profile Send private message
small_world

New User


Joined: 22 Jul 2005
Posts: 24
Location: pune

PostPosted: Fri Feb 17, 2006 4:08 pm
Reply with quote

what smiley said is right!!!! its only used to pass the values from other programs...
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sat Feb 18, 2006 1:30 am
Reply with quote

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
View user's profile Send private message
mfjude

New User


Joined: 09 Jan 2006
Posts: 20

PostPosted: Tue Feb 21, 2006 7:56 pm
Reply with quote

thanks.....it was really knowledgable
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts JCL with variables JCL & VSAM 1
No new posts FD Section to Create FB or Vb File Dy... COBOL Programming 1
No new posts JCL Variables JCL & VSAM 1
Search our Forums:

Back to Top