Use JZOS(FileFactory) to get files from "path"

General discussion on the JZOS batch launcher and toolkit
Post Reply
sdong
Posts: 2
Joined: Mon Sep 11, 2006 4:02 am

Use JZOS(FileFactory) to get files from "path"

Post by sdong »

Hi,
i am java-programmer and a rookie by mainframe, so I have some questions:
i want to read a lot of files in mainframe and convert them to a other file.
I can use the class FileFactory to open ONE file and to write to ONE other file.
So, how can I read from a path? Is there a definition of "path" in mainframe? Normally in Java I can use the Class java.io.File to handle it, but can I use it
in mainframe envirement?

thanks for help
Stefan
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

On z/OS, there are different "file system" types:

1) A "Posix" (Unix) file system, aka "HFS" or zFS".
This is a file system as you would find on a Unix/Linux system.
These files can be used in z/OS Java using the standard java.io package

2) MVS Datasets
These files are natively record-oriented, not stream oriented.
JZOS provides a ZFile class for opening these in record, text-stream, or binary-stream mode.

The JZOS FileFactory class can be used to open streams on either of the above types, by using the filename to determine which to use. Please refer to the JZOS javadoc for more information.
sdong
Posts: 2
Joined: Mon Sep 11, 2006 4:02 am

Post by sdong »

thx a lot......
we use MVS and I should use ZFile to read files.
my problem is, I dont know how to open a path and get its files, if we have
more than one and dynamically files.

For example:
normally I use java.io.File to open a path like /tmp:
java.io.File filePath = new java.io.File("/tmp");
if ( filePath.isDirectory() ) {
String[] filesUnderTmp = filePath.list();

// open the files
for ( int i=0; i < filesUnderTmp.length; i++ ) {
// open one with FileFactory or ZFile
}
}


I can not find any functions to get a list of files in "path". :roll:

Thanks
regards
Stefan
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Unfortunately, ZFile doesn't currently have a way to do a catalog search for datasets (the analog to a file path directory listing).
Post Reply