|
1. How do I schedule a job to run every other week?
To schedule a job to run every other Friday, complete the following:
- In System i Navigator select Work Management 'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the job and select Properties.
- Select the Schedule tab.
- Select Weekly from within Dates to run.
- Select Friday as the day of the week.
- Specify a Skip count. A skip count of one runs a job every other week.
NOTE: Skip count is not available if more than one day of the week is selected.
Back to top
2. How do I schedule a job to run on the first day of each month?
To schedule a job to run the first day of each month, complete the following:
- In System i Navigator select Work Management 'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the job and select Properties.
- Select Schedule tab.
- Select Monthly from within Dates to run.
- Select a month that has at least the first day of the month available. Days that are not available are shown as dark gray.
- Select the day one of the month. This will cause the day to become green.
- Select Specified days of each month under Details from within Dates to run.
- Click OK when finished.
Back to top
3. How do I schedule a job the 5th, 16th, and 27th day of each fiscal period?
To create a fiscal calendar, complete the following:
- In System i Navigator select Work Management.
- Right-click Advanced Job Scheduler and select Calendars.
- Select the Fiscal Calendars tab. A list of the current fiscal calendars is displayed.
- To add a new calendar, click New. This will bring up the New Fiscal Calendar dialog.
- Enter the name for the calendar you are adding. The maximum length is 10 characters.
- Enter a brief description for the calendar. This field is optional.
- Click New to add a calendar entry. A calendar entry is representative of a fiscal year.
- Enter the name of the fiscal calendar entry. The maximum length is 10 characters.
- Select each period that is going to be used.
- Enter the start and end dates for each period selected. To help in the date selection, use the pull down arrow to access a calendar.
- When you have finished entering dates for all the periods selected, click OK to add the entry.
- When you have finished entering all the entries, click OK to add the fiscal calendar.
To schedule a job to run the 5th, 16th, and 27th day of each fiscal period, complete the following:
- In System i Navigator select Work Management 'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the job and select Properties.
- Select Schedule tab.
- Select Monthly from within Dates to run.
- Select a month that has the 5th day available. Days that are not available are shown as dark gray.
- Select days 5, 16 and 27. This will cause the days to become green.
- Select Specified days of each month under Details from within Dates to run.
- Click Additional Calendars…
- Specify the user-defined name of the fiscal calendar or click the Browse button and select from the list.
- Select 1-12 within the list of fiscal periods.
- Click OK when finished.
Back to top
4. How do I schedule a job the last working day of each fiscal quarter?
To create a fiscal calendar, complete the following:
- In System i Navigator select Work Management.
- Right-click Advanced Job Scheduler and select Calendars.
- Select the Fiscal Calendars tab. A list of the current fiscal calendars is displayed.
- To add a new calendar, click New. This will bring up the New Fiscal Calendar dialog.
- Enter the name for the calendar you are adding. The maximum length is 10 characters.
- Enter a brief description for the calendar. This field is optional.
- Click New to add a calendar entry. A calendar entry is representative of a fiscal year.
- Enter the name of the fiscal calendar entry. The maximum length is 10 characters.
- Select each period that is going to be used.
- Enter the start and end dates for each period selected. To help in the date selection, use the pull down arrow to access a calendar. For this scenario, the start date would be the first day of the month that corresponds with the period and the last date would be the last day of the month.
- When you have finished entering dates for all the periods selected, click OK to add the entry.
- When you have finished entering all the entries, click OK to add the fiscal calendar.
To schedule a job to run the last working day of each fiscal quarter, complete the following:
- In System i Navigator select Work Management 'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the job and select Properties.
- Select Schedule tab.
- Select Monthly from within Dates to run.
- Select a month that has at least the last 7 days of the month available. Days that are not available are shown as dark gray.
- Select the last day of the month that is also a working day. This will cause the day to become green.
- Select Last working day of each month under Details from within Dates to run.
- Click Additional Calendars…
- Specify the user-defined name of the fiscal calendar or click the Browse button and select from the list.
- Select 3, 6, 9, and 12 within the list of fiscal periods.
- Click OK when finished.
Back to top
5. How do I schedule a job to run every 30 minutes between 8:00 a.m. and 5:00 p.m.?
From the Schedule tab of the job properties select the Periodically option under Times to run. Enter 30 as the Frequency and click the Minutes option. You will also need to specify 8:00 AM as the Start time and 5:00 PM as the End time.
Back to top
6. How do I schedule monthly processing on the last Friday of the month to run after the weekly processing?
You may have a job flow where monthly processing jobs are to run after weekly processing. You may even have more weekly jobs to run after the monthly jobs. Provided are two examples to accomplish this type of job flow.
Example 1:
For this example there will be a group named EOW (end of week) with five jobs that make up the weekly processing and a group named EOM (end of month) with three jobs that make up the monthly processing. The EOW group is scheduled to run every Friday at 10:00 p.m. Schedule the EOM job group some time after 10:00 p.m. the last Friday of the month.
To create a job group, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler.
- Right-click the Job Groups and select New Job Group.
- Specify EOM as the Name.
- Specify a description.
- Select Schedule.
- Select Monthly from within Dates to run.
- Select a month that has the last Friday of the month available. Days that are not available are shown as dark gray.
- Click the last Friday. This will cause the day to become green.
- Select the Last Friday of each month option under Details from within Dates to run.
- Click OK to save your changes.
Active dependencies will not allow the EOM job group to start if any of the EOW job group jobs are active or on the job queue.
To add active dependencies for the first job in the EOM job group for all the jobs in the EOW job group, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the first job in the EOM job group and selecting Active Dependencies.
- Edit the list of jobs that cannot be active when the job is ready to run.
- Click OK when finished.
Example 2:
For this example there will two weekly jobs named WKLY1 and WKLY2 and a monthly job named MTHLY. The weekly jobs start every Friday night at 10:00 p.m. WKLY1 must complete before WKLY2 can run. On the last Friday of the month, MTHLY is scheduled to run some time after 10:00 p.m. Job dependencies have been specified to run MTHLY after WKLY1 completes but before WKLY2. The WKLY1 job is set up in the Job Dependencies as a predecessor to MTHLY and MTHLY is a predecessor to WKLY2. To skip the MTHLY job on the Fridays that are not the last Friday of the month, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the MTHLY job and select Job dependencies.
- Select the Edit button at the bottom.
- Select the WKLY2 job from the list of Successors and select Properties.
- Specify 60 minutes for the Skip threshold (minutes) field. This is the amount of time in minutes that determines whether to skip Predecessor jobs that are scheduled. For instance, if the threshold is set to 60 minutes and the predecessor job is scheduled to run more than 60 minutes in the future it will skip the job and go on to the next dependent job.
- Click OK to save your changes.
- Click Close when finished.
Back to top
7. How do I set up a job that runs every Friday to not run on the fifth Friday for those months that have 5 Fridays?
To have a job run every Friday except on the fifth Friday, you will need to create a new schedule, a holiday calendar and a scheduled job.
To create the schedule for the fifth Friday of each month, complete the following:
- In System i Navigator select Work Management.
- Right-click Advanced Job Scheduler and select Properties.
- Select Schedules and click New.
- Specify LASTFRI as the Name.
- Specify a description.
- In the Dates to run box, select Monthly as the Frequency.
- Using the arrows next to the month name above the calendar, find a month that has 5 Fridays.
- Click the fifth Friday in the calendar so that it is highlighted green. Notice that there are several choices for Details in the Dates to run box.
- Select the Fifth Friday of each month button.
- Click OK to create the new schedule.
To create the holiday calendar that will use the schedule just created, complete the following:
- Select the Holiday Calendars page and click New.
- Specify LASTFRI as the Name.
- Specify a description.
- Select the Schedules button in the bottom left hand corner of the dialog.
- Select LASTFRI schedule in the list of Available Schedules.
- Click Add to add to the list of Selected Schedules.
- Click OK to return.
- Click OK to create the holiday calendar.
- Click OK again to exit the main Properties for Advanced Job Scheduler.
To create a scheduled job to run every Friday except on the fifth Friday for those months that have 5 Fridays complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler.
- Right-click Scheduled Jobs and select New Scheduled Job from the menu.
- Specify a job name.
- Specify a description.
- Select the Schedule page.
- Specify the appropriate time under Times to run and click Add.
- Select the Weekly radio button as the Frequency under Dates to run. All of the days of the week will be listed under Details. Check the Friday box.
- Add a Holiday Calendar to exclude the fifth Friday of the month. Select the Additional Calendars button under the calendar.
- Specify the LASTFRI holiday calendar in the Holiday calendar field and click OK to return.
- Click OK to create the scheduled job.
Note: Predefined Schedules are new to V5R2M0.
Predefined Schedules are new to V5R2M0.
Back to top
8. How do I specify not to run a job after December 31, 2008?
You would specify 12/31/08 (expressed in mm/dd/yy format) in the Ending date portion of the date range found below the calendar on the Schedule tab of the job properties.
Back to top
9. How do I schedule a job to run on a remote system?
To schedule a job to run on a remote system, complete the following steps:
Step 1: Identify remote systems.
You will need to identify the IP addresses for the remote systems using the Display Network Attributes (DSPNETA) command on each system. Each system will have a local location name and network ID associated with the IP address.
Step 2: Add IP addresses.
To add the IP address, complete the following:
- In System i Navigator select Work Management
- Right-click Advanced Job Scheduler and select Properties.
- Select the Systems and Groups tab, formerly the IP Addresses tab. Existing systems and groups for Advanced Job Scheduler are listed.
- Click New.
- Select Single system as the system type and click OK.
- Enter the following information: System name and Network ID, IP address, Description and select the Communication type. The system name and network identifier are used in the definition of a scheduled job to determine the IP address of the remote system the job is to run on.
- Click OK when you are finished. Your new entry is added, and you are returned to the Systems and Groups tab.
Step 3: Add the source system's information.
Using the statements in Step 2, add the source system's information on each of the remote systems.
Step 4: Change the job.
To change a job definition to run on a remote system complete the following:
- In System i Navigator select Work Management 'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the job and select Properties.
- Select Batch Information.
- Specify the location name of the remote system in the System to run job field. The full format is nnnn.cccc, where nnnn is the network ID and cccc is the local location name. When the job runs, it will access the IP addresses based on the local location name and network ID specified. Or you can use the browse button to select a remote system.
- Click OK to save your changes.
Back to top
10. How do I run a job if a job ends abnormally?
Jobs that run due to the abnormal end of a scheduled job are known as alternate jobs and are one form of dependent jobs. An alternate job must exist before it can be referenced as an alternate job. To designate a job as an alternate, access the General tab of the job properties and select the Alternate option under Type of job. You will notice that the Schedule tab is no longer accessible. Alternate jobs cannot have a schedule and cannot reference an alternate job. To reference the alternate job from a scheduled job, access the Problem Recovery tab of the job properties. Select Use an alternate job if job fails and specify the alternate job or select it from a list using the Browse button. The alternate job could notify the operator, send a message to QSYSOPR, copy files from QTEMP, and so on.
Note: A single alternate job can be specified as the alternate job for multiple jobs if the actions are the same.
Back to top
11. How do I specify not to run a job after an IPL even though it was scheduled to run during the time the system was down?
From the Problem Recovery tab of the job properties, specify Do not start as the Action if job cannot start when scheduled.
Other actions are Start, which specifies to submit the job in a released state, and Start and hold in job queue, which specifies to submit the job in a held state. Those jobs submitted in a held state will stay on the submitted job queue until action is taken to release the job.
Back to top
12. How do I set up a scheduled job so that the job date will always be the date the job was scheduled?
There are times when a job is scheduled and submitted before midnight but does not start running until after midnight. This causes the job date to be the next day. To set up the job to automatically set the job date to the date the job was scheduled complete the following:
- In System i Navigator select Work Management.
- Right-click Advanced Job Scheduler and select Properties.
- Select the General page.
- Change the Start time of day field to 6:00 am.
- Click OK to save the changes.
- Select Scheduled Jobs.
- Right-click the job and select Properties.
- From the General page, check the Use start time of day box at the bottom. This will change the job date of the submitted job to be the previous day if the time the job starts is prior to the Start Time of Day specified in the Advanced Job Scheduler for i5/OS Properties.
- Click OK to save your changes.
Back to top
13. How do I set up the Advanced Job Scheduler to automatically default the user profile field of a new job (USER) to the user that is creating the job?
The User profile (USER) field within the system Job Controls or the Job Controls associated with an application is used to determine whether to set the user profile of the new job to the user that is creating the job.
To change the Job Controls, complete the following:
- In System i Navigator select Work Management.
- Right-click Advanced Job Scheduler and select Properties.
- Select the Job Controls/Applications page.
- If the job you are adding will be using an application, select the matching entry and click Properties, otherwise select the System default entry and click Properties.
- From the Batch Information page, drop down the list of choices for User and select Store the current user.
- When finished click OK.
Note: This can also be done for Message queue.
Back to top
14. How do I run System/36 procedures?
The Start System/36 Procedure (STRS36PRC) command is used to run a System/36 procedure. An example is:
- STRS36PRC PRC(PAYPROC)
- STRS36PRC PRC(ENDDAY) CURLIB(ORDLIB) PARM('010198')
- When running System/36 procedures, the Advanced Job Scheduler completion code must be set by inserting a Advanced Job Scheduler program at the end of each procedure processed by Advanced Job Scheduler. This program is necessary to communicate successful versus unsuccessful System/36 job completions to Advanced Job Scheduler for proper historical reporting and alternate job processing.
- Each individual procedure run under Advanced Job Scheduler must contain the program QIJSCS36 as the last statement in the procedure. If the program is not in the procedure or if the program is not called at the end of the procedure, the job will end abnormally.
- The following is an example of a single procedure, NIGHTLY1, which runs all nightly reports:
- NIGHTLY1 procedure
...source statement
...source statement
CALL QIJS/QIJSCS36 PARM(*YES)
- If a System/36 procedure is run as a procedure within another procedure, each individual procedure must be followed by a call to QIJSCS36 program as follows:
- WEEKLY procedure
(RUN NIGHTLY REPORTS AND BACKUPS PLUS ALL WEEKLY REPORTS)
.source statement
.source statement
Run the NIGHTLY1 procedure
CALL QIJS/QIJSCS36 PARM(*NO) <===resets individual procedure completion for processing remaining procedures
.source statement
.source statement
Run the NIGHTLY2 procedure
CALL QIJS/QIJSCS36 PARM(*NO) <===resets individual procedure completion for processing remaining procedures
.source statement
.source statement
Run the WEEKLY1 procedure <===call to QIJSCS36 *NO is not necessary since it is not run as a single procedure elsewhere
.source statement
.source statement
Run the WEEKLY2 procedure <===call to QIJSCS36 *NO is not necessary since it is not run as a single procedure elsewhere
.source statement
.source statement
CALL QIJS/QIJSCS36 PARM(*YES) <===signals successful completion
Back to top
15. How do I find the progress for a submitted job?
You can use the Set Step using Job Scheduler (SETSTPJS) command in your CL programs to keep track of a job's progress. Specify the command, along with a description, as many times as necessary in your program. The text description that is associated with the command is displayed in the Command step field on the Last Run page of the scheduled job properties. In addition, you can view the Command step field on the Status dialog of a scheduled activity entry. The Command step field is automatically updated every time the job encounters the Set Step using Job Scheduler (SETSTPJS) command. The progress for a submitted job is displayed on the Last Run page of the scheduled job properties or Status dialog of a scheduled activity entry.
Back to top
16. How do I automatically omit the next run of a job?
You can automate the omission of a job that is scheduled to run by processing the following CL program from within a user program or from a Advanced Job Scheduler job. The program (QIJSCON) is included in the QIJS library.
- There are three required parameters that you must use in the program to automatically omit the next run of a job. You must specify all three parameters, even if the parameter is filled with blanks. They are:
- JOB - 10 characters
- GROUP - 10 characters, blanks or *NONE
- GRPSEQ - 2 characters, blanks allowed
- An example of the use of this program follows:
- CALL QIJS/QIJSCON PARM('ENDWEEK ' '*NONE' '00')
- where: ENDWEEK is the job to omit, *NONE is the group (in this case the job is not in a group), and the group sequence is 00 or blanks.
- Messages that you could receive as a result of running QIJSCON for the ENDWEEK job include:
- "Next run of job ENDWEEK omitted"
- "Job ENDWEEK not found"
- "Job ENDWEEK cannot omit next run. Reason is the job status indicates that the job is on the job queue or in process"
Back to top
17. How do I know if a job does not start running after it's submitted?
You can specify whether to send a notification message if a job does not start within a certain time limit. Specify the Recipient and Limit on the Notification page. The Recipient is a user-defined list of e-mail addresses that will receive notification that the job did not start within the time limit. The Limit is the amount of time in minutes (1-999) that the job should start after it has been submitted before a message is sent.
Back to top
18. How do I know if a job is waiting on a reply to an error message?
You can specify whether to send a notification message if a job is waiting on a reply to an error message or if an error causes the job to complete abnormally. Specify the Recipient and Message on the Notification page. The Recipient is a user-defined list of e-mail addresses that will receive notification that the job received an error. The recipient would recieve one of the following messages:
- The text of the error message.
- The joblog of the job will be embedded in the body of the message.
- The user-defined text which is entered in the Message field.
Back to top
19. How do I bypass a command in a scheduled job?
There may be a situation where you need to bypass a command for a period of time for a scheduled job but you do not want to remove it from the list. From the General tab for the properties of a scheduled job, you can de-select the Enabled check box next to the command. This will cause the command to be bypassed the next time the job is run.
Back to top
20. How do I set monitor for messages for commands in the command list?
On the General tab of the job properties, select the command you want to add messages to monitor and click Properties to the right of the Command box. From the Command Properties dialog click Messages. Enter the message ID and click Add. This will add the message to the Enabled Messages list. When you are done adding all the messages, click OK.
Back to top
21. How do I process commands on non-System i platforms?
Commands can run on non-System i platforms like PCs. They can be processed on a single system or a group of systems. When processing commands on a group of systems, each command must complete normally on each system within the group before the next command is processed. The Run Remote Command (RUNRMTCMD) command is being used to issue the commands on the remote systems. The RUNRMTCMD command allows server users to run a command on a remote system that is running the target portion of this function. The target portion of this function can be a remote executing daemon (rexecd). The Incoming Remote Command (IRC) service of the IBM System i Access for Windows is recommended on the remote systems to process the commands.
In order to take advantage of this feature, it will be helpful to run through a quick test outside of the Advanced Job Scheduler. Here are some things you need to know:
- The first thing you should do is get the remote system ready to receive commands by setting up the rexecd. Refer to the Information Center regarding the IRC service. There are many choices to make concerning the amount of security you will need to allow commands to be processed on the remote computer. Follow these steps for a quick test to process commands on a computer running Windows requiring virtually no security:
- IBM System i Access for Windows must be installed on the computer.
- From the IBM System i Access for Windows list of options choose System i Access for Windows Properties. Select the Incoming Remote Command tab. The following values for the IRC parameters will allow your system to accept commands with no authorization. After becoming familiar with the IRC you can add any necessary security authorization.
- Command mode: Detached
- Cache security: Not checked
- Allow generic security: Checked
- Generic security runs command as logged-on user: Checked
- Run as system: Checked
- Load user profile when command run in user context: Not checked
- You must manually start the IRC service. From the Control Panel, select Services from within Administrative Tools, right-click System i Access for Windows Remote Control and select Start. The IRC service can be changed to automatically start each time the PC is started.
- Locate the IP address of the remote computer. The IPCONFIG command can be used at the command prompt.
- On a command line from the System i, prompt the RUNRMTCMD using F4. Enter the following information:
- Command: calc.exe
- Remote location name: IP address of PC
- Remote location type: *IP
- Even though we have set up the IRC not to require a user ID and password, they still may be required by the PC. You should try it first without a user ID and password and if that fails you should try it with a user ID and password. If you try it with a user ID and password, it should be the same as the one that is logged onto the PC.
- Run the RUNRMTCMD. If it fails, there is a spooled file that is generated that can be used to determine the problem. If you see the calculator on the screen of the PC, then it worked.
To set up AJS to run remote commands on a non-System i system you will need to add the PC to the list of systems and create a scheduled job to run the remote command.
To add the PC to the list of systems, follow these steps:
- Open a single system under My Connections from your System i Navigator window.
- Open Work Management folder.
- Right-click Advanced Job Scheduler and select Properties.
- On the Systems and Groups tab use the New button to add a new system.
- From the dropdown, select Windows and click OK.
- Enter a system name. This is the name that represents your PC.
- Enter a brief description of the system.
- Enter the IP address of the PC.
- Enter a user ID and password if necessary. These should match the test you performed earlier when testing the RUNRMTCMD command on a command line.
- Click OK when finished.
- Click Cancel to close the AJS properties tabs.
To add a scheduled job, follow these steps:
- Open a single system under My Connections from your System i Navigator window.
- Open Work Management from your System i Navigator window.
- Expand Advanced Job Scheduler.
- Right-click Scheduled Jobs and select New Scheduled Job.
- Enter a job name and select Non-scheduled as the Type of job. We are not going to schedule the job since this is just a test.
- Below the Commands list box, check the Run as remote command box. This lets the scheduler know not to validity check the commands entered.
- Click Add to add a command to the list.
- Enter calc.exe as the command and click OK.
- Select the Batch Information tab.
- Click the Browse button for System to run job and select the PC from the list. Click OK to add the system.
- Click OK to add the job.
- Click the Scheduled Jobs folder to list the jobs. Right-click the new job and select Run.
- Click OK to run the job now. If the test is successful, a calculator will be on the screen of the PC running the rexecd.
Back to top
22. How do I remove the scheduled date and time from a held job?
The Reset held jobs check box is used to determine if held jobs should have a next schedule date and time even though they are held. In the past, held jobs had a scheduled date and time. When the scheduled date and time had been reached it would be logged that the job did not run because it was held. Then the job was updated with the next scheduled date and time. This meant that the job monitor may wake up more often than necessary. If the Reset held jobs is not checked, held jobs will not contain a scheduled date and time. To access the Reset held jobs check box, right-click the Scheduled Jobs folder and select Properties.
NOTE: Removing the check from the check box will affect held jobs the next time they reach their scheduled date and time. Checking the check box will not affect held jobs that currently do not have a scheduled date and time.
Back to top
23. How do I keep from resetting the scheduled date of a job even though the schedule didn't change?
In the past, clicking the OK button after displaying the properties of a scheduled job would result in the schedule date and time being reset (re-calculated) even though the schedule had not be changed. And possibly nothing changed. Now if the Reset after change check box is not checked, the schedule of a job has to change before the job's scheduled date and time is reset. To access the Reset after change check box, right-click the Scheduled Jobs folder and select Properties.
Back to top
24. How do I start a job group based on a day of the week other than today?
By using the Start Group using JS (STRGRPJS) command, you can specify the day of the week this group should be based on. For instance, if *MON is specified, the only group jobs that will run after the initial job will be those that contain Monday in the list of days of the week to process.
NOTE: The STRGRPJS command is also used as option 11 from the Work with Jobs using JS (WRKJOBJS) command. This feature is also available in the Graphical User Interface.
Back to top
25. How do I run jobs JOBB and JOBC to run after JOBA completes.?
The first thing you would need to do is create your jobs. In many cases, JOBA will contain a schedule but JOBB and JOBC will not. They are dependent on JOBA finishing. The next thing you should do is set up the dependencies.
To set up the dependencies, right-click the JOBA job from the list of scheduled jobs and select Job dependencies from the context menu. Displayed is a list of jobs that must run first (predecessors) before JOBA can run and those that are dependent on JOBA running (successors) before they can be submitted. Select the Edit button. In this example, we know that we want JOBB and JOBC to run after JOBA; therefore, we will be adding these jobs to the Successor job list. From the list of scheduled jobs click the JOBB job and then select the Add button associated with the Successor jobs. Do the same for JOBC. Click OK when finished.
Back to top
26. How do I set up a dependency on the last job that runs in a group?
You can have a job group set up so that the last job that runs on Monday may be JOBY, but the last job that runs on Friday may be JOBZ. To create a job dependency based on the last job that runs in the group complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the job that is to run after the group and select Job Dependencies.
- Click the Edit button.
- In the list of Scheduled Jobs you should see an entry "Last job in your-group" where your-group is the name of your job group. Select that entry and click the top Add button. This will add the entry to the list of Predecessors.
- Click OK to save your changes.
- Click Close to close the Job Dependencies page.
If you are using the character-based interface, specify *LAST as the job name along with the group name and no group sequence number as the predecessor when adding the predecessor/successor relationship for the dependency.
Back to top
27. How do I set up a network dependency?
Suppose there are three jobs -- JOBA, JOBB, and JOBC -- and two systems in the network -- SYSA and SYSB. you want JOBC to run as a successor job after JOBA and JOBB. JOBA and JOBC run on SYSA and JOBB runs on SYSB. You would add all 3 jobs on SYSA. When you add JOBC, you would add it as a non-scheduled job. From the General tab of the job properties select the Non-scheduled radio button under Type of job. When you add JOBB, you would specify SYSB as the System to run job on the Batch information tab of the job properties.
To set up the dependencies, right-click the JOBC job from the list of scheduled jobs and select Job dependencies from the context menu. Displayed is a list of jobs that must run first (predecessors) before JOBC can run and those that are dependent on JOBC running (successors) before they can be submitted. Select the Edit button. In this example, we know that we want JOBA and JOBB to run before JOBC; therefore, we will be adding these jobs to the Predecessor job list. From the list of scheduled jobs click the JOBA job and then select the Add button associated with the predecessor jobs. Do the same for JOBB.
Back to top
28. How do I pass parameters to a program?
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. Here is an example of a Call statement with dynamic parameters:
CALL MYLIB/MYPGM PARM('&EOMDATE' '&OUTQ')
In the example, 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. This would look something like:
CALL MYLIB/MYPGM PARM ('&QYY&QDATSEP&QMM&QDATESEP&QDD')
In this example, the current system date is passed to the program in year, month and day format with date separators. These parameters are system parameters.
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. 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.
Another useful type of parameter is user defined parameters that use a date formula to calculate special dates. For instance, for a parameter to always resolve to the last day of the current month in year, month and day format the formula would look like: *QYMD(m+1,d=1,d-1). The "*Q" specifies to start with the current system date. An "*A" would specify to start with the job-submission date. The "YMD" specifies to return the date in year, month and day format. The date calculation is found within the parenthesis. In this example it would first add one to the month (m+1). If today is Nov. 5, 2008, the first part of the calculation would change it to Dec. 5, 2008. Next it will change the day to the 1st (d=1). Finally it will subtract one day (d-1). The result would be Nov. 30, 2008 (081130). To pass a date in a format that doesn't exist in the system parameters, you could create a parameter with a formula similar to *QYYMD(d+0).
Back to top
29. How do I pass a special date to a program?
A useful type of parameter is user defined parameters that use a date formula to calculate special dates. For instance, for a parameter to always resolve to the last day of the current month in year, month and day format the formula would look like: *QYMD(m+1,d=1,d-1). The "*Q" specifies to start with the current system date. An "*A" would specify to start with the job-submission date. The "YMD" specifies to return the date in year, month and day format. The date calculation is found within the parenthesis. In this example it would first add one to the month (m+1). If today is Nov. 5, 2008, the first part of the calculation would change it to Dec. 5, 2008. Next it will change the day to the 1st (d=1). Finally it will subtract one day (d-1). The result would be Nov. 30, 2008 (081130). To pass a date in a format that doesn't exist in the system parameters, you could create a parameter with a formula similar to *QYYMD(d+0).
Back to top
30. How do I pass the current date in *ISO format to a program?
The *ISO format is not included in the list of System Parameters. To pass a date in a format that doesn't exist in the list of System Parameters, you could create a parameter with a formula similar to *ISO(d+0).
Back to top
31. How do I pass numeric parameters to a program?
This example deals with passing a 6-digit number (123456) to a program expecting the parameter to be numeric.
- CALL EXC100 PARM(X'0123456F')
- In this example the number is represented in hexadecimal and the F is the signed bit. The extra zero at the beginning of the number is needed to make the hexadecimal representation an even number of bits.
Back to top
32. How do I automatically change the parameter data for a parameter that should always contain the last day of the previous month?
In this example, you will use a user-defined parameter (Previous date - PRVDATE) that contains the last day of the previous month. You will set up a job to run on the first day of every month. On the Schedule page of the job properties, select Monthly from within Dates to run. Select a month that has the first day available. Days that are not available are shown as dark gray. Click Day 1. This will cause the day to become green. Select the Specified days of each month option under Details from within Dates to run. The command to process for the job would be as follows:
- CHGDTAJS PARM(PRVDATE) PARMDATA('&PYMD')
- NOTE: The PYMD parameter specified within this command will be converted to the previous date in year month day format. Now all jobs that use the PRVDATE parameter will receive the last day of the previous month in year month day format.
Another way would be to create a user-defined parameter that uses a formula to calculate the last day of the previous month. To create the parameter complete the following:
- In System i Navigator select Work Management.
- Right-click Advanced Job Scheduler and select Properties. Advanced Job Scheduler Properties displays.
- Select Command Variables. A list of the current command variables is displayed.
- Click New to go to the New Command Variable display.
- Specify the name of the new command variable.
- Specify 6 as the replacement length.
- Select the Use Formula button.
- Specify *QYMD(d=1,d-1) as the formula. The Q in the formula means to start with the system date as a base. If an A was used (*AYMD(d=1,d-1), it would use the submit date as the base. The YMD means to return the date in year, month, and day format. The d=1 sets the date to the first day of the month and the d-1 subtracts 1 from the date giving the last day of the previous month.
- When you are finished specifying all the pertinent information, click OK to add the command variable to the list of existing variables.
Back to top
33. How do I set up Advanced Job Scheduler for e-mail notification?
To use the notification function of Advanced Job Scheduler, you need to specify an SMTP mail server. The mail server is used to send e-mail notifications.
To specify e-mail notification information, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler.
- Right-click Notification and select Properties.
- Specify how many days to store messages in the Message retention field.
- Specify an Outgoing mail server (SMTP). For example: SMTP.yourserver.com.
- Specify a Port. The default port number is 25.
- Specify an e-mail address in the Reply address field. All reply messages are sent to this address.
- Select Yes or No in the Log send activity field, depending on whether or not you want log send activity in the Advanced Job Scheduler log. Send activity is used for problem determination.
- Click OK to save the notification properties.
Back to top
34. How do I resend an e-mail message?
To resend an e-mail message, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Notification'E-mail.
- Select Sent to list e-mail messages in the right-pane.
- Right-click the message to resend and select New Based On
- Click OK to send the e-mail message.
Back to top
35. How do I attach a partial spooled file to an e-mail message?
There are two ways to attach a partial spooled file to an email message.
- Send specific pages of a spooled file based on text found in the spooled file. For instance, all pages that contained "OKLA DIV" at line 3 starting in position 22 would be sent as an attachment.
- Send specific pages of a spooled file based on a from and to page range.
NOTE: Sending partial spooled files can be done when sending a spooled file manually or automatically in Report Distribution.
Back to top
36. How do I automatically send an existing e-mail to another recipient if there has been no response to the original?
An escalation list can be used to forward the e-mail message to another recipient after a specific amount of time. An escalation list is a group of recipients to whom a message will escalate with the passage of time. An escalation list takes effect after the recipient to whom the message was sent originally does not respond before the number of minutes specified in the Delay Time field. Recipients in each list are ordered in the sequence that you want them to receive the message. A delay time is assigned between recipients to allow a recipient in the escalation list to respond to the message. After a recipient responds to the message by stopping the message in the list of Sent messages, the escalation process ends. The escalation list can be assigned to a recipient or can be specified when sending an e-mail message.
To create an escalation list complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Notification'E-mail.
- Right-click Escalation Lists and select New Escalation List.
- Specify the name of the new list.
- Specify a description for the new list.
- Select the Delay time for the escalation list. This is the number of minutes the Advanced Job Scheduler will wait before escalating a message to the next recipient in the list.
- Specify whether or not you want to repeat a message's escalation if no one in the list stops the message.
- Select the recipients you want to add to the list. To add a recipient, highlight the recipient and click Add. To remove a recipient, highlight the recipient in the Selected Recipients list and click Remove. To rearrange the recipients in the Selected Recipients list, highlight a recipient and click Move Up or Move Down to move the recipient.
- After you specify all the information for the escalation list, click OK to add the list.
Back to top
37. How do I list e-mail messages that are escalating?
To list all e-mail messages that are scheduled to escalate, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Notification'E-mail.
- Select Sent to list e-mail messages in the right-pane.
- Use the F11 function key to display the E-mail Messages - Include dialog box.
- Drop down the list of choices for the Type field and select Escalating.
- Click OK to save your changes. Messages that are scheduled to escalate should be listed.
Note: Include information is saved and will be used the next time e-mail messages are displayed.
Back to top
38. How do I stop an e-mail message from escalating to the next recipient?
To stop an e-mail message from escalating to the next recipient, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Notification'E-mail.
- Select Sent to list e-mail messages in the right-pane.
- Right-click the message that is scheduled to escalate and select Stop Escalation.
Back to top
39. How do I attach a spooled file to an e-mail message without using Report Distribution?
To attach a spooled file to an e-mail, complete the following:
- In System i Navigator select Basic Operations.
- Select Printer Output to list spooled files.
- Right-click the spooled file and select Send via AJS.
- Specify one or more recipients, one or more e-mail addresses or specify details based on the contents of the spooled file and other message information.
- Click OK to send the e-mail message and spooled file.
Back to top
40. How do I distribute reports for Advanced Job Scheduler jobs?
Specify a Report distribution list on the General page of the job properties or select an option from the list. When the job runs, it will list all spooled files produced by the job and determine which ones to distribute and the recipients to receive a copy of the spooled file. Spooled files can be duplicated into output queues or sent by e-mail as an attachment. To distribute reports for a job that has finished, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Scheduled Job Activity.
- Right-click the job and select Distribute reports.
- Specify a Report Distribution List or select one from the list.
- Click OK to distribute the reports for the job.
Back to top
41. How do I distribute reports for a non-Advanced Job Scheduler job?
Spooled files can be distributed for a specified job through the Send Reports using Job Scheduler (SNDRPTJS) command. This command can be processed on any command line or accessed through option 1 of the Reports Distribution menu. This command can be used outside of Advanced Job Scheduler in a user's control language program for distributing reports specified in the report distribution ID to the specified users (recipients). Also, to distribute reports for a job that has finished, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Scheduled Job Activity.
- Right-click the job and select Distribute reports.
- Specify a Report Distribution List or select one from the list.
- Click OK to distribute the reports for the job.
Back to top
42. How do I set up Report Distribution to e-mail individual invoices to the appropriate address from a single spooled file?
A Report Distribution List can be set up to e-mail pages of a spooled file to addresses based on information found within the spooled file. For instance, an account number found in the spooled file could be used to retrieve its e-mail address. An exit program would be used to accept the account number as a parameter and return its e-mail address. AJS can also use e-mail addresses found in the spooled file. AJS just needs to know where this information is located.
To create a Report Distribution List, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Notification.
- Right-click Report Distribution and select New List.
- Specify a name for the Report Distribution List
- Specify a description.
- Click New to add a new spooled file entry. In the example, the job that creates the invoices only produces one spooled file. You do not need to specify a spooled file name, program, or User-specified data.
- Select the Recipients page.
- In the example, recipients are not required. Select Send to address based on spooled file.
- Specify the Line number position where the account number is found in the spooled file. When calculating the line number, only include lines that contain text.
- Specify the Starting position of the account number.
- Specify the Length of the account number.
- Specify the Program to call. AJS will use the program to retrieve the e-mail address based on the value extracted from the spooled file. This user written program must have two parameters. The first is a 60-byte character parameter. When called, it will contain the value extracted from the spooled file based on the Line number position, Starting position, and Length. The second is a 256-byte character parameter. It should return the e-mail address to use when sending that page of the spooled file. It should return blanks if no e-mail address is found.
- Select the E-mail Message page to specify a subject, e-mail message, and the name of the attachment.
- Click OK to add the spooled file entry.
- Click OK to add the distribution list.
To specify the Report distribution list in a scheduled job, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Scheduled Jobs.
- Right-click the job and select Properties.
- At the bottom of the General page specify the Report distribution list.
- Click OK to save your changes.
Back to top
43. How do I specify spooled file information in the subject or message of an email?
Several replacement variables have been added to the subject and message of an email in regards to the spooled file that is being distributed. The value of the variable is replaced when the email is produced. These variables will only be replaced during Report Distribution. Following is a list of replacement variables with an explanation of the value that will be replaced:
| Variable |
Value passed |
| &QJOB |
The job that created the spooled file in job number/user/job name format. |
| &JOB |
The name of the job that created the spooled file. |
| &USER |
The name of the user who produced the spooled file. |
| &NBR |
The number of the job in the system that created the spooled file. |
| &PGM |
The name of the program that produced the spooled file. |
| &OUTQ |
The name of the output queue where the spooled file was created. |
| &USRDTA |
The 10 character User Data field. This is not the User Defined Data field. |
| &CRTDATE |
The date the spooled was created in system date format with separators. |
| &CRTTIME |
The time the spooled was created in HH:MM:SS format. |
| &SPLF |
The name of the spooled file. |
| &SPLFNBR |
The spooled file number. |
Back to top
44. How do I turn off the report distribution report?
The Report Distribution report provides a summary of the Report distribution process. Use the following steps to turn the report off:
- In System i Navigator select Work Management'Advanced Job Scheduler.
- Right-click Notification and select Properties.
- Select "No" for Print Report Distribution report.
- Click OK when finished.
Back to top
45. How do I monitor an output queue for reports to distribute?
Report Distribution goes beyond distributing spooled files for a specific job. An Output Queue Monitor can be created to monitor for any spooled file that is created in a specific output queue. Each Output Queue Monitor is defined with an output queue and a Report Distribution List. After a spooled file is created on the output queue, the Report Distribution List associated with the monitor is used to determine how the spooled file is to be distributed. Keep in mind that a spooled file must be created with a Ready status in order for the monitor to attempt distribution. Also holding then releasing a spooled file that is in a monitored output queue will start the distribution function again. To create an Output Queue Monitor, complete the following:
- In System i Navigator select Work Management'Advanced Job Scheduler'Notification.
- Right-click on Output Queue Monitors and select New monitor.
- Enter the name of the output queue monitor.
- Enter a brief description for the monitor.
- Specify an output queue to monitor. Use the Browse button to select from a list of output queue.
- Select a report distibution list to use when monitoring the output queue. Once a spooled file has been created in the output queue, the spooled file will be checked against the spooled file entries within the Report distribution list and if a match is found, will be distributed to one or more output queues and/or one or more e-mail addresses based on the definition of the list.
- Click OK when finished.
NOTE: In order for an Output Queue Monitor to distribute spooled files, the job monitor for the QUSRIJS data library (scheduling environment) must be active as well as the job monitor for the data library that contains the Output Queue Monitor must be active.
Back to top
46. How do I set up multiple scheduling environments in the Advanced Job Scheduler?
There are several reasons why you would want to set up multiple scheduling environments. You may want to have a production version and a test version of the product running at the same time. This type of environment allows you to test various job schedules before actually using them in the data library on the production system. Or you may have a system that is the backup for one or more other systems in which you would use a data-mirroring product to replicate the Advanced Job Scheduler data library (QUSRIJS) from the source system into a library named differently. In this case, the data library is not active until there is a problem with the source system. A scheduling environment is a duplicate of the QUSRIJS library except with different data. For instance, you can have another data library named QUSRIJSTST with all the objects as QUSRIJS. Each are considered data libraries. To set up a multiple scheduling environment, follow these steps:
Step 1: Create a new data library The following are ways that you can create a new data library or obtain a data library from another system:
- Save the QUSRIJS library from another system and restore it as a different name using the RSTLIB parameter on the Restore Library (RSTLIB) command. For more information on how to save and restore the data library, see Backup and recovery.
- Duplicate the data library on the current system using the Copy Library (CPYLIB) command.
- Mirror a data library from another system. All systems should run the same release of the operating system.
-
When adding the data library to the Advanced Job Scheduler, check the box to create the data library. This will create a clean data library.
Note: The copied, restored, or mirrored data library uses a different library name than the original system.
Step 2: Assign data libraries to users After you obtain a test data library, add the data library to the Advanced Job Scheduler's properties and assign users to the data library by completing the following:
- In System i Navigator, select Work Management.
- Right-click Advanced Job Scheduler and select Properties.
- Select the Data Libraries page.
- Click the Add button.
- Specify the name of the library that contains the Advanced Job Scheduler's files and objects.
- Specify a description for the library.
- Specify whether the data library should be monitored. Data libraries must be monitored in order for jobs to be submitted automatically. This may not be necessary for those data libraries that are a mirrored copy.
- Click OK to add.
- Select the Users page.
- Click the Add button.
- Specify a user name.
- Select a data library.
-
Click OK to add. Now, when the user uses the Advanced Job Scheduler, the changes that the user makes are stored in the data library assigned to the user.
Note: Users not in the list default to the main QUSRIJS data library.
Step 3: Copy jobs from test data library to actual data library (optional) If you are using a data library for testing purposes, you may want to copy jobs from the test data library to the active data library. To copy jobs from one system's data library to another, use the Copy Job using Job Scheduler (CPYJOBJS) command and specify *DATALIB in the TOJOB parameter. You will then be prompted for the Data library where you want the jobs to be copied. For more information on the specific parameters for this command, see the online help.
Back to top
47. How do I change the name of the job monitor job?
To change the name of the job monitor job, complete the following:
- In System i Navigator select Work Management.
- Right-click Advanced Job Scheduler and select properties.
- Select the Data Libraries tab.
- Select the correct data library and click Properties.
- Specify the new job monitor job name.
- Click OK when finished.
NOTE: The new name will take affect the next time the monitor is started.
48. How do I change the monitor status for a Scheduling Environment (data library) during a switch over so that it can be started?
The Change Data Library using JS (CHGDLJS) command allows you to change the monitor designator for a data library. The monitor designator determines whether a Scheduling Environment (data library) can be monitored. A Scheduling Environment must be monitored in order for scheduled jobs to submit automatically.
Back to top
49. How do I change the Scheduling Environment (data library) for a user during a switch over?
The Set Data Library using JS (SETDLJS) command allows you to change the data library that is associated with a user profile. The data library associated with a user is used when the user accesses the product. A user can only access one data library at a time.
Back to top
50. How do I set up the Fourth of July of every year as a holiday?
When creating the holiday calendar, display the month of July that has the 4th available and select it. You would then select the 07/04 of every year option from the Holiday dates. From Alternate day to run, select Run on next working day. This will cause any job that uses this holiday calendar to run on the next working day if one of the dates it is scheduled is July the 4th. You would assign this holiday calendar to a scheduled job by specifying it in the Additional Calendars display of the job properties. You can access the Additional Calendars from the Schedule tab and select Additional Calendars.
Back to top
51. How do I set up Advanced Job Scheduler for Wireless?
52. How do I reply to an inquiry message using Advanced Job Scheduler for Wireless?
|