Table of Contents Previous Next PDF


Oracle Tuxedo Application Runtime for Batch Functions

Oracle Tuxedo Application Runtime for Batch Functions
Introduction to the Batch Runtime Commands
This chapter describes:
Emulating z/OS JCL Logic and Architecture
Oracle Tuxedo Application Runtime for Batch provides a set of high-level functions that simplify script syntax enabling more readable and more easily maintainable Korn shell scripts.
Using these functions ensures consistent services; when used together, execution of one function can be conditional on the value of the return code produced by a preceding function.
A function is generally called directly from a Korn shell script resulting from JCL conversion.
Oracle Tuxedo Application Runtime for Batch normalizes Korn shell script formats by proposing a script model where the different execution phases of a job are clearly identified.
EJR syntax
Synopsis
EJR [-h]
EJR [-v] [-d regexp] [-f EnvFile] [-t file] [-V n] Job [parameters]
Arguments
-h
help — displays the command syntax. Reserved for maintenance team.
-d regexp
Debug mode — with a regular expression (regexp) describing the functions to debug, for example -d "m_FileLoad" to debug the m_FileLoad function.
-v
Verbose mode — the execution report is displayed on screen during execution. By default not activated.
-f EnvFile
Specifies an environment file that is different from the default (BatchRT.conf) file.
-t file
Test mode — this option runs the script without executing the different steps. It allows to check the kinematics of the Korn shell script. Reserved for maintenance team.
-V n
Level mode (0 to 9).
Job
The job name — the name of the script to be launched without the .ksh extension.
Parameters
Optional parameters for the job.
Tools for managing the execution of jobs
Log file management
When a script is launched with EJR, a log file is generated. When not using TuxJES, the name of the log file is:
JobName_YYYYMMDDHHMMSS_Jobid.log.
The log file is created in a directory identified by the MT_LOG environment variable. The contents of this file provide the production team with detailed information about the execution of a job.
When using TuxJES, refer to the related documentation.
Return code management
Oracle Tuxedo Application Runtime for Batch uses several return-code variables to manage the result of a function execution and the result of job execution.
Cobol runtime
A COBOL runtime, runb, is provided to initialize the execution context of a user Cobol program before the call for its execution. This runtime is used instead of the standard Cobol runtime.
Oracle Tuxedo Application Runtime for Batch Purpose
DataBase interaction management
Oracle Tuxedo Application Runtime for Batch takes care of the Database context usage:
Testing the Validity of a Script (non-exec mode)
Tip:
Using the -t argument, it is possible to run the KSH script without executing the internal functions. The -t argument allows a script to be checked (for example a newly-developed script) and verify the chaining of the different phases.
Oracle Tuxedo Application Runtime for Batch Functions
Naming Convention
The names of the Batch Runtime functions respect the following format:
prefix_ObjectAction
Where:
prefix_
m
specifies an external function.
mi
specifies an internal function.
Object
is the type of object on which the function is used and
Action
is the action to be executed on the object.
Examples include:
Reference Page Command Syntax
Unless otherwise noted, commands described in the Synopsis section of a reference page accept options and other arguments according to the following syntax and should be interpreted as explained below.
name [ -option . . . ] [cmdarg . . . ]
where name is the name of an executable file and option is a string of one of the following two types: noargletter . . . or argletter optarg [, . . .]
An option is always preceded by a "-".
noargletter
A single letter representing an option that requires no option-argument. More than one noargletter can be grouped after a "-" .
optarg
A character string that satisfies a preceding argletter. Multiple optargs following a single argletter must be separated by commas, or separated by white space and enclosed in quotes.
cmdarg
A pathname (or other command argument) that represents an operand of the command.
-
(dash) By itself means that additional arguments are provided in the standard input.
--
(two dashes) Means that what follows are arguments for a subordinate program.
[ ]
Surrounding an option or cmdarg, mean that the option or argument is not required.
{ }
Surrounding cmdargs that are separated by an or sign, mean that one of the choices must be selected if the associated option is used.
"OR" argument
. . .
Means that multiple occurrences of the option or cmdarg are permitted.
Reference
The Oracle Tuxedo Application Runtime for Batch Reference Guide describes, in alphabetic order, shell-level functions delivered with the Batch Runtime software.
The following functions are described:
Table 3‑2  
Overview
The functions correspond to the interface (API) between the shell script and the Batch Runtime executable. Some scripts, such as m_JclibSet, are used only in the conversion stage and are not present in the extended script that is available for execution.
m_CondElse
Name
m_CondElse — Else of a condition.
Synopsis
m_CondElse
Description
This function marks the alternative part of a m_CondIf function.
Options
No parameters.
m_CondEnd
Name
m_CondEnd - End of a condition
Synopsis
m_CondEnd
Description
This function ends the previous IF condition.
Options
No parameters.
m_CondExec
Name
m_CondExec — conditional execution (for a program or procedure).
Synopsis
m_CondExec condexp [condexp...]
Description
Conditional execution. If condition is true, the remaining command in the current step is ignored. Each condition expression contains either, EVEN, ONLY or a value, operator[,step] condition. An m_CondExec statement may contain several condition expressions and this association specifies a logical "OR" of the different conditions.
Options
Condexp [condexp]
Condition expression.
EVEN
Executes step even if previous step ended abnormally.
ONLY
Executes step only if previous step ended abnormally.
value, operator[,step]
Where <step> is any of the previous steps. If the previous step was not executed, the condition is false.
Examples
m_CondExec EVEN
m_CondExec 4,LT,STEPEC01 8,LT,STEPEC02 ONLY
m_CondIf
Name
m_CondIf - Conditional execution
Synopsis
m_CondIf "condexp [condexp…]"
Description
Executes the condition contained in the " condexp " parameter. Nested levels of "if" conditions are authorized.
Options
"Condexp [condexp]"
Conditional expression.
RC,operator,value
RC indicates a return code.
STEP.RC,operator,value
STEP.RC indicates that the expression tests a return code for a specific STEP.
Operator indicates the operator used for the conditional expression (GT, LT, EQ etc.).
ABEND
ABEND indicates an abend condition occurred.
ABENDCC=number
ABENDCC indicates a system or user completion code.
Examples
m_CondIf " RC,EQ,3"
Note:
m_DirCopy
Name
m_DirCopy – Copies the members of a directory.
Synopsis
m_DirCopy InDir OutDir
Description
This function copies the members of a directory to another directory.
Options
InDir
The name of the directory to be copied.
OutDir
The name of the output directory.
Example
m_DirCopy ${DATA}/PJ01DDD.BT.DATA.PDSA ${DATA}/PJ01DDD.BT.DATA.PDSE
m_DirCreate
Name
m_DirCreate – Creates a directory.
Synopsis
m_DirCreate DirName
Description
This function creates a directory.
Options
DirName
The name of the directory to be created.
m_DirDelete
Name
m_DirDelete – Deletes a directory.
Synopsis
m_DirDelete DirName
Description
This function deletes a directory.
Options
DirName
The name of the directory to be deleted.
m_DirRename
Name
m_DirRename – Renames a directory.
Synopsis
m_DirRename DirName
Description
This function renames a directory.
Options
DirName
The name of the directory to be renamed
m_ExecSQL
Name
m_ExecSQL — Executes an SQL script.
Synopsis
m_ExecSQL -f <sysin file>
Description
This function executes an SQL script.
Options
-f <sysin file>
The <sysin file> contains the SQL directives (CREATE TABLE, CREATE INDEX, DELETE, SELECT …)
Example
cat <<_end >${TMP}/SYSIN_STEPDB04_${MT_JOB_NAME}_${MT_JOB_PID}
SELECT * FROM PJ01DB2.TABTEST2;
_end
m_FileAssign -d OLD SYSIN
${TMP}/SYSIN_STEPDB04_${MT_JOB_NAME}_${MT_JOB_PID}
m_ExecSQL -f ${DD_SYSIN}
Note:
m_FileAssign
Name
m_FileAssign — Assigns a file.
Synopsis
m_FileAssign -c [-d] [-g] ddname dsname
Description
m_FileAssign assigns a file. If assigning a file triggers the creation of a file, the creation process precedes the assign itself.
Specific cases are:
New files (DISP=NEW parameter).
Override files (file override in the JCL); a specific assign function m_FileOverride is used. This function call is implanted in each STEP required, before the execution of the program.
In the case where a file assign contains a DISP=NEW,DELETE,DELETE parameter, a delete process is added to the end (normal and abnormal) of the step.
For the DISP=OLD and DISP=PASS options, the file is kept.
For the DISP=MOD option, the write to the file is made in a temporary intermediary file, then by a copy in Extend on the original file.
Options
-c <concatenation>
Concatenate this file with the previous dsname for this ddname.
-d <DispOption>
This option indicates the DISPosition status of the file in the format:
DISP=([status][,normal-termination-disp][,abnormal-termination-disp])
Possible combinations are:
The Disp Option indicates the status of the data set at the beginning of a job step and what to do with the data set in the event of normal and abnormal termination of the step.
<status>
The status indicates if an existing data set should be used or a new one created. For existing data sets the status indicates if the data set can be shared with other jobs or used to append records to the end of the data set. the possible values are:
NEW — indicates to create a new unshared data set.
OLD — indicates to use an existing unshared data set.
SHR — indicates to use an existing shared data set.
MOD — indicates an existing unshared data set to add records at the end of file.
<normal-termination-disp>
This option indicates what to do with a data set when a step ends normally. The possible values are:
DELETE — The data set is no longer needed.
KEEP — The data set is to be kept.
PASS — The data set is to be passed for use by a subsequent step.
(CATLG is not supported).
<abnormal-termination-disp>
DELETE — The data set is no longer needed.
KEEP — The data set is to be kept.
(CATLG is not supported).
The termination dispositions have default values for each status, the default values are:
NEW: DELETE, DELETE
OLD/SHR/MOD : KEEP, KEEP
Note:
-g <generationFile>
Indicates that the data set is a generation file.
ddname <InternalFileName>
The logical name of the file as defined in the SELECT statement of the COBOL program.
dsname <ExternalFileName>
Real file name, full path of the file on the disk.
Examples
m_FileAssign -d SHR ENTREE ${DATA}/PJ01DDD.BT.QSAM.KBIEI001
m_FileBuild
Name
m_FileBuild — Creates a file.
Synopsis
m_FileBuild -t <type> -r <record length> [-k <primary key] [-K secondary key] >filename>
Description
This function creates a file.
Options
-t Type
Type is the organization type of the created file. The possible values are:
SEQ
for a sequential file.
LSEQ
for a line sequential file.
INDX
for an indexed file
Note:
-r Length
Indicates the record length of the file. This option is mandatory for indexed files.
-k Position+Length
The primary key (mandatory for indexed files)
Position
The first character of the key in relation to the beginning of the record.
Length
The length of the primary key.
-K Position+Length[d] [Position+Length[d] ...]
The secondary key indicating that the file contains one or more secondary keys. Each secondary key may permit duplicates.
Position
The first character of the key in relation to the beginning of the record.
Length
The length of the primary key.
d
Permit duplicates of secondary key.
Examples
To build an indexed file with no secondary key, the following function builds an indexed file with a record length of 266 bytes. There is no secondary key and the primary key begins in the first character of the record and is six characters long
m_FileBuild -t IDX -r 266 -k 1+6 ${DATA}/METAW00.VSAM.CUSTOMER
To build a similar indexed file, with in addition, a non-duplicate secondary key in position 20 with a length of 7 the following function can be used:
m_FileBuild -t IDX -r 266 -k 1+6 -K 20+7 ${DATA}/METAW00.VSAM.CUSTOMER
To build a similar indexed file with a secondary key allowing duplicates in position 20 with a length of 7 the following function can be used:
m_FileBuild -t IDX -r 266 -k 1+6 -K 20+7d ${DATA}/METAW00.VSAM.CUSTOMER
m_FileClrData
Name
m_FileClrData - clears a file.
Synopsis
m_FileClrData FileName
Description
m_FileClrData is used to clear a file.
Options
FileName
The name of the file to be cleared.
Example
m_FileClrData ${DATA}/PJ01DDD.BT.QSAM.KBSTO045
m_FileDelete
Name
m_FileDelete — Deletes a file.
Synopsis
m_FileDelete FileName
Description
m_FileDelete is used to delete a a file.
Options
FileName
The name of the file to be deleted.
Example
m_FileDelete ${DATA}/PJ01DDD.BT.QSAM.KBSTO045
m_FileEmpty
Name
m_FileEmpty – Checks whether a file is empty.
Synopsis
m_FileEmpty –r ReturnVariable FileName
Description
m_FileEmpty is used to check whether a file is empty.
Options
-r ReturnVariable
Returns “true” or “false”.
FileName
The name of the file to be checked.
m_FileExist
Name
m_FileExist – Checks the presence of a file.
Synopsis
m_FileExist –r ReturnVariable FileName
Description
m_FileExist is used to check whether a file is present.
Options
-r ReturnVariable
Returns “true” or “false”.
FileName
The name of the file to be checked.
m_FileLoad
Name
m_FileLoad — Loads a file.
Synopsis
m_FileLoad [-C] [-S] Infile [Infile ...] Outfile
Description
This function loads a file.
Options
-C
Number of records to copy from the Infile to the Outfile.
-S
Number of records to skip when copying from the Infile to the Outfile.
Example
m_FileLoad ${DD_SYSUT1} ${DD_SYSUT2}
 
