CSV-Workfile + X-Array = NAT6256. Why?

Hello all!

Could you understand that type of error in this context? From my point of view it doesn’t make any sense…

define data local
1 #x-array(A10/1:*)
1 #i2 (I2)
end-define
define work file 1 '/tmp/x-array.txt' type 'CSV' /* type 'ASCII' works
expand array #x-array to (1:2)
#x-array(1) := 'LINE1'
#x-array(2) := 'LINE2'
for #i2 = 1 to *UBOUND(#x-array)
  write work file 1 variable #x-array(#i2)  /* NAT6256 here
end-for
close work file 1
end

Matthias,

the documentation says:

Subject to the length constraint, you could COMPRESS what would have been the Xarray occurrences into a single dynamic variable with appropriate “delimiter”.

Thanks for answering.

The point is: I din’t write write work file 1 #x-arrayb[/b]. Why shouldn’t it be possible to use a single field out of an x-array?

But OK, let’s do a workaround.

I want to use the CSV-functionality. BTW: a CSV-COMPRESS would be nice…

At least on the PC (haven’t tried mainframe yet) you can COMPRESS with individual members of an Xarray and, can COMPRESS #XARRAY (*) where #Xarray is a dynamic array.

Of course, you still have the length restriction, and still cannot write a CSV work file record with an Xarray.

steve

Already there, called COMPRESS WITH DELIMITERS

No, it isn’t there. Try this to see the difference:

define data local
01 #struct
02 #field1  (A3) init <'1;1'>
02 #field2  (A3) init <' 2'>
02 #field3  (A3) init <'333'>
01 #a       (A50)
end-define
define work file 1 '/tmp/test.csv' type 'CSV'
define work file 2 '/tmp/test.csv' type 'ASCII'
write work file 1 #struct
close work file 1
read work file 2 once #a
write 'CSV-WORKFILE............:' #a
compress #struct into #a with delimiters ';'
write 'COMPRESS WITH DELIMITERS:' #a
end