Using system date or job run date as the value of a date field

If you need to create a date field in a Content Manager OnDemand application definition for a report that has no date printed on any of its pages, you can define the date field to use the system date at the time the report is loaded into Content Manager OnDemand or the run date of the job that loads the report.

Using the system date as the date value

If you want to use the system date captured at the time the report is loaded into Content Manager OnDemand, do not specify a field or index in the Indexer Parameters, and simply enter 't' which indicates the use of today’s date for the Default Value of the date field on the Load Information tab of the Content Manager OnDemand application definition. This method will use the system date, not the job date, to determine the date value. This method works correctly even if you are using the output queue monitor, and continues to work correctly even if the monitor runs past midnight when the system date changes.

Note that simply using 't' as the DEFAULT= value for a date field is not allowed, such as:
FIELD1=0,95,8,(TRIGGER=1,BASE=0,DEFAULT=X'A3') /* t */

Using the job run date as the date value

If you are unable to simply use the system date for the date value, but instead need to set the date to a specific, “hard-coded” date (such as setting an annual report’s date to January 1, no matter when it is actually loaded into Content Manager OnDemand), you can use the _*RUNDATE*_ special value on the FIELDx indexer parameter. For example, instead of using a FIELD1 definition like this which specifies a particular location of the date on the printed page of the report,
FIELD1=0,95,8,(TRIGGER=1,BASE=0)
you could use the hex equivalent of _*RUNDATE*_ for the field definition
FIELD1=X'6D5CD9E4D5C4C1E3C55C6D' /* _*RUNDATE*_ */
which causes the 400 indexer to use the job’s run date instead.

To define your date field, you can either select Keyboard and then Modify from the Indexer Information page of the Content Manager OnDemand application definition and enter the FIELDx= indexer parameter manually, or you can use the graphical indexer and create it using the Add a Field panel.

You must also update the date field to use the %Y-%m-%d date format on the Load Information page of the Content Manager OnDemand application definition. The _*RUNDATE*_ special value returns the date in this format.

You must also add an index field. An example might look like this, to correspond to the FIELD1 shown earlier:
INDEX1=X'D9C4C1E3C5',FIELD1,(TYPE=GROUP,BREAK=NO) /* RDATE */
To define your date index, you can either select Keyboard and then Modify from the Indexer Information page of the Content Manager OnDemand application definition and enter the INDEXx= indexer parameter manually as shown in the preceding information, or you can use the graphical indexer and create it using the Add an Index panel.

When you are ready to load the report into Content Manager OnDemand, change your job’s run date to the date you want to have associated with the report, using the Date parameter of the Change Job command, for example CHGJOB DATE(010108) for January 1, 2008. Then, simply run the ADDRPTOND command interactively using the ADDRPTOND SBMJOB(*NO) command so that the interactive job’s run date is used.

You can also use the Content Manager OnDemand output queue monitor to achieve the same results. First, start the monitor job using the STRMONOND command. If you need the date to be different than the current date, change the job date of the monitor job to the date you require. Then move the spooled files to the monitored output queue for processing. Only the spooled files with Content Manager OnDemand application definitions that use the _*RUNDATE*_ special value will use the monitor job’s run date. Application definitions that explicitly define a date field from the print page will continue to extract the date from the report.

Note that the job date of the output queue monitor job does not automatically change at midnight. If you need the job date to change at midnight, you must use the CHGJOB command to explicitly set the new date, or end the monitor job before midnight and then restart it again after midnight to set the new date. Remember that the ending of the monitor could be done for you automatically if you specify an end time (on the Monitor Properties page of the IBM® Content Manager OnDemand component of IBM Navigator for i, or the ENDTIME parameter of the STRMONOND command) when you start the monitor.