Last updated: Dec 09, 2024
DataStage® has a number of built-in macros. You can use these macros to track a job's metadata. These macros can be used in expressions, job control routines, and before-job and after-job subroutines.
You can select macros by opening the expression editor in DataStage and opening the list of macros.
See the following list for the available macros.
- DSFlowName
- DSHostName
- DSJobName
- DSJobStartDate
- DSJobStartTime
- DSJobStartTimestamp
- DSJobWaveNo
- DSProjectName
- DSProjectDirectory
- DSStageName
- DSProjectId
- DSJobRunId
- DSJobId
- DSJobController
- DSJobController
- Returns the job name as started the current job.
DSJobController
returns the value <parent flow name>.<parent job invocation id> if the parent pipeline has a value for DSJobInvocationId. If the parent pipeline has no value for Invocation ID, it returns the value as <parent flow name>.
The following code shows sample values for these
macros.
DSFlowName=macroTest
DSHostName=ds-px-runtime-5d5544db9c-rkn97
DSJobName=macroTest.DataStage job
DSJobStartDate=2022-11-21
DSJobStartTime=16:37:38
DSJobStartTimestamp=2022-11-21 16:37:38
DSProjectDirectory=/tmp/PXRuntime/Projects/428f037a-250b-48f0-80a7-712bc75c233d
DSProjectName=ys1dev-new
DSStageName=joincustomers
You can also use
GetEnvironment(env_name)
to retrieve the following environment
variables:- APT_JOB_ID
- APT_JOB_RUN_ID
- APT_JOB_RUN_PATH
- APT_PROJECT_ID
- HOSTNAME
The following code shows sample values for these environment
variables.
APT_JOB_ID=86f85414-bd62-4483-85b0-bb0dea964096
APT_JOB_RUN_ID=225983db-a99f-436d-b8d8-a096bf60b4b9
APT_JOB_RUN_PATH=/ds-storage/PXRuntime/Projects/7cae4661-f899-45f0-b2aa-449c7b8041cf/jobs/86f85414-bd62-4483-85b0-bb0dea964096/runs/225983db-a99f-436d-b8d8-a096bf60b4b9
APT_PROJECT_ID=7cae4661-f899-45f0-b2aa-449c7b8041cf
HOSTNAME=ds-px-default-ibm-datastage-px-runtime-85bbb6c4d8-fv54k