Get familiar with the naming conventions of traditional z/OS data sets

The JZOS toolkit makes it easy for developers to write Java applications that access traditional z/OS data sets. The I/O APIs provided by JZOS have a similar feel to I/O APIs for dealing with file on Windows or Linux, but z/OS data sets have a different file name syntax. For example, Windows file paths usually start with a drive letter or a backslash “\” character, Linux with a single slash “/”, but to refer to a z/OS data set in JZOS, a double slash is needed, such as “//SYS1.SEQ”. In addition, depending on the type of data set being referenced, additional rules apply. For example, if referencing a member of a partitioned data set, we need to wrap the part after the double slash with single quotes, as in “//’SYS1.JZOS(JOB)'”. Furthermore, if you are referencing a DD name, the proper file name prefix to use should be “//DD:”.

Please note that many of the JZOS I/O APIs only work with z/OS data sets and does not support POSIX pathnames, and this includes HFS and zFS files. The only exception is the com.ibm.jzos.FileFactory class, which is a factory type class that can build file streams for either z/OS data sets or regular files. Under most circumstances, if you require regular POSIX style file I/O, use the APIs available in the java.io package.

For more information on the proper file name syntax to use with JZOS I/O APIs, refer to the Javadoc comments for class com.ibm.jzos.ZFile in the JZOS API documentation.

Keep the JZOS batch launcher load module and the JZOS toolkit in sync

One of the common mistakes associated with using the JZOS Batch Launcher is using one version of the JZOS batch launcher load module for launching a JVM that includes a different version of the JZOS toolkit. Although most times, there won’t be any issues and your Java program will run fine, on the rare occasion that if something does go wrong because of a mismatch of JZOS batch launcher and JZOS toolkit versions, this type of error can be a pain to debug.

Every z/OS version of IBM SDK Java Technology Edition includes a JZOS batch launcher load module under the mvstools sub-directory, make it a good habit of updating your JZOS batch launcher load modules whenever you use a different version of Java.

To explore more functions offered by the JZOS toolkit, download JZOS Sample Programs and use them as templates for a quick start.

To learn more how to apply JZOS in more advanced environments, follow the examples in the JZOS Cookbook.

Join The Discussion

Your email address will not be published. Required fields are marked *