Kbase 18489: Output Delimited Text Generated By SQL Select Statement
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  21/08/2003 |
|
Status: Unverified
GOAL:
How to use the PUT statement based on data generated by the SQL SELECT statement.
FIX:
1) Connect to the SPORTS database and open the procedure editor.
2) Type, or copy and paste, the following code:
DEF VAR v-c LIKE customer.cust-num.
DEF VAR v-n LIKE customer.name.
DECLARE c01 CURSOR FOR SELECT cust-num, name FROM customer.
DEFINE STREAM s1.
OPEN c01.
OUTPUT STREAM s1 TO selecttest.txt.
REPEAT:
FETCH c01 INTO v-c, v-n.
PUT STREAM s1 v-c v-n "|".
END.
OUTPUT STREAM s1 CLOSE.
Run the program. The Output file should appear as follows:
1Lift Line Skiing | 2Urpon Frisbee | 3Hoops Croquet Co.
| 4Go Fishing Ltd |