Same Outputfile in Cobol and PLI



IBM's cross-platform compiler PL/I for MVS, VM & VSE, OS/390 and Enterprise PL/I for z/OS

Same Outputfile in Cobol and PLI

Postby Martin Ohlen » Mon Nov 03, 2008 6:26 pm

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...... :-(((
Martin Ohlen
 
Posts: 4
Joined: Mon Nov 03, 2008 2:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Same Outputfile in Cobol and PLI

Postby dick scherrer » Mon Nov 03, 2008 10:00 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Same Outputfile in Cobol and PLI

Postby Martin Ohlen » Tue Nov 04, 2008 9:14 pm

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
Martin Ohlen
 
Posts: 4
Joined: Mon Nov 03, 2008 2:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Same Outputfile in Cobol and PLI

Postby dick scherrer » Wed Nov 05, 2008 2:32 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Same Outputfile in Cobol and PLI

Postby Martin Ohlen » Fri Nov 07, 2008 12:53 pm

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
Martin Ohlen
 
Posts: 4
Joined: Mon Nov 03, 2008 2:36 pm
Has thanked: 0 time
Been thanked: 0 time


Return to PL/I

 


  • Related topics
    Replies
    Views
    Last post