Previous Topic: Create Multiple Tailored Reports

Next Topic: How to Download CSV Formatted Reports

CSVGEN Utility—Convert Generated Reports to CSV Format

You can take a TAB, TAB2, and FLASHBACK report that you have created and convert that report to CSV format for use in a PC spreadsheet program.

Note: We recommend using OPTION(ZEROFLD=ZERO) in your reports. This option helps ensure that fields with a zero value do not appear as blanks in the CSV output.

Usage of the CSVGEN utility to convert the generated report to CSV format

Use the prepared sample job $CSVJCL, which is an extension of $SAMPJCL. The CSV formatted output is generated in the second step of the $CSVJCL job:

//PARSE    EXEC PGM=IKJEFT01                         
//SYSEXEC  DD DISP=SHR,DSN=sysview.REPORT.SCSYSAMP   
//SYSTSPRT DD SYSOUT=*                               
//RWO      DD SYSOUT=*                               
//CSVIN    DD DSN=*.REPORT.SYSPRINT,DISP=(OLD,DELETE)
//CSVOUT   DD SYSOUT=*                               
//SYSTSIN  DD *                                      
  CSVGEN CSVIN CSVOUT VS=; DS=,                      
/*

DD names:

RWO

Copies the original (source) report here.

CSVIN

Specifies the source report, which is typically generated in the first step, but a stored report could also be used.

CSVOUT

Stores the CSV formatted report here.

SYSTSIN

Invokes the conversion utility with all parameters.

$CSVJCL introduces a second job step, converting the report generated in the first step to a CSV formatted file. CSV formatted reports contain only data and relevant headers, presented in the same order as in the source report.

CSVGEN utility has the following syntax:

CSVGEN {<IN> <OUT>} [OPTIONAL PARAMETERS]
CSVGEN

Indicates the utility name.

<IN>

(Required) Input ddname. Points to original (source) report which is being converted.

<OUT>

(Required) Output ddname. The report in CSV format is stored here.

[OPTIONAL PARAMETERS]

Some optional parameters can be used to tailor your CSV formatted output. These are only one character long.

VS=

Value Separator. Use this parameter to change the default value separator value.

Default: comma (,)

Example, to specify a semicolon use the following format:

VS=;
DS=

Decimal Separator. Use this parameter to change the default decimal separator value.

Default: period (.)

Example, to specify a comma use the following format:

DS=,

Your report is converted to CSV format and ready to download to your PC.