DB2/400 field to match an Oracle VARCHAR?

5 pts.
Tags:
AS/400 interoperability
DB2 connectivity
DB2/400
DDS
Oracle development
Oracle interoperability
Oracle VARCHAR
VARCHAR
We are having trouble trying to use a 255 byte key in DB2/400 DDS specs. We use Oracle VARCHAR keys 255 bytes long all the time. How do we specify a DB2/400 key to be like an Oracle VARCHAR? Note: in an Oracle VARCHAR the trailing spaces are compressed out. In a pure 255 DDS field, apparently any data to the right of the real data inserted becomes spaces? How do we get our Oracle Data Model requiring VARCHAR 255 keys to work on an AS/400? Note the key works from AS/400 programs and commands, it is failing IBM DB2 ODBC client server access. We can insert from the varchar, but afterwards we cannot query back out of the DB2/400 without a terminal error.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

The equivalent VARCHAR for DDS is Keyword VARLEN. DB2/400 uses a 2 bytes prefix to store the real length of data and if you are using a 255 bytes VARCHAR you will define

<pre>
A KEY 255A <b>VARLEN</b>
</pre>

It will use 2 additional bytes to store the data on disk.

I hope it will help you.

Regards,

Wilson

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following