Datastage - dsjob command line utility with all its options

 You can start, stop, validate, and reset jobs using the –run option.

 

Running a job

dsjob –run

[ –mode [ NORMAL | RESET | VALIDATE ] ]

[ –param name=value ]

[ –warn n ]

[ –rows n ]

[ –wait ]

[ –stop ]

[ –jobstatus]

[–userstatus]

[–local]

[–opmetadata [TRUE | FALSE]]

[-disableprjhandler]

[-disablejobhandler]

[useid] project job|job_id

 

–mode specifies the type of job run. NORMAL starts a job run, RESET resets the job and VALIDATE validates the job. If  mode is not specified, a normal job run is started.

–param specifies a parameter value to pass to the job. The value is in the format name=value, where name is the parameter name, and value is the value to be set. If you use this to pass a value of an environment variable for a job (as you may do for parallel jobs), you need to quote the environment variable and its value, for example -

param '$APT_CONFIG_FILE=chris.apt' otherwise the current value of the environment variable will be used.

–warn n sets warning limits to the value specified by n (equivalent to the DSSetJobLimit function used with DSJ_LIMITWARN specified as the LimitType parameter).

–rows n sets row limits to the value specified by n (equivalent to the DSSetJobLimit function used with DSJ_LIMITROWS specified as the LimitType parameter).

–wait waits for the job to complete (equivalent to the DSWaitForJob function).

–stop terminates a running job (equivalent to the DSStopJob function).

–jobstatus waits for the job to complete, then returns an exit code derived from the job status.

–userstatus waits for the job to complete, then returns an exit code derived from the user status if that status is defined. The user status is a string, and it is converted to an integer exit code. The exit code 0 indicates that the job completed without an error, but that the user status string could not be converted. If a job returns a negative user

status value, it is interpreted as an error.

-local use this when running a DataStage job from withing a shellscript on a UNIX server. Provided the script is run in the project directory, the job will pick up the settings for any environment variables set in the script and any setting specific to the user environment.

-opmetadata use this to have the job generate operational meta data as it runs. If MetaStage, or the Process Meta Data MetaBroker, is not installed on the machine, then the option has no effect. If you specify

TRUE, operational meta data is generated, whatever the default setting for the project. If you specify FALSE, the job will not generate operational meta data, whatever the default setting for the project.

-disableprjhandler use this to disable any error message handler that has been set on a project wide basis

-disablejobhandler use this to disable any error message handler that has been set for this job

useid specify this if you intend to use a job alias (jobid) rather than ajob name (job) to identify the job.

project is the name of the project containing the job.

job is the name of the job. To run a job invocation, use the format

job.invocation_id.

job_id is an alias for the job that has been set using the dsjob –jobid command

Stopping a job

You can stop a job using the –stop option.

dsjob –stop [useid] project job|job_id

 

–stop terminates a running job (equivalent to the DSStopJobfunction).

useid specify this if you intend to use a job alias (jobid) rather than a job name (job) to identify the job.

project is the name of the project containing the job.

job is the name of the job. To stop a job invocation, use the format

job.invocation_id.

job_id is an alias for the job that has been set using the dsjob –jobid command

 

Listing Projects

The following syntax displays a list of all known projects on the server:

dsjob –lprojects

This syntax is equivalent to the DSGetProjectList function.

 

Listing Jobs

The following syntax displays a list of all jobs in the specified project:

dsjob –ljobs project

project is the name of the project containing the jobs to list. This syntax is equivalent to the DSGetProjectInfo function.

 

Listing Stages

The following syntax displays a list of all stages in a job:

dsjob –lstages [useid] project job|job_id

 

This syntax is equivalent to the DSGetJobInfo function with DSJ_STAGELIST specified as the InfoType parameter.

 

Listing Links

The following syntax displays a list of all the links to or from a stage:

dsjob –llinks [useid] project job|job_id stage

 

This syntax is equivalent to the DSGetStageInfo function with DSJ_LINKLIST specified as the InfoType parameter.

 

Listing Parameters

The following syntax display a list of all the parameters in a job and their values:

dsjob –lparams [useid] project job|job_id

 


Listing Invocations

The following syntax displays a list of the invocations of a job:

dsjob –linvocations

 

Setting an Alias for a Job

The dsjob command can be used to specify your own ID for a DataStage job. Other commands can then use that alias to refer to the job.

dsjob –jobid [my_ID] project job

