A good way to deal interaction with such programs
is to to use a TACL macro/routine with the INLINE facility.
You can send commands to the program.
You can receive the responses of the program.
TACL lets you program the conrtol flow.
Something like this:
#PUSH :PRGOUT :PRGSTATUS
INLPREFIX >
INLECHO ON
INLOUT ON
RUN PRG /INLINE/
> firstcommand
[#IF ([#LINEFIND :PRGOUT 1 ERROR])
|THEN|
#SET :prgstatus 0
|ELSE|
> exit
#SET :prgstatus 1
]
. . .