m_FileOverride
Name
m_FileOverride — Overrides a file.
Synopsis
m_FileOverride [-d] -S label ddname dsname
Description
m_FileOverride overrides a file assignment, this assign has priority over a standard assign (m_FileAssign).
Options
See m_FileAssign for d, ddname and dsname parameters.
-S
Name of the label in the called procedure.
Example
m_FileOverride -d OLD -s PR3STEP1 SYSIN
{TMP}/SYSIN_PR3STEP1_${MT_JOB_NAME}_${MT_JOB_PID}
 
m_FileSort
Name
m_FileSort — Sorts a file.
Synopsis
m_FileSort -s SortSpecificationFile | --specification_file=SortSpecificationFile Infile [Infile ...] [Outfile]
Description
This function sorts a file.
Options
-s
The sort specification indicates either a file containing the sort specification or a file that indicates where the sort specification is to be found.
Infile
At least one file must be used as input to the sort.
Outfile
Not mandatory when the -n option is used.
m_FileRename
Name
m_FileRename – Renames a file.
Synopsis
m_FileRename OldName NewName
Description
m_FileRename is used to rename a file.
Options
NewName
The new name of the file.
OldName
The old name of the file.
m_GenCommit
Name
m_GenCommit — Commits a generation file.
Synopsis
m_GenCommit [GDG base name]
Description
m_GenCommit commits a generation file.
Options
GDG base name
Name of the generation file to commit.
m_GenDefine
Name
m_GenDefine — Defines a GDG base name.
Synopsis
m_GenDefine -s --nb_occurs <GDG base name>
Description
This function defines a GDG.
Options
-s
Number of occurrences of generation file to keep on disk.
GDG base name
The name of the GDG base for which the maximum number of generations is being defined.
Example
m_GenDefine -s 31 ${DATA}/PJ01DDD.BT.GDG.KBIDU001
m_GenRollback
Name
m_GenRollback — Rolls back a generation GDG base name.
Synopsis
m_GenRollback [GDG base name]
Description
This function rolls back a GDG base name
Options
GDG base name
Name of the generation file to rollback.
m_JclLibSet
Name
m_JclLibSet — Specify conversion stage Procedure and Include directories.
Synopsis
m_JclLibSet directory
Description
m_JclibSet specifies the directories where Procedures and Includes are stored during the conversion phase.
Options
directory
Path and name of the directory.
Example
m_JclLibSet PJ01DDD.BT.INCLUDE.SRC
m_JobBegin
Name
m_JobBegin — Used to launch a job.
Synopsis
m_JobBegin -j jobname [-c class] [-p priority] [-r restart] [-t typrun] -v version -s start_label
Description
Indicates the parameters that are used on the z/OS job card with the JES2 interface. The parameters are stored in the following files:
class is stored in the JOBID.class file
restart is stored in the JOBID.restart file
priority is stored in the JOBID.priority file
typrun is stored in the JOBID.typrun file
Options
-j jobname
The name of the job to launch.
-c class
The execution class of the job.
-p priority
The execution priority of the job.
-r restart
The name of the step to use to restart the job.
-t typrun
Indicates what should be done with the job. One of the following choices:
COPY – Copy the job directly in an output stream to sysout.
HOLD – The system should hold the job.
JCLHOLD – JES2 should hold the job.
SCAN – Scan JCL for syntax errors only.
-v version
version of the ksh script.
-s start_label
Start label — label of the first phase to be started.
Example
m_JobBegin -j PJ01DSTA -s START -v 1.0 -t SCAN
m_JobEnd
Name
m_JobEnd — Ends a job.
Synopsis
m_JobEnd
Description
This function is used to end a job.
Options
None
m_JobLibSet
Name
m_JobLibSet — Specifies where programs are stored.
Synopsis
m_JobLibSet directory [:directory[:directory…]]
Description
This function specifies at job level the directory in which programs are stored.
Options
directory [:directory[:directory…]]
Path and name of the directory containing executable programs.
m_OutputAssign
Name
m_OutputAssign — manages DD SYSOUT statements with the following parameters: CLASS, COPIES, DEST, FORMS and HOLD.
Synopsis
m_OutputAssign [-c <class>] [-n <copies>] [-d <dest>] [-f <forms>]
[-H <Y/N>] [-o <reference[,reference,..]>] [-D dsname] ddname
Options
-c <class>
Class of the output queue.
-n <copies>
Number of copies to print.
-d <dest>
Destination of the printing.
-f <forms>
Name of the used form
-H<Y/N>
Specifies whether the print must held or not.
N is the default value.
-o <reference[,reference,…]>
List of " OUTPUT " references.
-D <dsname>
Data set name.
ddname
Data Definition Name
m_OutputSet
Name
m_OutputSet — manages the "OUTPUT JCL" statement with the following parameters: CLASS, COPIES, DEST, FORMS and PRIORITY.
Synopsis
m_OutputSet [-c <class>] [-n <copies>] [-d <dest>] [-f <forms>] [-p <prty>]
[-D Y/N] Reference
Options
-c <class>
Class of the output queue.
-n <copies>
Number of copies to print.
-d <dest>
Destination of the printing.
-f <forms>
Name of the form used.
-p <priority>
Specifies the priority of the output
-D
Default reference (Y/N)
Reference
Reference name of the output.
m_PhaseBegin
Name
m_PhaseBegin — Called at the beginning of a script phase.
Synopsis
m_PhaseBegin
Description
This function is called at the beginning of a script phase.
Options
None.
m_PhaseEnd
Name
m_PhaseEnd — Called at the end of a script phase.
Synopsis
m_PhaseEnd
Description
This function is called at the end of a script phase.
Options
None.
m_ProcBegin
Name
m_ProcBegin — Begins an in-stream procedure.
Synopsis
m_ProcBegin ProcedureName
Description
An in-stream procedure is added at the end of a korn shell script (by Oracle Tuxedo Application Runtime WorkBench during the translation) and referenced by m_ProcInclude.
Options
ProcedureName
Name of the procedure to include.
Example
m_ProcBegin KBPRB007
m_ProcEnd
Name
m_ProcEnd — Ends an in-stream procedure.
Synopsis
m_ProcEnd
Description
An in-stream procedure added at the end of a korn shell script is ended by m_ProcEnd.
Options
None.
m_ProcInclude
Name
m_ProcInclude — Calls a procedure to be included in the script during the conversion phase.
Synopsis
m_ProcInclude ProcedureName
Description
Options
ProcedureName
Name of the (in-stream or catalogued) procedure to include.
Example
m_ProcInclude BPRAP001
m_ProgramExec
Name
m_ProgramExec — Executes a program.
Synopsis
m_ProgramExec [-b] [-e exit_type] Program [arguments]
Description
This function runs a COBOL program.
Options
-b
Indicates the database will be accessed by the program.
-e
Indicates an exit routine should be used, an exit routine may be a begin or an end user routine. An exit type can be indicated either BOTH, BEGIN, or END in the exit routine name: "RTEX_"exitName"_Begin" ans/or "RTEX_"exitName"_End"
Program [arguments]
User arguments to be passed to the program.
Examples
m_ProgramExec BPRAB006 "08"
Indicates to run program BPRA006 with the parameter "08"
m_ProgramExec -b BDBAB001
Indicates that the program BDBAB001 accesses the Data Base
Note:
The <"> (double quote) character is used to mark out the boundaries of the parameters
Examples:
PARM=MT5 on z/OS becomes "MT5" on target
PARM=(MT5,MT6) on z/OS becomes "MT5,MT6" on target
PARM='S=MT5' on z/OS becomes "S=MT5" on target
PARM=('S=MT5','Q=MT6') on z/OS becomes "S=MT5,Q=MT6" on target
Two successive <''> (2 simple quotes) are replaced on one <'> (1 simple quote).
PARM='5 O''CLOCK' becomes "5 O'CLOCK"
Two successive <&&> (2 ampersands) are replaced by one <&> (1 ampersnd) character.
'&&TEMP' becomes "&TEMP"
m_RcSet
m_RcSet <ARGS> ReturnCode [Message]
Name
m_RcSet — Sets the return code.
Synopsis
m_RcSet ReturnCode [Message]
Description
m_RcTest sets the return code of a function.
Options
ReturnCode
The value of the return code of the current phase.
Message
A message that may be displayed with the return code.
Examples
m_RcSet ${MT_RC_ABORT:-S999} "Unknown label : ${CURRENT_LABEL}"
m_RcSet 0
m_ShellInclude
Name
m_ShellInclude — Inserts a part of script.
Synopsis
m_ShellInclude script name
Description
This function inserts a part of script.
Options
script name
Name of the part of a script to be included in the script shell during the conversion phase.
m_StepLibSet
Name
m_StepLibSet — Specifies where programs are stored.
Synopsis
m_StepLibSet directory [:directory[:directory…]]
Description
m_SteplibSet specifies at step level where programs are stored. This information is interpreted when the program is to be executed.
Options
directory
Path and name of the directory containing executable programs.
m_SymbolDefault
Name
m_SymbolDefault — Assigns a value to a symbol.
Synopsis
m_SymbolDefault var=value
Description
Used before the call of a procedure to define default substitution texts for symbols in the procedure.
This function will be analyzed and taken into account during the conversion phase and the symbols replaced by their value in the extended script.
Options
var
Name of the variable.
Value
Value assigned to the variable.
Example
m_SymbolDefault VAR=45
m_SymbolSet
Name
m_SymbolSet — Defines a symbol.
Synopsis
m_SymbolSet var=value
Description
Defines a symbol and assigns a value before the first use of this symbol.
Options
var
Name of the variable.
Value
Value assigned to the variable.
Example
m_SymbolSet VAR=45
 

Copyright © 1994, 2017, Oracle and/or its affiliates. All rights reserved.