Administrator > Systems Management

Administrator

Passing Parameters in Scheduled Jobs

Systems Management - Passing Parameters in Scheduled Jobs

Bookmark and Share Print Email

One of the many limitations with the base job scheduler provided with i5/OS* is the lack of dynamic parameters. Basically the only option you have for passing parameters is to hard code them in the Call statement or CL command within the scheduled job. It's OK to hard code some parameters, but many - such as dates - are dynamic and will be different every time the job runs. I'm a firm believer that because of this limitation many IT shops have made the decision to avoid trying to schedule jobs altogether.

Using AJS
The Advanced Job Scheduler (AJS), LPP 5722JS1 provides many options for passing dynamic parameters, and numerous features not found in the base scheduler. Parameters are used in the command list of an AJS scheduled job. The ampersand sign (&) prior to the parameter name helps AJS recognize that a replaceable parameter follows. An example of a Call statement with dynamic parameters is shown in Figure 1:

CALL MYLIB/MYPGM PARM('&EOMDATE' '&OUTQ')

In Figure 1, the parameters EOMDATE and OUTQ are user-defined. Their values will be resolved and placed in the appropriate location in the Call statement prior to processing. It's suggested to always use single quotes around the parameter if possible. Multiple parameters can be used inside one set of single quotes (see Figure 2). This would look something like:

CALL MYLIB/MYPGM PARM
('&QYY&QDATSEP&QMM&QDATESEP&QDD')

In Figure 2 (command sequence 20), the current system date is passed to the program in year, month and day format with date separators. The parameters in command sequence 20 are system parameters and are explained later. Different types of parameters are:

System parameters - Numerous system parameters are provided by the product, including dates, date separator, time and time separator. The widely used system parameters are the ones dealing with dates. These date parameters resolve to the current system date, job-submission date or the previous date. Dates can be passed in many formats. Table 1 shows a complete list of all system parameters. The following are some examples:

  • QYMD - The "Q" signifies that the date passed should be the current system date. The "YMD" signifies that the date is resolved in year, month and day format. Separators won't be included. For that you would use a combination of QYY, QDATSEP, QMM, QDATSEP and QDD.
  • AMDY - The "A" signifies that the date passed should be the date the job was submitted. This could be different from the current system date if the job was submitted before midnight but the commands for the job didn't actually process until after midnight. The "MDY" signifies that the date is resolved in month, day and year format.
  • PDMY - The "P" signifies that the date passed should be the date prior to the current system date. The "DMY" signifies that the date is resolved in day, month and year format.

Next page: >>

Page 1 2 3

Brian Younger is product manager for Pinnacle Business Systems. Brian can be reached at brian.younger@pbsnow.com.

Advertisement



Buyers Guide

Browse products and services for Administrator.







Advertisement