I’m writing a CSV which contains a D-format field. Occasionally the date field is empty. Here is the output.
1,08/14/2012,0
2,,0
3,08/16/2012,0
4,,0
5,08/18/2012,0
I find it interesting that Natural writes “0” for an empty packed numeric, but writes a true null for an empty date field.
Natural fails with an error 1143 (input does not correspond to input edit mask) when it encounters the null date value in a READ WORK. I would expect him to be able to read what he himself has written. Is there a NatParm or other option that I’m overlooking?
Here is the code that produced the output, above.
DEFINE DATA LOCAL
1 #D (D) INIT <*DATX>
1 #P (P3)
1 #I (I4)
END-DEFINE
FORMAT ZP=T
DEFINE WORK FILE 1 'C:\rgz.txt' TYPE "CSV"
FOR #I = 1 5
IF #I / 2 * 2 = #I
THEN
RESET #D
ELSE
RESET INITIAL #D
ADD #I TO #D
END-IF
WRITE WORK 1 #I #D #P
END-FOR
*
READ WORK 1 #I #D #P
DISPLAY #I #D #P
END-WORK
END