Unable to spool information from a database job to file

Document ID : KB000088580
Last Modified Date : 14/04/2018
Show Technical Document Details
Detailed Description and Symptoms

There is currently no way to use the "spool" command on a database agent job. However, there is a way to output the information to file through the job and use that file or transfer that file to another machine or share. Steps on how to do these are below.​

1) Put the regular commands that you would in the Form or Process tab. 


2) In the SQL tab, check "File" under "Job Report"


This will write the information from the "report" of the report to file. The file will have a name like: O<ALPHA>.TXT. 

3) <ALPHA> can be determined by getting the Run Number of the job and using the RUNNR2ALPHA Automic script function. To find the path and file name, the following can be put in the Post Process tab:


:P "ALPHA Value of Run Number &RUNNR# is &RUNNRALPHA#"
:P "Report can be found on &HOST# machine at:"


4) The Post Processing Report will show where the file is located:




You can also use an OS job or filetransfer (JOBF) to copy or transfer this file to a different directory or machine. For an OS job (below shown in UNIX), you could use the below:
In the Post Process tab of the job from which the report is being written, you can put the following:
And the UNIX job from above (here called JOBS.UNIX.MOVE.SQL.REPORT) would run on the same machine as the SQL job and would have the following in the Process tab:
!Get Run Number for activating job
!Get Agent for activating job
!Get Path where job reports are stored on Agent that activated job
!Get Alpha value of run number for activating job
:P "ALPHA Value of Run Number &ACT_RUNNR# is &RUNNRALPHA#"
:P "Report can be found on &ACT_HOST# machine at:"
!Set NEW_PATH and NEW_FILE – path for new file, and name for New file
:SET &NEW_PATH # = "/u01/users/uc4/test"
!Copy file to new location

For Filetransfers, the command below would be used to set the source file attribute from the Process tab: