Page 1 of 1

Reading a Sequential File

Posted: Wed Feb 28, 2007 1:37 pm
by sshettar
Hi All,

Well have this job where in i'm using the seq output file of a server job as my input to the parallel job .
well this file has about 28 fields of which most of them are of type char and few of type integer , smallInt etc
and they are of fixed width format .
now i'm having a problem reading this file in parallel job . i have given the format Record Length fixed and delimiter as none.
but still its not able to open the file . the error it displays is as

>##E TOIX 000000 14:34:38(005) <Sequential_File_0> "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "TOTAL_CPW_VOL".
>##E TFSR 000019 14:34:38(009) <main_program> Could not check all operators because of previous error(s)




well i tried chaging the datatypes to varchar too , but still same problem appaers

How do i fix this problem ?

Thanks in advance

Posted: Wed Feb 28, 2007 1:42 pm
by us1aslam1us
You need to edit the field properties to make it fixed-width file. Try editing each field to a proper length.

Posted: Wed Feb 28, 2007 1:51 pm
by sshettar
How do i edit each field length?

. i thought i just had to change in the format tab as field > fixed width field
which directly would make the record length as fixed and delimiter as none

how else do i handle this ?

Thanks in advance

Posted: Wed Feb 28, 2007 1:56 pm
by kumar_s
Did you produced the output of the previous job in the same format as the current job's input? Does the metadata exactly matches? FieldDelimiter and Records Delimiter and all others?

Posted: Wed Feb 28, 2007 3:22 pm
by sshettar
as i told you earlier the file from server job is of fixed length and hence no delimiter and quotes
so i did the same thing in parallel too .
and the metadata is same

Where else do you think i'm going wrong?

Thanks in advance

Posted: Wed Feb 28, 2007 4:33 pm
by DSguru2B
Can you pull up the data using 'view data' in your server job that built this job? Whenever you build a flat file, all fields need to be char and length should be given properly.

Posted: Wed Feb 28, 2007 11:58 pm
by splayer
Your error says it very clearly. You have specified some columns with variable-length datatypes such as varchar and integer. An integer is variable length because the number that might be there in a cell is smaller than the width mentioned. As a result, actual size will be smaller.

Change everything to char and fixed-width and it'll take care of the problem. In PX, in sequentiall file stage, there does not seem to be a way to pick a variable length record exclusively other than specifying variable length field types such as varchar.

Posted: Thu Mar 01, 2007 10:09 am
by sshettar
Well i have kept all fields as char itself and few fields which were dates as dates only and few which were smallint as smallint itself.
i went and created the job were in the flow goes this way

from seqfile>>>>>transformer>>>>>>seq file

i just did a simple job to use how it works
well the job aborted and the fatal error it throws are

Sequential_File_0: Unable to initialize importer.

Sequential_File_0: "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "MAX_PROMO_PER_WK".

Sequential_File_3: Error when checking operator: Unable to initialize the exporter.

Sequential_File_3: Error when checking operator: "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "MAX_PROMO_PER_WK".

main_program: Could not check all operators because of previous error(s)

whatt does the first fatal error mean?

Can somebody help me resolve this issue

Thanks in advance

Posted: Thu Mar 01, 2007 11:16 am
by us1aslam1us
I guess the field "MAX_PROMO_PER_WK" is smallint and it is having a length less than 5(which is the maximum length for smallint). Either you need to pad that field by editing the field properties (In output sequential file) or change all the fields to char of fixed length.

Posted: Thu Mar 01, 2007 1:54 pm
by sshettar
Well when ever i tried to change the record length to fixed in the format tab ( in parallel job) and run the job i get a fatal error which says
Unable to initialize importer.

How can we define a fixed width columns in parallel job.

Thanks in advance

Posted: Thu Mar 01, 2007 2:35 pm
by splayer
Format/Record Level

Select Record Length from bottom right. Fixed is the default value.

Posted: Thu Mar 01, 2007 2:51 pm
by sshettar
i had tried the same thing before , but doesnt work as when i tried viewing the data it was all a mess .

is there any other way to view this kind of data?

Thanks in advance

Posted: Thu Mar 01, 2007 3:09 pm
by splayer
What is Record Delimiter? It should be Unix newline. What is your Field Delimiter? It should be None if you didn't have any to begin with. Your solution lies in the parameters.

Posted: Thu Mar 01, 2007 3:42 pm
by sshettar
Well my record Delimiter is Unix newline and Field delimiter is none . But still doesnt work.

Where else do you think i'm goin wrong ?

Posted: Thu Mar 01, 2007 4:56 pm
by Yuan_Edward
You will need to set up an additional property for variable-length fields for fixed-width files.

Double click each column in the Column page of the sequencial file stage and in the popup window Edit Column Meta Data set the Field Width property for each of the fields. It should work for all data types.
sshettar wrote:Well my record Delimiter is Unix newline and Field delimiter is none . But still doesnt work.

Where else do you think i'm goin wrong ?