[Info-vax] Returning data from Cobol AST routine.

Hein RMS van den Heuvel heinvandenheuvel at gmail.com
Fri Sep 24 10:48:55 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? 
> Anything similar to an COMMON area in Fortran? 

External should have worked - it applies to a whole 01 'record structure' and can have integers, number, text in any any grouping.

If you have access to a server with DECforms installed - or at least the HELP structure you can find a detailed COBOL + AST example in the files FORMS$EXAMPLE:forms$demo_timer*.COB

> 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. 

You received a bunch of answers, mostly over the top - insque and the works.
Sure that allows (and is required) for a solid solution but adds no value here.

Just have the AST routing plunk a command in shared 'external' memory.
Initialize with 'moves spaces'. 
Have the main loop test for non-spaces 
If found - log, interpret, execute, and set back spaces.
In the AST routine you _might_ want test that the shared command buffer is indeed set to spaces before moving in a new command.

Hope this helps,
Hein





More information about the Info-vax mailing list