|
View previous topic :: View next topic
|
| Author |
Message |
abhijit.nayak01
Active User
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
|
|
|
|
I got a issue with DB2 data requirement.
Got a DB2 table in which one column XYZ is VARCHAR (1000).
A file has a field which is PIC X(18). Trying to load the table using the file.
Load is successful but the requirement is the DB2 table the rest of 982 fields of DB2 column
shouldn't contain space.
Thanks,
Abhijit. |
|
| Back to top |
|
 |
gylbharat
Active Member
.jpg)
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
Then what is should contain?
You need to modify the file to add RDW for the varchar field. |
|
| Back to top |
|
 |
abhijit.nayak01
Active User
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
|
|
|
|
Got another doubt: Are low values of the file and the NULL value of DB2 are same.
Meanwhile I got the solution from one of my senior which I will try on Monday:
to use 2 byte binary length field before varchar field and
the field to be S9(4) comp value +1000. |
|
| Back to top |
|
 |
gylbharat
Active Member
.jpg)
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
But if you put length as 1000 then all the 1000 bytes will be populated to the varchar filed. but you want only 18 bytes rite?
NULL is nothing to do with low-values. NULL tells DB2 that this columns does not have any value. |
|
| Back to top |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
| abhijit.nayak01 wrote: |
| Got another doubt: Are low values of the file and the NULL value of DB2 are same. . |
NO! Low values (a COBOL term) are a value, NULL in DB2 is the lack of any value. |
|
| Back to top |
|
 |
db2sysdba.zos
New User
Joined: 04 Oct 2011 Posts: 25 Location: INDIA
|
|
|
|
| Whether the column 'XYZ', is last column of your table definition or not? |
|
| Back to top |
|
 |
abhijit.nayak01
Active User
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
|
|
|
|
No the xyz column is not the last column. Actually the table's column is varchar (1000) and initially the file field value was also 1000 but the requirement change came i.e. in a file only 18 character field wil come no matter what is the field length of the file and that field wil be loaded to the xyz column which has 1000 length. And if the 18 character is loaded to the table then rest of 982 character should be spaces.
My another senior said to use NOPAD option while loading which I can only check on monday as there is a three day holiday. |
|
| Back to top |
|
 |
db2sysdba.zos
New User
Joined: 04 Oct 2011 Posts: 25 Location: INDIA
|
|
|
|
Yes! your senior's advice is right.
Added to his Information,
always place VARCHAR columns at last of the table definition. It will increase your performance. |
|
| Back to top |
|
 |
|
|