Christine_Chavez_6412

Can you output results from a SQL job to a file on the UNIX system?

Discussion created by Christine_Chavez_6412 on Jul 15, 2016
Latest reply on Feb 22, 2018 by Wolfgang_Brueckler_1288

Technically, yes. 

There is no setting in an SQL job where you can specify its output or report location to be in a Unix system, but there is a way around this.

A couple of options are (and I'm sure some users have other solution for this as well):

Option A

1) Set the SQL Job output to be File (default is database. you can set it to just File, or database and File)
2) Use a FileTransfer object to copy/move the SQL job file to a Unix box 

Option B

1) Set the SQL Job output to be File (default is database. you can set it to just File, or database and File)
2) in the SQL Job post process, use PREP_PROCESS_REPORT to  retrieve the lines from the SQL Job file and store it in an array or variable (eg: &SQL_RESULT#)


3) activate a unix job and pass the parameter
eg: activate_uc_object({name of unix job},,,,, PASS_VALUES)


4) create a unix job (this is the job that will be activated in #3) that will write the value passed to a file
eg: echo &SQL_RESULT# > /{unix path to file}/{fileName}

Outcomes