A report device option of OUTFMT=D is used to specify that report output should be sent in DSL format. This is used in conjunction with a device type of "API" for streaming output to the P4API application. There are two variants for the option:

  • OUTFMT=D – This specifies Delimiter Separated List output with a comma as a field separator. The keyword and the "D" must be in uppercase.

  • OUTFMT=D"x" – The same as above, but the field separator is defined as x, where x can be up to four bytes (2 characters) long. Double quotes must surround the field separator. You can specify certain control characters (in the ASCII decimal codepoint range of 0 through 31) by using the C language backslash convention. In such a case, the sequence is treated as one character for the purpose of determining the length of the separator:

Representation of Special Field Separator Characters

To Use This Character as a Separator

ASCII Codepoint Hex Value

Use This Sequence

TAB

0x09

\t

RETURN

0x0d

\r

LINEFEED

0x0a

\n

FORMFEED

0x0c

\f

BACKSLASH

0x5c

\\

DOUBLE-QUOTE

0x22

\?

These options can be specified in $SYSDEF, $SPOOL or via the @RPTOPT variable. For @RPTOPT, the device type for "API" is 10.

Examples

  1. To output to the screen using a comma as the field separator. In $SYSDEF, enter the following in the Report Device Name entry:

CRT:OUTFMT=D

  1. To output via P4API using a comma as the field separator. In $SYSDEF, enter the following in the Report Device Name entry:

API:OUTFMT=D

  1.  To use @RPTOPT.  Set the device type (first field) to 10, and set the report device name to "API:OUTFMT=D" in the second field:

@RPTOPT = "10,API:OUTFMT=D,,,,,,Y,Y,Y"

The last three "Y"s are used to suppress the page header, the standard first line, and the initial page eject, as those are not normally required.

  1.  To output via P4API using a tab as the field separator. The previous examples would be:

CRT:OUTFMT=D"\t"

API:OUTFMT=D"\t"

@RPTOPT=’10,API:OUTFMT=D"\t",,,,,,Y,Y,Y’

Note that the @RPTOPT uses single quotes to define the string literal, so that the field separator can be delimited by double quotes.

  1.  To use a two-character separator of a colon followed by a tab. The preceding examples become:

CRT:OUTFMT=D":\t"

API:OUTFMT=D":\t"

@RPTOPT=’10,API:OUTFMT=D":\t",,,,,,Y,Y,Y’

The "\t" represents a tab character; the separator is two bytes in length, even though there are three characters in the visible representation (the colon, a backslash, and a lowercase ‘t’). The backslash-t combination is counted as a single character.

The P4API calling program then goes through the standard sequence of P4API calls of p4SystemLogin() and P4OpenPro4(). It uses p4SetOutputFunction() to register a callback function which will be called every time a report line is received from the Task. P4API also returns an end-of-report condition through the callback function. At the termination of the Task, p4SetOutputFunction() should be called again to clear the callback if you do not want it used again for subsequent reports executed from the session.

The callback function receives the report data in a data buffer specified in a parameter. The data should be manipulated before the function returns, as the next report line will overwrite the buffer pointed to by the parameter.

Comment on this topic

Topic ID: 540144

 
 
 

Table of Contents

Index

Glossary

-Search-

Back