If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > for bit data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-11, 20:56
L_DBA_L L_DBA_L is offline
Registered User
 
Join Date: Sep 2009
Posts: 49
for bit data

What does it mean when a column is defined as CHAR(10) FOR BIT DATA?
Reply With Quote
  #2 (permalink)  
Old 01-28-11, 23:08
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
That it contains binary data that will not be converted to/from the server codepage to/from the client codepage when the data is inserted, selected, etc.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 01-29-11, 20:44
L_DBA_L L_DBA_L is offline
Registered User
 
Join Date: Sep 2009
Posts: 49
I have a data file from DB2-zOS and need to load it on DB2-Linux. One of the columns is defined as CHAR(10) FOR BIT DATA on the mainframe. How do I define this column on DB2-Linux? The same as it exists on zOS? Do I need to use the codepage modifier on the load command?
Reply With Quote
  #4 (permalink)  
Old 01-29-11, 22:22
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
You probably need to find out what is in the column. Generally bit data is something like an audio file (mp3, etc) or a picture file (jpg, etc) or a MS Word document, PDF file, etc, so in these cases you would not translate the code page and just define it as bit data in Linux also. However, I am a little suspcious becasue these type of files are usually much larger than 10 bytes and are usually defined as a varchar for bit data.

If the application program is using the 10 bytes defined as bit data as a bunch of binary switches (80 of them in the 10 bytes) to save space, then you may need to convert it to a new code page if the application programs are also changing platforms (from z/OS to Linux, etc).

Bottom line, find out what is in the column, how it is used, and find out if the application programs will be running on a different platform than before.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 01-30-11, 19:35
L_DBA_L L_DBA_L is offline
Registered User
 
Join Date: Sep 2009
Posts: 49
Can regular char data be stored in this column?
Reply With Quote
  #6 (permalink)  
Old 01-30-11, 23:26
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by L_DBA_L View Post
Can regular char data be stored in this column?
Yes, but if the client that retrieves it has a different code page (Windows, AIX, etc) then it may not be intelligible to them.

You probably should do some reading about ASCII vs EBCDIC, Big Edian vs Little Endian, etc, to understand how data is stored in computers. Either that, provide the information I previously asked for in order to get some advice that makes sense for your particular application/database.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #7 (permalink)  
Old 02-10-11, 15:04
davebert99 davebert99 is offline
Registered User
 
Join Date: Jun 2009
Location: Pennsylvania
Posts: 21
We use a field defined as VARCHAR(80) FOR BIT DATA to store encrypted SSN's using the ENCRYPT_TDES function. You must use this data type for this kind of data.
Reply With Quote
  #8 (permalink)  
Old 02-10-11, 15:29
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by davebert99 View Post
We use a field defined as VARCHAR(80) FOR BIT DATA to store encrypted SSN's using the ENCRYPT_TDES function. You must use this data type for this kind of data.
That is true for the ENCRYPT_TDES function where data is encrypted inside DB2, but most data encyrpted by applications uses Base64 (or similar) encoding (before it is stored in DB2), and in that case you must not use FOR BIT DATA becasue the data has been converted to text characters which are expected to be translated correctly if the DB2 client is different code page than the DB2 server.

An example of Base64 encoding is "bGVhc3VyZS4=" (note that all characters are printable ascii character set).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390

Last edited by Marcus_A; 02-10-11 at 15:39.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On