Archives of the TeradataForum
Message Posted: Wed, 04 Feb 2004 @ 17:41:27 GMT
| Subj: || || Re: Representing Nulls In a FASTEXPORT Output File |
| From: || || Geoffrey Rommel |
| ||Documentation says that MODE INDICATOR is one way to communicate this information. However, I am having trouble finding detailed
documentation on how the indicator area is defined.|| |
Cornelius's answer (using a CASE expression) is a good one, but if you really want to know... In indicator mode, a number of bytes are
prepended to each record in which the bits correspond one for one, left to right, with the exported fields. If the bit is on, the field is null;
if off, not. There will be enough bytes to accommodate all fields; if the number of fields is not a multiple of 8, the last few indicator bits
will be unused.
For example, suppose you are exporting 14 fields. Each record will then get 2 indicator bytes on the front. The first byte will contain 8
indicator bits; the second, 6 indicator bits and 2 unused bits. The exported fields follow.
The full explanation is in the manual CLIv2 for Channel-Attached Systems, Appendix E ("Parcels"), under "IndicData".
Now the tricky part:
| ||So a COBOL example of how to define the area would be absolutely wonderful.|| |
Two indicator bytes would be defined as pic X(2). Cobol, as you know, isn't too swift when it comes to handling bit fields. Perhaps your best
bet would be to write a subroutine in Assembler or C that would unpack the bits for you. In some cases, you might be able to use hex literals; for
instance, to see whether the topmost bit is on, you could test indicator-byte >= x'80'.