How to Copy Data Between z/OS and USS via Batch Job

Ever wondered how you can transfer data between z/OS and Unix System Services? Well, one of the ways you can do this is via batch job.

//COPYFILE EXEC PGM=IKJEFT01
//IN DD PATH='/tmp/file.txt'
//OUT DD DISP=SHR,DSN=USERA.USSFILE.EXAMPLE(FILEUSS)
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
OCOPY INDD(IN) OUTDD(OUT) TEXT
/*

In this batch job, we are using the OCOPY command to copy the USS file “file.txt” into the MVS partitioned dataset USERA.USSFILE.EXAMPLE, member FILEUSS. However, we could have achieved by using a different command as per the table below:

Command Used to Format
OCOPY · Copy a member of a partitioned dataset (PDS or PDSE) to a USS file

· Copy an MVS sequential dataset to a USS file

· Copy a USS file to a member of a PDS or PDSE

· Copy a USS file to a sequential dataset

· Copy a USS file to another USS file

· Copy a member of a PDS or PDSE to another member of a PDS or PDSE

· Copy a member of a PDS or PDSE to a sequential data set

· Copy an MVS sequential data set to another sequential data set

· Copy an MVS sequential data set to a member of a PDS or PDSE

· Convert between code pages IBM-037 and IBM-947

· Convert between ASCII and code page IBM-947

OCOPY INDD(ddname1) OUTDD(ddname2)

BINARY | TEXT

CONVERT(character_conversion_table | YES | NO)

PATHOPTS (USE|OVERRIDE)

TO947 | FROM947

OPUT · Copy a member of an MVS partitioned dataset (PDS or PDSE) to a USS file

· Copy an MVS sequential dataset to a USS file

· Convert the data from code page IBM-037 or ASCII to code page IBM-947.

OPUT mvs_data_set_name | mvs_data_set_name(member_name)

‘pathname’

BINARY | TEXT

CONVERT(character_conversion_table | YES | NO)

OGET · Copy to a member of an MVS partitioned dataset (PDS or PDSE)

· Copy to an MVS sequential dataset

· Convert the data from code page 947 to code page IBM-037 or ASCII while it is being copied

OGET ‘pathname’

mvs_data_set_name | mvs_data_set_name(member_name)

BINARY | TEXT

CONVERT(character_conversion_table | YES | NO)

OPUTX · Copy members from an MVS partitioned dataset (PDS) or PDSE to a directory in the z/OS UNIX file system.

· Copy a sequential dataset or member of a PDS to a USS file

· Convert the data from code page IBM-037 or ASCII to code page IBM-947 while it is being copied.

OPUTX mvs_PDS_name | mvs_data_set-name(member_name)

hfs_directory | hfs_file_name

ASIS

BINARY | TEXT

CONVERT(character_conversion_table | YES | NO)

LC

MODE(nnn)

QUIET

SUFFIX(suffix)

OGETX · Copy USS files o a member of a partitioned dataset (PDS) or PDSE

· Copy an individual USS file to a sequential dataset or member of a partitioned data set

· Convert the data from code page 947 to code page IBM-037 or ASCII while it is being copied.

OGETX hfs_directory | hfs_file_name

mvs_PDS_name | mvs_data_set_name(member_name)

ASIS

BINARY | TEXT

CONVERT(character_conversion_table | YES | NO)

LC

QUIET

SUFFIX(suffix)

More information can be obtained in IBM’s manual “z/OS UNIX System Services Command Reference”.

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*