[Info-vax] Returning data from Cobol AST routine.
Bob Gezelter
gezelter at rlgsc.com
Tue Sep 21 11:40:21 EDT 2021
On Monday, September 20, 2021 at 6:55:06 PM UTC-4, Jan-Erik Söderholm wrote:
> Hi.
>
> I have been looking at the Cobol AST example here:
> http://computer-programming-forum.com/48-cobol/b75d8c5fdd43048e.htm
>
> This does work fine as an example. But what are the options to get
> some data back to the main program (called "x" in the example)
> from the ast program (called "ast_routine" in the example)?
>
> I have tried different versions of global, external and so on, but
> no luck so far. How to get "x" and "ast_routine" to share some data? Jan-Erik,
> Anything similar to an COMMON area in Fortran?
>
> The idea is to have an AST routine that will read from a mailbox when
> something is written to it. My idea was that the read of the mailbox
> would be using an AST to avoid polling the mailbox.
>
> This is to have a command input to detached processes to get them to
> reload the config, repoen the log file, close and exit and so on.
>
> Are there more options if not everything is done in Cobol?
> We can easily add some C if that helps...
>
> Regards,
> Jan-Erik.
Jan-Erik,
I will be happy to send you a copy of my notes from my seminar on ASTs.
In short, you want to do the mailbox read in an AST, with the read completion being another AST routine, which after processing the message, start the main program to process the received information.
The best way to accomplish this is for everything to be in the AST routine.
However, as I noted in the seminar, some packages are not-well suited for this approach. When dealing with such a program or library, the best way is to use interlocked queues in both directions.
I forget if COBOL has intrinsic hooks for interlocked queues, but if nothing else, there are LIB$ equivalents.
If I can be of assistance, please let me know.
- Bob Gezelter, http://www.rlgsc.com
More information about the Info-vax
mailing list