13.1.3 Saving the results of a daily job to a different file each day
If you want a daily job to output its results to a standard output file that includes the date in its file name, you would have to manually change the job definition each day. This incurs not only operating costs, but a risk that the definition might not be changed on a given day. This case study describes how to automatically change the date in the file name of the standard output file.
- Organization of this subsection
(1) Operation
The total calculation job collects the order information for the execution date, and outputs the calculation results to a standard output file. The name of the output file name includes a character string representing the date (for example 20110801_calculation.txt). This allows you to identify the date on which the data was collected from the file name.
|
In this case, the date portion of the standard output file name in the detailed definition of the total calculation job needs to be manually changed each day.
(2) Problem
To reduce operating costs and eliminate the risk that the file name might go unchanged, you want the standard output file name in the detailed definition of the total calculation job to change automatically to reflect the date.
(3) Solution
You can automatically change the name of the standard output file by using a passing information setting job to assign the date to a macro variable, and passing that macro variable to the total calculation job.
(4) Configuration example
By defining a jobnet with the structure shown below, you can have the file name of the standard output file reflect the date to which the total applies.
|
To define the jobnet:
-
In a jobnet, define a job (date resolution job) that outputs the current date to a standard output file.
Create a job (date resolution job) that outputs the date information to a standard output file in the format DATE=YYYYMMDD (where YYYY: year, MM: month, and DD: day.) Specify $JP1AJS2_JPQSTDOUTTEMP$ in the Standard output field for the date resolution job.
-
Define a passing information setting job.
Define a passing information setting job.
Define the job in the Define Details - [Passing Info Settings Job] - [Passing Info] dialog box as follows:
Regular Exp.: Specify a regular expression that extracts the date portion YYYYMMDD from the standard output file of the date resolution job.
Output Macro Var.: Specify the name of the macro variable that will store the extracted information.
- Definition example:
-
Regular Exp.: DATE=(.*)
Output Macro Var.: FILEDATE
-
Define the total calculation job.
In the Standard output field, specify the macro variable name.
Standard output: ?AJS2FILEDATE?_calculation.txt
-
Relate the jobs in order of the date resolution job, the passing information setting job, and then the total calculation job.
-
Register the jobnet for execution.
When you execute the jobnet on August 1, 2011, a value of 20110801 is assigned to the ?AJS2FILEDATE? variable in the standard output file name of the total calculation job. As a result, the total calculation job creates the file 20110801_calculation.txt.
The following figure shows the flow of assigning the date to the standard output file name of the total calculation job.
Figure 13‒10: Assigning the date to the total calculation job standard output file name
(5) Manual references
Type |
Item |
Location |
---|---|---|
Overview |
Passing information setting job |
3.1.1(1)(g) Passing information setting job in the manual JP1/Automatic Job Management System 3 Overview |
Example of defining a passing information setting job |
2.4.9 Passing information that changes dynamically to a succeeding unit (example of defining a jobnet that uses a passing information setting job) in the JP1/Automatic Job Management System 3 System Design (Work Tasks) Guide |
|
Dialog boxes |
|