Previous Topic: Create Multiple Tailored ReportsNext Topic: How to Download CSV Formatted Reports


CSVGEN Utility—Convert Generated Reports to CSV Format

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

Note: We recommend using OPTION(ZEROFLD=ZERO) in your reports. This option helps you 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 that is 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.

The CSVGEN utility has the following syntax:

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

Indicates the utility name.

<IN>

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

<OUT>

(Required) The 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 parameters are only one character long.

VS=

Value Separator. This parameter changes the default value separator value.

Default: comma (,)

Example, to specify a semicolon use the following format:

VS=;
DS=

Decimal Separator. This parameter changes 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.