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 » Mon Feb 11, 2013 1:57 pm

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: 1839
Joined: Thu Jul 29, 2004 12:12 pm

Re: Write an MVS dataset with println?

Post by dovetail » Tue Feb 12, 2013 10:23 am

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 » Thu Feb 14, 2013 8:11 am

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 » Fri Feb 15, 2013 4:55 am

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