Skip to main content

Restore UNIX Directory Backup from z/OS Dataset to UNIX Directory

This example demonstrates using UCMD Manager on z/OS to restore a directory on a UNIX system from a tgz backup maintained on the z/OS system. See Back up UNIX Directory to zOS Dataset to see how the backup data set was created.

The UNIX script uses the tar command to extract the files to be restored from the tgz backup. The tar command is directed to read the tgz file from its standard input with the tar command line option -f -, which results in it reading from the UCMD Manager UNVIN ddname. The Manager UNVIN ddname allocates the tgz backup data set that was created previously.

//jobname  JOB CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*
// JCLLIB ORDER=SBI.UNV.SUNVSAMP
//*
//STEP1 EXEC UCMDPRC,
// STDIN='DISP=SHR,DSN=hlq.BKUP.TGZ'
//MYSCRIPT DD *

# Check if the directory exists. If it does not, create it.
if test ! -d /export/home/username/fnd
then mkdir /export/home/username/fnd || exit 8
fi
cd /export/home/username/fnd || exit 8

# Note: Not all tar commands recognize the 'B' argument. If you

# receive an error message indicating this from the remote

# UNIX system, remove the 'B' argument.

# The 'B' argument is used to force tar to read multiple

# times to fill the block.

tar -xzvBf - || exit 8

//SYSIN DD *
-script myscript
-host hostname
-userid username
-pwd password
-stdin -mode binary
/*

SYSIN Options

The SYSIN options used in this example are:

Option

Description

-script

ddname from which to read the script file. The script file is sent to the remote system by UCMD Manager for execution.

-host

Host name or IP address of the remote system on which to execute the script.

-userid

Remote user ID with which to execute the command.

-pwd

Password for the user ID.

-stdin

Starts the stdin options. All options read afterwards are applied to the stdin file. The first option not recognized as a standard file option terminates the stdin option list.

-mode

Transfer mode for the stdout file: binary. Since a backup file is a tar, compressed format contains binary data, it should not be translated as text data.

Components

Universal Command Manager for z/OS