View previous topic :: View next topic |
Author |
Message |
gauthaman_mech Beginner
Joined: 10 Apr 2005 Posts: 12 Topics: 5 Location: India
|
Posted: Mon Nov 28, 2005 2:20 am Post subject: External declaration in Cobol |
|
|
I have some doubts while defining a variable as external in Cobol.
Suppose I have a Main program A which calls a sub-program B. This main program uses a variable WS-TXT whcih is defined in a copybook as EXTERNAL.
Now the main program A and sub-program B will be able to use this variable WS-TXT.
Assume that I have another Main program C which calls a sub-program D. This main program C also uses the same copybook variable WS-TXT defined as EXTERNAL. Also C and D can access this variable WS-TXT.
Assume that both run as different jobs at the same time.
My question is that will this varible WS-TXT be created only once and stored in the common area for both these Main programs or will there be 2 different copies of WS-TXT in each address space and each program will access its own copy. Any change to the value of WS-TXT caued by one program will not affect the other program.
Could you please clarify the same.
Thanks
Gauthaman |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
gauthaman_mech Beginner
Joined: 10 Apr 2005 Posts: 12 Topics: 5 Location: India
|
Posted: Mon Nov 28, 2005 6:06 am Post subject: |
|
|
Thanks a lot Kolusu.
I have only one more question.
The links say that the variable will be common for that run unit.
What does this run unit mean.
Does it mean a Run JCL which invokes a series of procedures which in turn invoke programs.
Or does it mean a program and its sub programs.
Further if this External variable was used by a cobol program and also by another independent DB2 cobol program, and the DB2 cobol program is excuted from IMS environment, there should be 2 copies of that varible even though both the programs are executed at the same time.
Am I right.
Please correct me if I am wrong.
Thanks |
|
Back to top |
|
 |
|
|