Archives of the TeradataForum
Message Posted: Mon, 14 Feb 2005 @ 16:04:51 GMT
I have to load data from a flatfile into a table. This file is made up of serveral parts of data, each consisting out of one header-record and zero-n position-records, representing data from one shop. Only the header records have a prefix so that the records have a completely different format, unlinke the examples in the teradata factory materials. Everything is fixed length and filled with leading zeros.
Header-records looks like this:
A(shop-id,7)(date,6) ex: A7777777050101
A positonal record like this:
(item-id,13)(filler,1)(quantitiy,9)(price,10) ex: 1111111111111+2222222223333333333
Now I have to fill records in a table that have to include the following information:
shop-id, date, item-id, quantitiy, price
I tried to load these records by applying the following layout, hoping to be able to ask wether the FLAG is filled with an A in the apply clause, then clear that varible, and "skip" the record, meaning to not insert anything.
.FILLER in_FLAG 1 CHAR(1); .FIELD in_SHOP 2 CHAR(7); .FIELD in_DATE 9 CHAR(6); .FIELD in_ITEM 1 CHAR(13) DROP LEADING NULLS; .FILLER in_FILLER 14 CHAR(1); .FIELD in_NUMBER 15 CHAR(9) DROP LEADING NULLS; .FIELD in_PRICE 24 CHAR(10) DROP LEADING NULLS;
So far, I have failed as he always applies the wrong part of the layout part. even if I "cheat" and let "in_item" start at position 2 for a char(12), assuming that the item id never has more than 12 digits (as it is converted to a decimal later on) multiload quits and takes the second half of the layout for a header record.
I would be thankful for any kind of help!
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|