OS Job

OS jobs are used to execute a task on a specific distributed system.

The following table describes the OS job type attributes.

Attribute

Description

Run as

Defines the Operating System account user name to execute the job.

Rules:

  • Characters: 1-30

  • Case Sensitive: Yes

  • Invalid Characters: Blanks, Single quotation marks

Type

Determines what the OS job runs, as follows:

  • Script: Runs a script as defined by File Path and File Name

  • Command: Runs an OS command line entry as defined by Command:

    • Windows: The variable prefix must be %%%% instead of %%.

    • UNIX: Commands are executed using the Bourne shell.

    • IBM i (AS/400) version 2.1.3: Use double quotation marks if needed but not single quotation marks.

  • Embedded Script: Runs a script as defined by Script and File Name

    Perl, PowerShell, VBScript, and Python languages are supported as embedded scripts, such as:

    • Use #! as the first characters in the first line of the embedded script.

    • Perl, PowerShell, VBScript, and Python languages are not supported for a Remote Host.

    • If you set the variable value to GROUP using Control-M Server System Parameter VARIABLE_INC_SEC , all folder variables are passed to the Agent at Job submission for use as environment variables in scripts and embedded scripts.

File Path

Defines the path to the script file, for a Script OS job.

Rules:

  • Characters:

    Microsoft Windows, UNIX, OpenVMS: 1-255 characters

    iSeries (AS/400): 1-10 characters

  • Case Sensitive: Yes

  • Invalid Characters: Blanks

    If the job runs on any version of Microsoft Windows 2000, prohibited file name characters, such as \, /, and *.

  • Variable Name: %%MEMLIB

  • UNIX: You can use the following symbols in place of or as part of the directory and sub-directory names:

    • $HOME: Refers to the home directory of the job owner.
    • ~<username>: Refers to the home directory of a specified UNIX user.

  • IBM i (AS/400): You can define the (device:[directory]) as the physical path.

  • z/OS: The format depends on whether the job processing definition applies to a Job or a Started Task as follows:

    • Job

      Valid values:

      • A valid data set name of 1-44 characters

      • DUMMY: Refers to dummy jobs

      • USER=name: Refers to user-defined libraries

      • GENERAL: Specifies the library referenced by DD statement DALIB in the Control-M procedure.

    • Started Task

      You can use one or more of the following formats for the Mem Lib value:

      • *. taskid: Refers to the task ID. The Started Task is activated on the Control-M monitor computer.

      • stcparms: Refers to the Started Task parameters

      • cpuid: Refers to the computer where the Started Task is activated

        Valid values:

        • *: Refers to the computer where the Control-M monitor is active.

        • Under JES2

          • Nn: Defines n as the JES/NJE host ID.

          • Mm: Defines m as the computer ID.

          • NnMm: Defines n as the JES/NJE host ID, and m as the computer ID.

        • Under JES3

          • Lname: Defines the logical JES name of the computer that is used in the JES3 command *T, not the SMF system ID.

File Name

Defines the file name of the script file, for a Script and Embedded Script OS jobs.

Rules:

  • Characters: 1-64

  • Microsoft Windows, UNIX, OpenVMS: 1-64 characters

    iSeries (AS/400): 1-21 characters

  • Case Sensitive: Yes

  • Invalid Characters: Blanks, \, /, or *

    (Blanks and / can be used when defining an OS/400 job.) Character masks are not supported (for example, a job with a FR*.EXE file name value is not executed).

  • UNIX: Defines the name of a UNIX shell script file. You must use #! as the first characters in the first line of the embedded script, such as #!/usr/bin/python. See Embedded Python script:.

  • Microsoft Windows: Defines the name of a command file or an executable file. You must use #! as the first characters in the first line of the embedded script, such as #!C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -File. See Embedded PowerShell script:.

  • Open VMS: Defines the name of the command file, in one of the following formats:

    • Without file extension: Adds the extension according to the What parameter when a file extension is not specified, such as JOBFILE:

      • .COM: Refers to a batch job

      • .EXE: Refers to a detached process. When the file name does not specify a version, the latest version of the file is executed.

    • With full file extension: Adds the extension according to when the file extension and version is specified, such as JOBFILE.COM;2 or JOBFILE.EXE;5.

  • IBM i (AS/400): Defines an executable program object.

  • z/OS: Defines the name of a member that contains the JCL of the job, the started task procedure, or the warning messages.

Command

Defines the command in a Command OS job.

Rules:

  • Characters: 1-512
  • Case Sensitive: Microsoft Windows: No, UNIX: Yes

Script

Defines the script in an Embedded Script OS job.

Rules:

  • Size: 1-64000 B

  • Case Sensitive: Yes

Embedded Python script:

Copy
#!/usr/bin/python

import sys

if (len(sys.argv) != 3):
    print "Error"
    exit (1)
    
if (sys.argv[1] != "BMC"):
    print "Error"
    exit (1)

if (sys.argv[2] != "Testing"):
    print "Error"
    exit (1)

print "Correct"
exit (0)

Embedded PowerShell script:

Copy
#!C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe  -File
If ($Args.count -lt 2) {
    Write-Host "Error"
    Exit 1
}

If ($Args[0] -cne "BMC") {
    Write-Host "Error"
    Exit 1
}

If ($Args[1] -cne "Testing") {
    Write-Host "Error"
    Exit 1
}

Write-Host "Correct"
Exit 0

Embedded VBScript:

Copy
#!C:\Windows\System32\cscript.exe
Set myArgs = WScript.Arguments.Unnamed
if myArgs.count <> 2 Then
wscript.echo "Error"
Wscript.Quit
End If

arg1 = WScript.Arguments.Item(0)
arg2 = WScript.Arguments.Item(1)

if strComp (arg1, "BMC") = 0 Then
  if strComp (arg2, "Testing") = 0 Then  
   wscript.echo "Correct"
   Wscript.Quit
  End If
End If
wscript.echo "Error"