Previous Topic: Using the Sample EXTDATA Reports

Next Topic: EARLGRAF Routine


Earl CSV (Comma Separated Value) File Output

CA JARS now provides new and expanded support for CSV file production. See the "CSV File Production" chapter for details. The CSV support described below is maintained for previous users, but is not recommended for new CSV production.

The following example illustrates the required input statements.

//SYSIN  DD *
OPTION PRTEXIT=CAJRCSV
OPTION LIST OFF
OPTION EXCLUDE
OPTION PRINTER = 132 PAGE = 99999
OPTION CPAGE = 60
OPTION OMIT ALL BLANK LINES
HISTIN:  FILE JARS RECORD=3697
  DEF INAREA 1-3697 X
  COPY MRXTHDR
  COPY MRXT50
!
REPORT 'CSV TEST'
SELECT EXTTYPE = 'S50 '
CONTROL SKIP  SID  EXT50_NME RECDATEC (RECHR)
  SET(T) ZID (X 4) = SID
  SET(T) ZNME (X 8) = EXT50_NME
  SET(T) ZDATE (X 6) = RECDATEC
PRINT TOTALS ONLY
PRINT 'RP1' 'SID=' ZID 'NAME=' ZNME 'DATE=' ZDATE 'HOUR=' RECHR
      'WR=' (EXT50_CWR) 'RD=' (EXT50_CRD)
      'PI=' (EXT50_PUI) 'PO=' (EXT50_PUO)
END

Listed next is each input statement and their corresponding functions.

OPTION PRTEXIT=CAJRCSV

causes the CAJRCSV exit to be invoked, and to produce CSV files from all output reports in this Earl run.

OPTION LIST OFF

causes the Earl program listing to be omitted from the output.

OPTION EXCLUDE

causes the compilation listing to be omitted.

OPTION PRINTER = 132 PAGE = 99999

sets the maximum print line width for the run (216 is the maximum), PAGE = 99999. Also causes Earl to not generate page breaks.

HISTIN

sets the DDNAME to be used as input.

COPY MRXTHDR, COPY MRXT50

includes the file definition of the required EXTDATA record.

REPORT 'CSV TEST'

dummy report statement which starts the Earl report section.

SELECT

selects only the given record type for this report.

CONTROL

sets the report order. In this case we are creating a summary CSV file, so the parentheses around RECHR also show the output break level. In this case we want a CSV record per hour, within date, VTAM line name, and Sysid.

SET(T)

causes the alphabetic key fields to be printed on the TOTALS line.

PRINT TOTALS ONLY

no detail printing required. Only summary information desired.

PRINT 'RP1' 'SID=' ZID ....

The CAJRCSV exit expects the first token on the output line to be the output data set DDNAME, in this case RP1. Be sure to include an RP1 DD statement in the JCL. Each report typically produces its own output CSV file. The following tokens on the PRINT line must be in the format of 'column=' field, where column is the column name for the CSV file, and field is the actual data.

The following output data example illustrates what was generated from this report definition.

SID,NAME,DATE,HOUR,WR,RD,PI,PO
XAD1,A01H04,950119,0,1091,0,1214,1201 
XAD1,A01H04,950119,1,1287,0,1479,1463 
XAD1,A01H04,950119,2,1058,0,1100,1080 
XAD1,A01H04,950119,3,1184,0,1261,1321 
XAD1,A01H04,950119,4,1829,0,1892,2088 

The first line of output in the CSV file contains the column names, followed by the data itself.

The output file can be downloaded to spreadsheets, word processors, or other PC-based applications. It can also be used as a basis for EIS-type systems.

It should be noted that the CAJRCSV exit can be used with any type of input data. CA JARS History/Account records, EXTDATA, as well as Chargeback records from CCCTAB/CCCMOD may be used to produce CSV files.

To use CCCMOD as an input file, the CCCTAF synonym must be created to point to CCCMOD instead of CCCTAB. For example, to process with a CCCTAB file, copy CAKRINVE from CAJREARL, then add OPTION PRTEXIT.