Sample Java Programs for IBM JZOS Batch Toolkit for z/OS Java SDK, Version 6.0.1

(last updated November, 2012)


Sample Java programs for the IBM JZOS toolkit:


A summary of sample programs (all in package com.ibm.jzos.sample) follows:

DynallocCopyDataset

Sample program that uses BPXWDYN to dynamically allocate a new dataset with the same attributes as a given dataset, and then copy the original to the new dataset. The name of the source dataset and target dataset names are given as arguments.

FileFactoryCopy

Sample program that uses the FileFactory class to copy a text file or dataset. The input and output file names are given as arguments to main, and they may be either POSIX (HFS) file names or MVS dataset names.

HelloWorld

Simple class that says hello on System.out and System.err.

PdsLister

Sample program that lists a PDS directory.

PeekOSMemory

Sample program that dumps 500 bytes from the CVT to System.out.

ShowJavaProperties

Simple class used to display Java system properties and selected system environment variables.

ZFileCopy

Sample program that uses the ZFile class to copy an MVS dataset in record mode from DD INPUT to DD OUTPUT.

ZFileSDS

Sample program that inserts, updates, locates, and deletes records in a VSAM KSDS using a JZOS ZFile.

ZFilePrint

Sample program that prints an EBCDIC MVS dataset pointed to by //INPUT DD to System.out (stdout).

MvsConsoleInteraction

This sample shows how JZOS can be used to interact with the MVS console.

MvsConsoleWrapper

This sample demonstrates a main program that can be used to wrap another main program while redirecting System.in and System.out to the MVS console.

CatalogSearchSample

Sample program that uses CatalogSearch, LOCATE and OBTAIN to display information about datasets matching a filter key.

MvsJobOutput

Sample program which reads all sysout data for a MvsJob (jobname and jobid), and writes the output to a specified Writer.

MvsJobSubmitter

Sample program which submits a job to the internal reader, returning a MvsJob object containing the jobname and jobid.

fields.Format5DSCB

fields.Format5DSCBBase

fields.FOrmat5Extent

Sample classes which use the com.ibm.jzos.fields converter classes to map a z/OS format 5 DSCB into a java record.

fields.Smf83BaseRecord

fields.Smf83Product

fields.Smf83Record

fields.Smf83Security

Sample classes which use the com.ibm.jzos.fields converter classes to map some components of an Smf83 record.

nonvsam.directory.DeleteDirectory

Demonstrates how to delete a directory. It may be either a HFS directory or a PDS directory.

nonvsam.directory.ListDirectory

Demonstrates how to list the contents of a directory in two different ways. One approach lists all of the objects in the directory and the other approach lists only the sub-directories.

nonvsam.directory.MakeDirectory

Demonstrates how to create a new directory with default attribute values.

nonvsam.directory.MakeDirectoryLike

Demonstrates how to create a directory using the attributes of an existing directory.

nonvsam.file.CopyFile

Demonstrates how to copy data from one file to another, appending to the second file if it already exists.

nonvsam.file.CreateFile

Demonstrates how to create a file with default attributes values.

nonvsam.file.CreateFileLike

Uses BPXWDYN to dynamically allocate a new dataset with the same attributes as a given dataset.

nonvsam.file.CreateFileWithFileAttributes

Demonstrates how to create a non-VSAM MVS dataset with specific file attributes.

nonvsam.file.DeleteFile

Demonstrates how to delete a file.

nonvsam.file.GetFileAttributes

Demonstrates how to retrieve file attributes.

nonvsam.file.RandomAccessFile

Demonstrates how to randomly access a file.

nonvsam.file.ReadFile

Demonstrates how to read a file sequentially.

nonvsam.file.RenameFile

Demonstrates how to rename a file.

nonvsam.file.WriteFile

Demonstrates how to write data to a file sequentially.

vsam.cluster.DefineKsdsAIX

Demonstrates how to create a VSAM alternate index.

vsam.cluster.DefineKsdsCluster

Demonstrates how to create a VSAM cluster.

vsam.cluster.DeleteKsdsAIX

Demonstrates how to delete a VSAM alternate index created by DefineKsdsAIX.

vsam.cluster.DeleteKsdsCluster

Demonstrates how to delete a VSAM KSDS cluster created by DefineKsdsCluster.

vsam.file.DeleteKsdsRecords

Demonstrates how to delete records from a VSAM dataset.

vsam.file.SeqReadKsds

Demonstrates how to read records from a VSAM dataset.

vsam.file.SeqWriteKsds

Demonstrates how to write records to a VSAM dataset.

vsam.file.UpdateKsdsRecords

Demonstrates how to update records in a VSAM dataset.


Browse z/OS