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

how to compile a sub program in case of global variable


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

New User


Joined: 17 May 2010
Posts: 3
Location: chennai

PostPosted: Mon Jun 28, 2010 2:13 pm
Reply with quote

i have coded a main program(proga) , with variable named vara as global and calling the subprogram (progb). in program (progb), i have coded just a display of variable vara but this variable is not declared in progb, since it is declared as global in proga. while compiling progb iam get error as "variable vara not declared". So give me solution for compiling.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jun 28, 2010 5:14 pm
Reply with quote

From the COBOL Language Reference manual (link at the top of the page) with emphasis added by me:
Quote:
5.3.8 GLOBAL clause

The GLOBAL clause specifies that a data-name is available to every program contained within the program that declares it, as long as the contained program does not itself have a declaration for that name. All data-names subordinate to or condition-names or indexes associated with a global name are global names.
As long as you define and compile PROGB as part of PROGA, no problem. If you did not do so, how do you think PROGB will find out about the GLOBAL variable?
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Compile rexx code with jcl CLIST & REXX 6
Search our Forums:

Back to Top