Stream Issue

skunal

Member
I have following stream for generating the CIM file ....

output stream arquivo to 'zzprmptr1cg.cim'.
for each tt-carga no-lock:
put stream arquivo '"' at 01 tt-carga.t-site '" ' skip
'"' at 01 tt-carga.t-fornec '" ' skip
'"' at 01 tt-carga.t-item '" ' skip
'"' at 01 tt-carga.t-lugar '" '
'"' tt-carga.t-conta format '99999' '" ' skip
'"' at 01 tt-carga.t-qtde format '99999' '" ' skip
'S' at 01 skip
'.' .
end.
output stream arquivo close.

BUT when i see the CIM file generated the dot(.) is appearing only once for first record while other records are coming without it SO my data is not getting loaded properly. Can anyone tell me why does dot appears only once.. the generated CIM file looks this way

"10010 "
"10000008"
"10763103 "
"AJC05A5 " "20 "
"200 "
S
.
"10010 "
"10000008"
"10763117 "
"AJB05F2 " "10 "
"200 "
S
"10010 "
"10000008"
"10763693 "
"AJC04D2 " "0 "
"0 "
S
 
Please use the code tags when pasting code.

Code:
DEFINE TEMP-TABLE tt
   FIELD ii AS INT
   .




CREATE tt. tt.ii = 1.
CREATE tt. tt.ii = 2.
CREATE tt. tt.ii = 3.


DEFINE STREAM arq.


OUTPUT STREAM arq TO "c:\temp\blaat.txt".


FOR EACH tt:
   PUT STREAM arq '"' AT 01 tt.ii '"' SKIP
   '"' AT 01 tt.ii '" '
   '"' tt.ii FORMAT '99999' '" ' SKIP
   'S' AT 01 SKIP
   '.'
   .
END.


OUTPUT STREAM arq CLOSE.

Works fine (using 10.2B04).

Note that you do not need to AT 01 when outputting data after a skip, SKIP will automatically position cursor back to column 1.
 
I would say you need to put a SKIP after the dot. Otherwise the next PUT command will write to the same line, and because the first item goes "AT 1", it will overwrite the dot. I'd also be tempted to use PUT UNFORMATTED when writing data out.

HTH
Tarby
 
Back
Top