OS Job

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

To create an OS job, see Creating a Job.

The following table describes the OS job type attributes.

Attribute

Description

Run as

Defines the operating system account username that is authorized to execute the job.

Rules:

  • Characters: 1–30

  • Case Sensitive: Yes

  • Invalid Characters: Blank spaces and ' (apostrophes).

Type

Determines what the OS job executes, as follows:

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

  • Command: Executes 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.

  • Embedded Script: Executes 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 on Agentless Hosts.

    • If you set the variable value to GROUP using the Control-M Server System Parameter VARIABLE_INC_SEC, all folder variables are passed to the Agent during 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: 1–255

  • Case Sensitive: Yes

  • Invalid Characters: Blank spaces.

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

  • Variable Name: %%MEMLIB

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

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

  • 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 filename of the script file, for a Script and Embedded Script OS jobs.

Rules:

  • Characters: 1–64

  • Case Sensitive: Yes

  • Invalid Characters: Blank spaces, \ (backslashes), / (forward slashes), and * (asterisks).

    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 #! (hashtag and exclamation point) characters 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 #! (hashtag and exclamation point) characters 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.

  • 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:

    • UNIX: Yes

    • Windows: No

Script

Defines the script in an Embedded Script OS job.

Rules:

  • Size: 1–64,000 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"