View previous topic :: View next topic
|
Author |
Message |
Puspojit
New User
Joined: 10 Mar 2008 Posts: 34 Location: Pune
|
|
|
|
Hi,
I have a sequential file where there is a numeric field having data type as
9(03).The file has few other fields as well.
My requirement is to load the data of this file in to a Table where the numeric field has been declared as
NUM_OFFICE DECIMAL(3,0)
Now, when I try to load this file , I get an error
Code: |
RECORD (1) WILL BE DISCARDED DUE TO 'NUM_OFFICE' CONVERSION ERROR
|
I would like to know if I need to write a seperate COBOL program to
compress the numeric field before Loading or is there an way out in the Load job itself?
Thanks and regards,
Puspojit |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
How is the field defined in the LOAD control cards? |
|
Back to top |
|
|
Puspojit
New User
Joined: 10 Mar 2008 Posts: 34 Location: Pune
|
|
|
|
The field is defined as
Code: |
NUM_OFFICE POSITION(1:3) DECIMAL PACKED
|
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Puspojit wrote: |
The field is defined as
Code: |
NUM_OFFICE POSITION(1:3) DECIMAL PACKED
|
|
9(3) is not packed try
Code: |
NUM_OFFICE POSITION(1:3) DECIMAL
|
|
|
Back to top |
|
|
Puspojit
New User
Joined: 10 Mar 2008 Posts: 34 Location: Pune
|
|
|
|
Hi Craq,
I tried with
Code: |
NUM_OFFICE POSITION(1:3) DECIMAL |
But I am getting the same error message.
Regards,
Puspojit |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Code: |
NUM_OFFICE POSITION(1:3) DECIMAL EXTERNAL
|
Try reading the DB2 Utility Guide & Reference |
|
Back to top |
|
|
Tom Bowman
New User
Joined: 15 Jun 2009 Posts: 3 Location: Minnesota, USA
|
|
|
|
Try running an UNLOAD (using DSNUPROC), then see what SYSPUNCH thinks the format is for the field. For example (from one of my generated SYSPUNCH outputs):
( "CTL_NBR"
POSITION( 00003:00006) INTEGER (PIC S9(09) COMP)
, "PARTITION_NO"
POSITION( 00007:00008) SMALLINT (PIC S9(04) COMP)
, "TRANSMISSION_YR"
POSITION( 00009:00011) DECIMAL (PIC S9(04) COMP-3)
, "DATE_RCVD"
POSITION( 00031:00040) DATE EXTERNAL (PIC X(10))
NULLIF(00030)=X'FF'
)
Note: SYSPUNCH POSITIONS start in 00003 because UNLOAD generates first 2 bytes.
You have not showed what the input data is like, for example for NUM_OFFICE of 24:
24 ? (Hex'F2F440')
024 ? (Hex'F0F2F4') but not COMP-3/Packed...
X'024C' ? (this would be Packed/COMP-3)
Of the 4 formats shown in the example, only Date would be readable in EBCDIC as Character (eg:'2009-06-18').
You may need a program (or some kind of conversion, SORT can do this) to make 'PIC 9(3) DISPLAY' (3 Bytes) into 'PIC 9(3) COMP-3' (2 bytes).
9(3) DISPLAY VALUE 123 is X'F1F2F3' - 3 Bytes
9(3) COMP-3 VALUE 123 is X'123F' (sign 'F' for initial value, 'C' after math) 2 bytes. |
|
Back to top |
|
|
Raghu navaikulam
Active User
Joined: 27 Sep 2008 Posts: 193 Location: chennai
|
|
|
|
Hi Puspojit
Since the field is defined as DECIMAL(3,0) and the data is in the PS file is in external format, you have to use
Code: |
NUM_OFFICE POSITION(1:3) DECIMAL EXTERNAL |
Regards
Raghu |
|
Back to top |
|
|
|