Page 1 of 1

Same Outputfile in Cobol and PLI

PostPosted: Mon Nov 03, 2008 6:26 pm
by Martin Ohlen
Hi all,
i´m looking for a chance to write one and the same Outputfile from a Cobol-Mainprogram and a PLI-Subprogramm (with Fetch or static Link).

Main(Cobol) : Write Hallo 1
Call PLI-SUB
PLI-SUB : Write Hallo 2
return
Main(Cobol) : Write Hallo 3
End.

This is, what i want :
Hallo 1
Hallo 2
Hallo 3

Any Idea ?
Thanks for Help !
Regards,
Martin

P.S. Without an Open in PLI, PLI opens the File implicit, the Output before in Cobol is going to Discharge...... :-(((

Re: Same Outputfile in Cobol and PLI

PostPosted: Mon Nov 03, 2008 10:00 pm
by dick scherrer
Hello,

the Output before in Cobol is going to Discharge
I don't know what this means - it is not mainframe cobol terminology.

To get 2/3 of what you want use:
DISPLAY 'HALLO 1'
and
DISPLAY 'HALLO 3'

in the cobol code. DISPLAY in cobol writes to the SYSOUT dataset.

Re: Same Outputfile in Cobol and PLI

PostPosted: Tue Nov 04, 2008 9:14 pm
by Martin Ohlen
Hello Dick,
sorry, I mean the output from the pli-program is lost.

First I open the Outputfile in the Cobol-Mainprogramm. Then I write one line into the file.
After that, I call the PLI-Subprogram. There is the same OutputFile-Declaration in this program (just in PLI). Now i write the second line in that file without an Open in the Subprogram. After that, i return to Main-Program (Cobol) and write the third line. After all, I close the File in Mainprogramm.

The content in the File ist the second and third row, the first row is lost.
What can I do to all three lines secure ?- Two in Cobol - One in PLI - all in the same file... ?
Do you have an idea ?
Regards,
Martin

Re: Same Outputfile in Cobol and PLI

PostPosted: Wed Nov 05, 2008 2:32 am
by dick scherrer
Hello,

How is the file defined in the jcl? Possibly NEW?

I'd try with disp=mod and see if things improve.

It sounds like a close/open is happening in the pl/i code that is causing the file to be reset to the beginning.

Re: Same Outputfile in Cobol and PLI

PostPosted: Fri Nov 07, 2008 12:53 pm
by Martin Ohlen
dick scherrer wrote:It sounds like a close/open is happening in the pl/i code ...


Yes, i think this is the problem.
The type of file in the JCL does not matter, PLI makes an implizit open (even if I do not want).

Is there any way to prevent that ?

Regards
Martin