Tip – Always state CONCATENATE or NOCATENATE
Every LOAD statement should state its intention to
concatenate or not via the CONCATENATE and NOCATENATE keywords unless assumed
concatenation is the intended course of action in which case a /* comment */ should be placed near LOAD to remind
the developer.
QVW assumes that you want to concatenate if the new table
being loaded has identical field names to a currently loaded table. (The
field sequence or contents doesn’t matter, only the names, including capitalization of those names). This can be what
you intended but often it is not. QVW will not warn, log or otherwise
indicate that it has assumed you want to concatenate and that can be an issue
when you didn’t intend concatenation to happen.
Naming the new table in the LOAD statement does not prevent
concatenation either.
Problem1:
Table1:
LOAD
field1
<etc>
;
Table2:
LOAD
field1
<etc>
;
Table1 will exist but Table2 wont. Table1’s contents are
automatically concatenated with the contents of the LOAD statement for Table2.
Table2 itself is never created as a separate table.
Solution:
Table1:
NOCONCATENATE
LOAD
field1
<etc>
;
Table2:
NOCONCATENATE
LOAD
field1
<etc>
;
Both Table1 and Table2 will exist.
See Tip – “Detecting QVW’s automatic renaming of tables”
with a procedure that will help your code be more aware that QVW did something
unexpected.
No comments:
Post a Comment