Start Monitor for OnDemand (STRMONOND)
The Start Monitor for OnDemand (STRMONOND) command allows you to specify the name of an output queue or directory to monitor. The spooled files in the output queue, or the files in the directory, will be automatically processed by ADDRPTOND.
Once files are processed, they are controlled by the value of the DLTSPLF parameter. Spooled files are additionally controlled by the settings of the ERROUTQ and the PRCOUTQ parameters. If DLTSPLF is *YES, then successfully processed files will be deleted. If it is *NO, then successfully processed spooled files will be moved to the output queue named in the PRCOUTQ parameter; successfully processed directory files will have '.PRC' added to the end of the file name. Unsuccessfully processed files will never be deleted. Spooled files will end up in the output queue specified in the ERROUTQ parameter; directory files will have '.ERR' added to end of the file name.
You can end the monitor by:
- Specifying a method for the monitor to end automatically.
- Running the ENDMONOND command.
- Ending the monitor job using the ENDJOB command. Specify OPTION(*CNTRLD) and DELAY(999999). The job will end as soon as the monitor finishes processing the current file.
| Keyword |
Description |
Choices |
Notes |
| TYPE |
Type |
*OUTQ, *DIR, *DIR2 |
Optional |
| OUTQ |
Output queue |
Qualified object name |
Optional, Positional 1 |
| Qualifier 1: Output queue |
Name |
| Qualifier 2: Library |
Name, *LIBL, *CURLIB |
| DIR |
Directory |
Path name |
Optional |
| APPGRPSRC |
Value for application group |
Element list |
Optional |
| Element 1: Check first |
*SPLFNAME, *FORMTYPE, *USERDATA, *JOBNAME, *USRDFNOPT1, *USRDFNOPT2, *USRDFNOPT3, *USRDFNOPT4, *USRDFNDTA, *FIRST, *SECOND, *THIRD, *FOURTH |
| Element 2: Check next |
*NONE, *FORMTYPE, *USERDATA, *JOBNAME, *USRDFNOPT1, *USRDFNOPT2, *USRDFNOPT3, *USRDFNOPT4, *USRDFNDTA, *SPLFNAME, *SECOND, *THIRD, *FOURTH, *FIRST |
| Element 3: Check last |
*NONE, *USERDATA, *JOBNAME, *USRDFNOPT1, *USRDFNOPT2, *USRDFNOPT3, *USRDFNOPT4, *USRDFNDTA, *SPLFNAME, *FORMTYPE, *THIRD, *FOURTH, *FIRST, *SECOND |
| APPSRC |
Value for application name |
Element list |
Optional |
| Element 1: Check first |
*APPGRP, *SPLFNAME, *FORMTYPE, *USERDATA, *JOBNAME, *USRDFNOPT1, *USRDFNOPT2, *USRDFNOPT3, *USRDFNOPT4, *USRDFNDTA, *FIRST, *SECOND, *THIRD, *FOURTH |
| Element 2: Check next |
*NONE, *FORMTYPE, *USERDATA, *JOBNAME, *USRDFNOPT1, *USRDFNOPT2, *USRDFNOPT3, *USRDFNOPT4, *USRDFNDTA, *SPLFNAME, *SECOND, *THIRD, *FOURTH, *FIRST |
| Element 3: Check last |
*NONE, *USERDATA, *JOBNAME, *USRDFNOPT1, *USRDFNOPT2, *USRDFNOPT3, *USRDFNOPT4, *USRDFNDTA, *SPLFNAME, *FORMTYPE, *THIRD, *FOURTH, *FIRST, *SECOND |
| ERROUTQ |
Error output queue |
Qualified object name |
Optional |
| Qualifier 1: Error output queue |
Name, ONDERR |
| Qualifier 2: Library |
Name, QUSRRDARS, *LIBL, *CURLIB |
| DLTSPLF |
Delete processed file |
*NO, *YES |
Optional |
| PRCOUTQ |
Processed output queue |
Qualified object name |
Optional |
| Qualifier 1: Processed output queue |
Name, ONDPROC |
| Qualifier 2: Library |
Name, QUSRRDARS, *LIBL |
| ENDMON |
End monitor automatically |
*NO, *NOINPUT, *NBRHRS, *ENDTIME |
Optional |
| NBRHRS |
Number of hours to run |
1-999, 8 |
Optional |
| ENDTIME |
Time to end |
Time, 230000 |
Optional |
| NBRMON |
Number of monitors to start |
1-9, 1 |
Optional |
| STRSVR |
Start instance server |
*NO, *YES |
Optional |
| ENDSVR |
End instance server |
*NO, *YES |
Optional |
| INSTANCE |
Instance |
Character value, *DFT |
Optional |
| SBMJOB |
Submit to batch |
*YES, *NO |
Optional |
| JOB |
Monitor job name |
Name, *DFT, *DIR, *OUTQ |
Optional |
| JOBD |
Job description |
Qualified object name |
Optional |
| Qualifier 1: Job description |
Name, QOND400 |
| Qualifier 2: Library |
Name, QRDARS, *LIBL, *CURLIB |
Type (TYPE)
Specifies the type of monitor.
-
- *OUTQ
- Monitor the output queue named in the OUTQ parameter.
- *DIR
- Monitor the directory named in the DIR parameter. This type of monitor processes .IND or .PDF files.
- *DIR2
- Monitor the directory named in the DIR parameter. This type of monitor processes .ARD files.
Output queue (OUTQ)
Specifies the name and library of the output queue for which a monitor is to be started. A value must be provided if TYPE(*OUTQ) is specified.
Qualifier 1: Output queue
-
- output-queue-name
- Specify the name of the output queue to monitor.
Qualifier 2: Library
-
- *LIBL
- All libraries in the job's library list are searched until the first match is found.
- *CURLIB
- The current library for the job is where the output queue is located. If no library is specified as the current library for the job, QGPL is used.
- library-name
- Specify the name of the library where the output queue is located.
Directory (DIR)
Specifies the directory to monitor. A value must be provided if TYPE(*DIR) or TYPE(*DIR2) is specified.
When a directory is monitored, the monitor looks for files to process in that directory. Each file that is found in the directory will be processed. The file names should contain the application group and application name. For example, 'CHECKSTMTS.BIGSTMTS.data'. The monitor can use any one of the first 4 parts of the file name based on the values you specify for the APPGRPSRC and APPSRC parameters. When a file is processed successfully, '.PRC' is appended to the file name unless you have specified DLTSPLF(*YES) . If the load fails or if the values determined for application group and application are not valid, '.ERR' is appended to the file name. Files that end in .PRC or .ERR will not be processed.
Value for application group (APPGRPSRC)
For spooled files specifies which spooled file attribute to use as the application group name. For directory files specifies which part of the file name to use as the application group name. Up to three sources can be specified. If a valid application group name is not found using the first source, the second source is used. If a valid application group name is not found using the second source, the third source is used.
Each value other than *NONE can only be used once.
Element 1: Check first
-
- *SPLFNAME
- Use the spooled file name as the source for the name.
-
- *FORMTYPE
- Use the form type as the source for the name.
- *USERDATA
- Use the user data as the source for the name.
- *JOBNAME
- Use the job name as the source for the name.
- *USRDFNOPT1
- Use the user-defined option 1 as the source for the name.
- *USRDFNOPT2
- Use the user-defined option 2 as the source for the name.
- *USRDFNOPT3
- Use the user-defined option 3 as the source for the name.
- *USRDFNOPT4
- Use the user-defined option 4 as the source for the name.
- *USRDFNDTA
- Use the user-defined data as the source for the name.
- *FIRST
- Use the part of the file name up to the first period as the source for the name.
- *SECOND
- Use the part of the file name between the first period and the second period as the source for the name.
- *THIRD
- Use the part of the file name between the second period and the third period as the source for the name.
- *FOURTH
- Use the part of the file name between the third period and the fourth period as the source for the name.
The default source for the second or third source is:
-
- *NONE
- No further sources should be checked.
Element 2: Check next and Element 3: Check last
-
- *FORMTYPE
- Use the form type as the source for the name.
- *USERDATA
- Use the user data as the source for the name.
- *JOBNAME
- Use the job name as the source for the name.
- *USRDFNOPT1
- Use the user-defined option 1 as the source for the name.
- *USRDFNOPT2
- Use the user-defined option 2 as the source for the name.
- *USRDFNOPT3
- Use the user-defined option 3 as the source for the name.
- *USRDFNOPT4
- Use the user-defined option 4 as the source for the name.
- *USRDFNDTA
- Use the user-defined data as the source for the name.
- *FIRST
- Use the part of the file name up to the first period as the source for the name.
- *SECOND
- Use the part of the file name between the first period and the second period as the source for the name.
- *THIRD
- Use the part of the file name between the second period and the third period as the source for the name.
- *FOURTH
- Use the part of the file name between the third period and the fourth period as the source for the name.
The default source for the second or third source is:
-
- *NONE
- No further sources should be checked.
Value for application name (APPSRC)
For spooled files specifies which spooled file attribute to use as the application. For directory files specifies which part of the file name to use as the application name. Up to three sources can be specified. If a valid application name is not found using the first source, the second source is used. If a valid application name is not found using the second source, the third source is used.
Each value other than *NONE can only be used once.
Element 1: Check first
-
- *APPGRP
- Use the application group name as the source for the application name. This value will also work if the application group only contains one application regardless of the name of the application.
-
- *FORMTYPE
- Use the form type as the source for the name.
- *USERDATA
- Use the user data as the source for the name.
- *JOBNAME
- Use the job name as the source for the name.
- *USRDFNOPT1
- Use the user-defined option 1 as the source for the name.
- *USRDFNOPT2
- Use the user-defined option 2 as the source for the name.
- *USRDFNOPT3
- Use the user-defined option 3 as the source for the name.
- *USRDFNOPT4
- Use the user-defined option 4 as the source for the name.
- *USRDFNDTA
- Use the user-defined data as the source for the name.
- *FIRST
- Use the part of the file name up to the first period as the source for the name.
- *SECOND
- Use the part of the file name between the first period and the second period as the source for the name.
- *THIRD
- Use the part of the file name between the second period and the third period as the source for the name.
- *FOURTH
- Use the part of the file name between the third period and the fourth period as the source for the name.
The default source for the second or third source is:
-
- *NONE
- No further sources should be checked.
Element 2: Check next and Element 3: Check last
-
- *FORMTYPE
- Use the form type as the source for the name.
- *USERDATA
- Use the user data as the source for the name.
- *JOBNAME
- Use the job name as the source for the name.
- *USRDFNOPT1
- Use the user-defined option 1 as the source for the name.
- *USRDFNOPT2
- Use the user-defined option 2 as the source for the name.
- *USRDFNOPT3
- Use the user-defined option 3 as the source for the name.
- *USRDFNOPT4
- Use the user-defined option 4 as the source for the name.
- *USRDFNDTA
- Use the user-defined data as the source for the name.
- *FIRST
- Use the part of the file name up to the first period as the source for the name.
- *SECOND
- Use the part of the file name between the first period and the second period as the source for the name.
- *THIRD
- Use the part of the file name between the second period and the third period as the source for the name.
- *FOURTH
- Use the part of the file name between the third period and the fourth period as the source for the name.
The default source for the second or third source is:
-
- *NONE
- No further sources should be checked.
Error output queue (ERROUTQ)
Specifies the name of the output queue to receive spooled files that ADDRPTOND fails to load.
Qualifier 1: Error output queue
-
- ONDERR
- Spooled files that are not loaded are placed in the output queue named ONDERR.
- error-queue-name
- Specify the name of the output queue to receive spooled files that fail to load.
Qualifier 2: Library
-
- QUSRRDARS
- The output queue is located in library QUSRRDARS.
- *LIBL
- All libraries in the job's library list are searched until the first match is found.
- *CURLIB
- The current library for the job is where the output queue is located. If no library is specified as the current library for the job, QGPL is used.
- name
- Specify the name of the library where the output queue is located.
Delete processed file (DLTSPLF)
Specifies whether or not to delete a spooled file or file that ADDRPTOND loads successfully. If ADDRPTOND is unsuccessful, the spooled file or file is not deleted.
-
- *NO
- The spooled file or file is not automatically deleted.
- *YES
- The spooled file or file is only deleted if the report was loaded successfully.
Processed output queue (PRCOUTQ)
Specifies the name of the output queue to receive spooled files that ADDRPTOND loads successfully. This occurs only if DLTSPLF is *NO.
Qualifier 1: Processed output queue
-
- ONDPROC
- Spooled files that are loaded successfully are placed in the output queue named ONDPROC.
- processed-queue-name
- Specify the name of the output queue to receive spooled files that were loaded successfully.
Qualifier 2: Library
-
- QUSRRDARS
- The output queue is located in library QUSRRDARS.
- *LIBL
- All libraries in the job's library list are searched until the first match is found.
- *CURLIB
- The current library for the job is where the output queue is located. If no library is specified as the current library for the job, QGPL is used.
- name
- Specify the name of the library where the output queue is located.
End monitor automatically (ENDMON)
Specifies if the monitor will automatically end and how.
-
- *NO
- Do not automatically end the monitor.
- *NOINPUT
- The monitor will end when the monitored output queue or directory has no more files that can be processed.
Note: Only spooled files in the ready state can be processed.
- *NBRHRS
- The monitor will end after it has run the number of hours specified on the NBRHRS parameter.
- *ENDTIME
- Specifies that the monitor is to end at the time specified on the ENDTIME parameter.
Number of hours to run (NBRHRS)
Specifies how many hours the monitor is to run before automatically ending.
-
- 8
- The monitor will automatically end after 8 hours.
- 1-999
- Allow the monitor to run from 1 to 999 hours.
Time to end (ENDTIME)
Specifies the time when the monitor will automatically end.
-
- 230000
- The monitor will automatically end at 11:00 pm.
- ending-time
- Specify the time that the monitor should end. The time is specified in 24-hour format and can be specified with or without a time separator:
- Without a time separator, specify a string of 4 or 6 digits (hhmm or hhmmss) where hh = hours, mm = minutes, and ss = seconds. Valid values for hh range from 00 to 23. Valid values for mm and ss range from 00 to 59.
- With a time separator, specify a string of 5 or 8 digits where the time separator specified for your job is used to separate the hours, minutes, and seconds. If this command is entered from the command line, the string must be enclosed in apostrophes. If a time separator other than the separator specified for your job is used, this command will fail.
Note: If the ENDTIME is after the current time, the monitor will end at the time specified by ENDTIME today. If the ENDTIME is before the current time, the monitor will end at that time tomorrow.
Number of monitors to start (NBRMON)
Specifies the number of monitors to start with these characteristics. Only one monitor can be started when TYPE(*DIR) or TYPE(*DIR2) is specified.
-
- 1
- One monitor is started.
- 1-9
- Specify the number of monitors to start.
Start instance server (STRSVR)
Specify to start the instance server if it is not currently active.
-
- *NO
- The instance server for this instance will not be started.
- *YES
- The instance server for this instance will be started.
End instance server (ENDSVR)
Specify to end the instance server when the monitor ends.
-
- *NO
- Do not end the instance server when the monitor ends.
- *YES
- End the instance server when the monitor ends.
Instance (INSTANCE)
Specifies the name of the OnDemand instance to use.
-
- *DFT
- The default OnDemand instance is used. The default instance is specified in the QDFTINST data area. The QDFTINST data area can exist in multiple libraries. A search for the QDFTINST data area is performed using the library list. The first data area found will be used. If the QDFTINST data area is not found using the library list, the QUSRRDARS library will be searched for the data area. If the data area exists in the QUSRRDARS library it will be used. If the QDFTINST data area is not found, instance QUSROND is used.
- instance-name
- Specify the name of the instance that is to be used. By definition, the instance must be on the system where the command is run.
Submit to batch (SBMJOB)
Specify if you want to monitor the output queue or directory in the current job or in a another job.
Note: *YES must be specified when the NBRMON parameter is greater than 1.
-
- *YES
- This command should be submitted to run in a different job.
- *NO
- This command should be run within the current job. If you are entering this command from a terminal, this will prevent you from doing any other work from this terminal session until this command completes.
Monitor job name (JOB)
Specify the job name for the monitor batch job.
-
- *DFT
- A default job name for the monitor will be assigned.
If a monitor type of output queue (TYPE(*OUTQ)) is specified, the default monitor job name will be MONOUTQ. If a monitor type of directory (TYPE(*DIR)) is specified, the default monitor job name will be MONDIR. If a monitor type of directory (TYPE(*DIR2)) is specified, the default monitor job name will be MONDIR2.
- *DIR
- The job name for a directory monitor job will consist of the characters immediately after the last slash (/) in the value of the directory (DIR) parameter, up to a limit of 10 characters.
- *OUTQ
- The monitor batch job name will be the same as the output queue name specified for the OUTQ parameter.
- job-name
- The monitor batch job name will be the job name specified.
Job description (JOBD)
Specifies the name of the job description used for the submitted job.
Qualifier 1: Job description
-
- QOND400
- The QOND400 job description is used as the job description for the submitted job.
- jobd-name
- Specify the name of the job description used for the job.
Qualifier 2: Library
-
- QRDARS
- Library QRDARS is used as the job description's library.
- *LIBL
- All libraries in the job's library list are searched until the first match is found.
- *CURLIB
- The current library for the job is used to locate the job description name. If no library is specified as the current library for the job, QGPL is used.
- library-name
- Specify the name of the library where the job description name is located.
Example 1: Start an OnDemand Monitor for an Output Queue
STRMONOND OUTQ(QUSRRDARS/ONDEMANDQ)
This command submits a job to batch that monitors for spooled files that are to be archived into OnDemand Common Server. When issued with no other parameters, the monitor uses the spooled file name attribute of the spooled file as both the application group name and application name. Spooled files that do not archive successfully are moved to the ONDERR output queue in the QUSRRDARS library. Spooled files that do archive successfully are also not deleted; they are moved to the ONDPROC output queue in the QUSRRDARS library. This command as shown will submit the monitor job without any specified end criteria, and will process within the default instance.
Example 2: Start an OnDemand Monitor for an Output Queue Which Ends at a Specific Time
STRMONOND OUTQ(QUSRRDARS/ONDEMANDQ)
APPGRPSRC(*SPLFNAME *FORMTYPE) APPSRC(*USERDATA)
DLTSPLF(*YES) ENDMON(*ENDTIME) ENDTIME(235900)
INSTANCE(ACCTING)
This command submits a job to batch that monitors for spooled files that are to be archived into OnDemand Common Server. The monitor attempts to use spooled file name and then form type attributes of the spooled file (in that order) for use as the application group name. The monitor uses the user data attribute of the spooled file as the application name. With this command example, successfully processed spooled files are deleted automatically; spooled files that do not archive successfully are moved to the ONDERR output queue in the QUSRRDARS library. In this example, the monitor will end at one minute before midnight of the current day. All processing will occur within the ACCTING instance.
Example 3: Start an OnDemand Monitor for a Directory
STRMONOND TYPE(*DIR) DIR('/mydir') APPGRPSRC(*SECOND)
APPSRC(*THIRD) DLTSPLF(*YES) INSTANCE(ACCTING)
This command submits a job to batch that monitors for stream files that are to be archived into OnDemand Common Server. The monitor uses the second part of the file name as the application group name and the third part of the file name as the application name. With this command example, successfully processed stream files are deleted automatically; stream files that do not archive successfully are retained in their current directory with the suffix of .ERR appended to the end of the file. All processing will occur within the ACCTING instance.
*ESCAPE Messages
- CPF1338
- Errors occurred on SBMJOB command.
- OND0231
- Output queue &1 in library &2 can not be monitored. No data queue is attached.
- OND0281
- Output queue &1 in library &2 can not be monitored. Another monitor is already active.
- RDR0186
- Output Queue &1 in library &2 not found.