Write an MVS dataset with println?

General discussion on the JZOS batch launcher and toolkit
Post Reply
EarlHodil
Posts: 18
Joined: Thu Jan 17, 2013 1:46 pm

Write an MVS dataset with println?

Post by EarlHodil »

I want to write to an MVS dataset with println and all of the other PrintStream methods, but I don't want to be limited to STDOUT. Is there a way to do this?

Thanks in advance,

Earl Hodil
Open Software Technologies
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Write an MVS dataset with println?

Post by dovetail »

If you open a z/OS Dataset in text mode with ZFile, you can use getOutputStream() to return a java.io.OutputStream. You can then wrap this in a PrintStream.

See also the FileFactory class, which gives you a shortcut for making streams or readers on datasets.
EarlHodil
Posts: 18
Joined: Thu Jan 17, 2013 1:46 pm

Re: Write an MVS dataset with println?

Post by EarlHodil »

Thanks, I've done that and now I'm finding that I get 2 records for every record that I write!

Any clue?

Earl Hodil
EarlHodil
Posts: 18
Joined: Thu Jan 17, 2013 1:46 pm

Re: Write an MVS dataset with println?

Post by EarlHodil »

I figured it out. I just had the wrong DCB parameters. BTW, does the fopen() that underlies java, work like regular MVS OPEN? Does the program's DCB override the JCL?
Post Reply