AMT Help Files
Home AMT Admin AMT Job Control Language (JCL) AMT JCL Script

AMT JCL Script

Batch IDs

It is possible to pass a batchId from a parent job into the Job Control Language (JCL) script. Thereafter, the batchId value can be used to start the new program job. A UUID is automatically generated if no batchId was provided before starting a JCL script.

Parameters

Configuring a JCL Script for Restart

When a JCL script is configured to be restartable, a restart log file is created to store which cycle file was added when running the script. This restart log file is made unique by adding the Batch ID into the filename. This enables a user to restart a specific instance of a script that has run. The restart log files are stored in the ../<AMT_Root>/Extracts/RestartLog folder with the following filename specification: <script_name>_<batch_id>.json.

Two parameters can be passed to create restarting conditions:

restartat
Use parameter --restartat to specify the step at which the job should restart. Use the following syntax to restart a job at a specific step:
--restartat=<JobStepName>.ProcStep.

Jobs with a step that has no step name can be restarted from the step using the following syntax: --restartat=.ProcStep.

restartbatchid (optional)
Use the optional parameter --restartbatchid to specify the Batch ID of the restart log file to be used. If no restartbatchid parameter is specified, the most recent restart log file is used (the restart log file that starts with the script name).

JCL Script Example Usage

1. Initialize the Library
import lib

lib.initialize(__file__)
2. Submit a SORT Step (ICEMAN/ICETOOL)
from lib import amt_iceman
amt_iceman(step)
from lib import amt_icetool
amt_icetool(step)
3. Run DSNUTILB (DB2 Utility)
from lib import amt_dsnutilb
amt_dsnutilb(step)
4. Copy Files (IEBCOPY/IEBGENER)
from lib import amt_iebcopy
amt_iebcopy(input_file_name="SYSIN")
from lib import amt_iebgener
amt_iebgener(input_file, output_file, definitions_file)
5. List Catalog Entries (IDCAMS LISTCAT)
from lib import amt_listcat
amt_listcat(catalog="MYCAT", entries="MYDATASET", out_file="output.txt")
6. Print Dataset Contents
from lib import amt_print
amt_print(dataset="MYDATASET", count=100)
7. Run FTP Transfer
from lib import amt_ftp
amt_ftp(input_file="ftp_commands.txt")
8. Run SQLLOAD
from lib import amt_sqlload
amt_sqlload()
9. Run Custom Step (Dynamic JCL)
from lib import start_dynamic_jcl
start_dynamic_jcl(name="MY_DYNAMIC_JOB")
10. Set and Resolve Environment Symbols
from lib import set_env_symbol, resolve_env_symbol
set_env_symbol("MYVAR", "VALUE")
value = resolve_env_symbol("MYVAR")
11. Finish Job
from lib import finish_job
finish_job()

Contents

 Go to top