Getting SQR Output to the Report Repository

If you are developing a new SQR that creates files that need to be posted from the process scheduler to the report repository, (report manager), here are the steps for doing this. Note this uses delivered SQCs.

The delivered getlogou.sqc can be used to post files to the report repository. There are two functions in this SQC:

  • get-prcsoutputdir which is used to get the original output destination from the PSPRCSPARMS record
  • get-logoutputdir-value which is used to get the process output directory from the PSPRCSPARMS record

Both functions require a global variable, #prcs_process_instance to be declared somewhere in your SQR. This is normaly the case if you call stdapi.sqc.

The orignal output destination is what has been entered into the process definition for the output location. This is normally %%Log/Output Directory%%. The process output directory is the expanded application server path to the log output directory.

The log output directory contains folders that are posted to the report repository. The naming convention for these folders is:

ProcessType_ProcessName_ProcessInstance

For example, CCLTRGEN is an SQR process. If the process instance is 1234567 then folder for this process in the log output directory would be:

SQR_CCLTRGEN_1234567

This folder typically contains log files (.log, .out), any of the common files output by the process (e.g. .pdf) and any files specifically created and placed in this directory.

This is a typical example of how you would use the get-logoutputdir-value procedure to determine the output location for a CSV file generated by your SQR:

do Get-logoutputdir-value ! getlogou.sqc
if (rtrim($prcsoutputdir,' ') <> '')
    move $prcsoutputdir to $CSVPath
end-if

You can check the process output location using the following SQL if you know the process instance:

select PRCSOUTPUTDIR
from PSPRCSPARMS 
where PRCSINSTANCE = '123456789'
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License