Reputation: 137
We are attempting to load a .txt file into Trillium for analysis, and a .cbl file as the data schema.
The .txt file has data that looks like this:
Record 1: 1234560001001
Record 2: 12345670001001
COLUMN_1 has a maximum of 7 chars, COLUMN_2 must be 4 chars, COLUMN_3 must be 3 chars.
I created a COBOL file like so:
02 COLUMN_1 PIC X(07).
02 COLUMN_2 PIC X(04).
02 COLUMN_3 PIC X(03).
But Trillium has parsed it out like so:
1234560 0010 01
1234567 0001 001
I am unsure how to rectify this issue. Any thoughts?
Upvotes: 0
Views: 416
Reputation: 4116
You'll want to right justify your input records. Numerous ways of shuffling the data around. Simplest is probably
01 justright PIC X(14) JUSTIFIED RIGHT.
GnuCOBOL (and others as far as I know) also include support for
CALL "C$JUSTIFY" USING source-field "R" END-CALL
Modified in place to size of field. 14 in this case.
But if all you have is a foreign parser of the record layout, then as Rick commented, you may need to write code based on the rules for length of the data destined for COLUMN_1.
Upvotes: 1