my_ID is the alias you want to set for the job. If you omit my_ID, the command will return the current alias for the specified job. An alias must be unique within the project, if the alias already exists an error message is displayed

 

Displaying Job Information

The following syntax displays the available information about a specified job:

dsjob –jobinfo [useid] project job|job_id

This syntax is equivalent to the DSGetJobInfo function.

 

Displaying Stage Information

The following syntax displays all the available information about a stage:

dsjob –stageinfo [useid] project job|job_id stage

This syntax is equivalent to the DSGetStageInfo function.

 

Displaying Link Information

The following syntax displays information about a specified link to or from a stage:

dsjob –linkinfo [useid] project job|job_id stage link

This syntax is equivalent to the DSGetLinkInfo function.

 

Displaying Parameter Information

This syntax displays information about the specified parameter:

dsjob –paraminfo [useid] project job|job_id param

The following information is displayed:

􀂄 The parameter type

􀂄 The parameter value

􀂄 Help text for the parameter that was provided by the job’s designer

􀂄 Whether the value should be prompted for

􀂄 The default value that was specified by the job’s designer

􀂄 Any list of values

􀂄 The list of values provided by the job’s designer

This syntax is equivalent to the DSGetParamInfo function.

 

Adding a Log Entry

The following syntax adds an entry to the specified log file. The text for the entry is taken from standard input to the terminal, ending with Ctrl-D.

dsjob –log [ –info | –warn ] [useid] project job|job_id

–info specifies an information message. This is the default if no log

entry type is specified.

–warn specifies a warning message.

 

Displaying a Short Log Entry

The following syntax displays a summary of entries in a job log file:

dsjob –logsum [–type type] [ –max n ] [useid] project job|job_id

–type type specifies the type of log entry to retrieve. If –type type is

not specified, all the entries are retrieved. type can be one of the

following options:


INFO Information.

WARNING Warning.

FATAL Fatal error.

REJECT Rejected rows from a Transformer stage.

STARTED All control logs.

RESET Job reset.

BATCH Batch control.

ANY All entries of any type. This is the default if type is not specified.

 

–max n limits the number of entries retrieved to n.

 

Displaying a Specific Log Entry

The following syntax displays the specified entry in a job log file:

dsjob –logdetail [useid] project job|job_id entry

 

entry is the event number assigned to the entry. The first entry in the file is 0.

This syntax is equivalent to the DSGetLogEntry function.

 

Identifying the Newest Entry

The following syntax displays the ID of the newest log entry of the specified type:

dsjob –lognewest [useid] project job|job_id type

 

INFO Information.

WARNING Warning.

FATAL Fatal error.

REJECT Rejected rows from a Transformer stage.

STARTED Job started.

RESET Job reset.

BATCH Batch control.

 

This syntax is equivalent to the DSGetNewestLogId function.

 

Importing Job Executables

The dsjob command can be used to import job executables from a DSX file into a specified project. Note that this command is only available on UNIX servers.

 

dsjob –import project DSXfilename [-OVERWRITE] [-JOB[S] jobname …] |

[-LIST] project is the project to import into. DSXfilename is the DSX file containing the job executables.

-OVERWRITE specifies that any existing jobs in the project with the same name will be overwritten.

-JOB[S] jobname specifies that one or more named job executables should be imported (otherwise all the executable in the DSX file are imported).

-LIST causes DataStage to list the executables in a DSX file rather than import them.

 

Generating a Report

The dsjob command can be used to generate an XML format report containing job, stage, and link information.

dsjob –report [useid] project job|jobid [report_type]

 

report_type is one of the following:

􀂄 BASIC – Text string containing start/end time, time elapsed and status of job.

􀂄 DETAIL – As basic report, but also contains information about individual stages and links within the job.

􀂄 LIST – Text string containing full XML report.

 

By default the generated XML will not contain a <?xml-stylesheet?> processing instruction. If a stylesheet is required, specify a RetportLevel of 2 and append the name of the required stylesheet

URL, i.e., 2:styleSheetURL. This inserts a processing instruction into the generated XML of the form:

<?xml-stylesheet type=text/xsl” href=”styleSheetURL”?>

The generated report is written to stdout.

􀂄 This syntax is equivalent to the DSMakeJobReport function.DETAIL – As basic report, but also contains information about individual stages and links within the job.

􀂄 LIST – Text string containing full XML report.

Post a Comment

Previous Post Next Post

Contact Form