Skip to main content

The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

Hi Jose,

It sounds like EXTERNAL data would probably work for you.

If you define a data area in all of your programs and use the EXTERNAL keyword then that data area does not belong to any one program but instead it belongs to the run-unit and is shared by all programs within that run-unit that also have it defined.

prog1:

01 my-ext-data   external.
   05 field-1    pic x(10).
   05 field-2    pic x(20).
  move "TEST" to field-1

  call "prog2"
  display field-1 *> will display PROG2

prog2:

01 my-ext-data   external.
   05 field-1    pic x(10).
   05 field-2    pic x(20).

  display field-1   *> will display TEST
  move "PROG2" to field-1
  goback.


The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

OK. Clear and concise.

But, what we must do to create that variable EXTERNAL?

COBOL automatically create it or we need to do something extra?


The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

All you have to do is define it as external in each of your programs that will require it and then it will automatically be created as external data when the program runs just like any other data defined in working-storage.


The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

Thanks Chris.

We'll do a test.


The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

Thanks Chris.

We'll do a test.


The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

Hi Chris

When you 're saying "same run-unit" you mean the same executable?


The scenario is as follows:


Within a run-unit, we run a program that calls others (many others).
We would need to have a data area visible by all programs running within that run unit.
Eventually, some program also would update the data in this area, as if it were the "session data".
Any idea how we could implement this requirement?

We are using Visual Cobol 2.2 under Unix.

Any collaboration will be appreciated.

Not necessarily the same executable. A run-unit consists of the main COBOL program and all subprograms that it may call so these subprograms could be in separate executable files like .int, gnt,.dlls, .so's...

The run-unit would then be made up of all of these executables.