Page 1 of 1

Reading from COBOL file

Posted: Tue Jun 17, 2008 1:43 am
by Roopanwita
Hi,
My job reads from COBOL file(used sequential file as source) and write into ORACLE stage.
In my sorce file columns are Decimal & NChar. The job is getting aborted with arror msg "seq_src,0: Field "<column name>" has import error and no default value; data: {0c 00 00 00 " P 0c @ @ @ @}, at offset: <--> " . and it is giving problem with column which has datatype Decimal.
If I change the datatype of Decimal column to Integer, the column value becomes different (eg - when datatype is Decimal a column value shows '25.' & when I cahne datatype to Integer it shows '-987672911')
If I am using Complex Flat file as source the job is running properly n data is populated properly.(as to make job design consistent I dont want to use CFF ,as other jobs are working prperly wth same design- with Sequential File)

thanks,

Posted: Tue Jun 17, 2008 1:45 am
by ArndW
What is the COBOL field definition for this column? It looks like a non-standard COMP-3 with leading sign from the binary.

Posted: Tue Jun 17, 2008 1:54 am
by Roopanwita
COBOL file column defn Netive type =DECIMAL, Length =2 ,Scale=0,Level number =02,Sign indicator =Signed, Usage= COMP-3

Posted: Tue Jun 17, 2008 2:08 am
by ArndW
That is not the COBOL definition, but is close and might be enough. I don't like the "0c" hex at the beginning which would indicate a leading sign which is nonstandard. If your COBOL doesn't have a leading sign specificed then you probably already have a wrong position. Also, the data type is 2 digits yet you seemt to have 10 or 11.

Posted: Tue Jun 17, 2008 3:06 am
by Roopanwita
I have noticed that when Column value is Decimal(2) then it is returning value '15.', which seems proper, but if i m converting it to Integer(2) ,it is returning '-717222919'.Is it the value in some other format.

I couldnt understand "If your COBOL doesn't have a leading sign specificed then you probably already have a wrong position. " this line..can you please explain me...
thanks

Posted: Tue Jun 17, 2008 3:27 am
by ArndW
COMP-3 is also known as BCD where each position is encoded in 4bits. Another 4 bits are used for the sign and the result is padded to an even byte boundary. If you declare it as binary integer, then the 16 bits are used as an excess-128 representation and you get the negative number.