Reading a Sequential File

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Reading a Sequential File

Post 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
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

You need to edit the field properties to make it fixed-width file. Try editing each field to a proper length.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Post 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
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Post 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
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post 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.
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Post 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
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post 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.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Post 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
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

Format/Record Level

Select Record Length from bottom right. Fixed is the default value.
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Post 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
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post 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.
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Post 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 ?
Yuan_Edward
Participant
Posts: 73
Joined: Tue May 10, 2005 6:21 pm
Location: Sydney

Post 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 ?
Edward Yuan
Post Reply