When we use SQR file open to generate a file, it normally get's
generated in FILEPREFIX directory which is set by setfile.sqc included
in setenv.sqc which is normally defaulted to /usr/tmp. This file is not
transferred to report repository and user needs to manually ftp the
file from unix server. There is a way by which we can send the
generated file to report repository.
Call this procedure in your
sqr. This initializes the $directory variable which can be then be used
in place of '{FILEPREFIX}' to set the filepath. This generates the file
in the sqr log directory which is then transferred to report repository.
!Taken Code from fin2025.sqr
do Get-Directory
let $directory = rtrim($directory, ' ')
! database platform
#ifdef MVS
let $direct_temp = translate($directory, '','.')
let $directory = $direct_temp
let #drive_length = instr($directory, ':', 1)
let #path_length = length($directory)
add 1 to #drive_length
let $directory = {PS-SUBSTR}($directory, #drive_length, #path_length)
let $directory = 'DSN:' || $directory
#else
#ifdef OS400
let $direct_temp = translate($directory, '','.')
let $directory = $direct_temp
let #drive_length = instr($directory, ':', 1)
let #path_length = length($directory)
add 1 to #drive_length
let $directory = {PS-SUBSTR}($directory, #drive_length, #path_length)
let $directory = 'DSN:' || $directory
#else
#ifdef UNIX !UPD110341
let $direct_temp = translate($directory, '','/')
let $directory = $direct_temp
#else
!continue
#end-if
#end-if
#end-if
DISPLAY 'Destination Directory : ' NOLINE
DISPLAY $DIRECTORY
PRINT 'Destination Directory : ' (+1,1,)
PRINT $DIRECTORY ()
END-PROCEDURE
BEGIN-PROCEDURE Get-Directory
begin-select
ORIGOUTDEST,
PRCSOUTPUTDIR
! if isblank(rtrim (upper( ' '))
if rtrim (upper( ' ') = '%%LOG/OUTPUT DIRECTORY%%'
let $directory = rtrim( ' ') || ''
else
let $directory = rtrim( ' ')
end-if
from PSPRCSPARMS where
PRCSINSTANCE = #prcs_process_instance
end-select
END-PROCEDURE