Description
On the first call, this API opens the file for output if it
is not already open. If it has a header, it formats and writes the
header, and determines from the use flags the order the fields are
to be written (for information, see Use Flag (UF) Fields).
Note: the first write to an unopened file cannot occur within
a transaction state.
On subsequent calls, it formats and writes a record with data
from working storage (REC area), writing only those fields with use
flags on.
Return Values
One record is written in the CSV work file.
Programming Example: Writing to a CSV File
CALLP S@CSVOPOUT@WFT OpnOutput WFGLTRANS 000000
CALLP S@CSVALLUS@WFT All Used WFGLTRANS 000000
CALLP DN@DBGLGLT1(E@DBFINDGE) 000000
DOW DGLT@NOTFOUND = FALSE 000000
AND DGLTCMPNY = D@CMPNY 000000
CALLP SUNGLTR Unload Gltrans 000000
ENDDO 000000
CALLP S@CSVCLOSE@WFT Close WFGLTRANS 000000
******************************************************************
* SUNGLTR - Unload Gltrans
******************************************************************
SUNGLTR B EXPORT
SUNGLTR PI
*
IF PWS@PRDADJ <> *ZEROS
IF DGLTACCPRD = 99
GOTO GUNGLTR@NXGLT
ENDIF
ENDIF
EVAL WWFTGLTFSC = DGLTFSCLYR
EVAL WWFTGLTACC = DGLTACCPRD
EVAL WWFTGLCOGR = DGLTCNTRGR
EVAL WWFTGLSQ = DGLTJSQNC
EVAL WWFTGLTSYS = DGLTSYSTEM
. . .
EVAL WWFTGLRPT2 = DGLTRPRT2
EVAL WWFTGLND = DGLTRPTND2
CALLP S@CSVWRITE@WFT
*
GUNGLTR@NXGLT TAG
CALLP DN@DBGLGLT1(E@DBFINDNXT)
*
SUNGLTR E
******************************************************************
|