| Directives |
|
| The REPEAT DATA directives are a +PxPlus Exclusive | ||||||||||||||||||||||||||
| Formats |
Where:
|
|||||||||||||||||||||||||
| Description | The
REPEAT DATA directive is used to control
the automatic replication of all PRINT, WRITE, INSERT,
UPDATE or REMOVE directives sent to one file (the primary
file) to another file (the replicated file).. The purpose of this directive is to allow programs to create mirror copies of reports and/or data files without having to issue identical PRINT or WRITE statements to two separate files. While data replication is active, all output directives to the primary file will be sent to the replicated file. When repeating the output, the system will internally process the directive twice -- once for the primary file and again for the replicated file. Note that auto-increment/decrement options will only be done once. A unique error handler can be specified to trap any errors that might occur during the replication process. If no error handler is present, normal error processing will occur with the value in LFA indicating the file on which the error occurred. |
|||||||||||||||||||||||||
| Format 1 | Replicate
output sent to one file on another
This format initiates the replication of all PRINT, WRITE, INSERT, UPDATE or REMOVE directives sent to file1 on file2. Once the directive is executed, all subsequent output directives to file1 will also be sent to file2. Both files must be open at the time the directive is executed. |
|||||||||||||||||||||||||
| *Note* | The system will check to see if the file you are repeating data for itself is the target of data replication. If a looping condition exists within the data replication (file1 repeats file 2 and file2 repeats file 1) an error #89 "File access denied -- I/O operation pending" will be generated. | |||||||||||||||||||||||||
| Format 2 | Terminate
replication
This format terminates the replication of the output going to file1. |
|||||||||||||||||||||||||
| Format 3 | Define
a control file for auto-replication
This directive format defines the control file that the system will check to see if automatic replication is desired. If the pathname of a file being updated matches an entry in this control file, the system will initiate replication automatically. The pathname check is performed whenever the first output operation is done to a file. This directive format can only be used when the Data Mirroring (SQL Mirror) module is enabled within PxPlus. For additional information on the format of this file, refer to the Data Mirroring documentation. |
|||||||||||||||||||||||||
| Format 4 | Define
an error handler for replication
This format defines an error handler that will be invoked whenever an error occurs while attempting to replicate an output directive, at which point the program defined by errhdlr$ will be called with the following information:
The error handler is intended to allow the application to log the problem encountered and to take the necessary corrective action. Generally, it should EXIT in order to resume execution of the original program. If the Error handler exits with an error itself (EXIT nnn), the application will have the original error code reported and the standard program exception logic processing will apply. |
|||||||||||||||||||||||||
| Examples | In
the following example, the printed report will be sent
both to the viewer and to a PDF file. All PRINT
directives will send output to both files.
File replication can be cascaded for output to multiple files. For example, the logic in NEWPAGE could be changed to produce one PDF file for each company:
|
|||||||||||||||||||||||||