Results 1 to 9 of 9

Thread: for bit data

  1. #1
    Join Date
    Sep 2009
    Posts
    66

    Unanswered: for bit data

    What does it mean when a column is defined as CHAR(10) FOR BIT DATA?

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  3. #3
    Join Date
    Sep 2009
    Posts
    66
    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?

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  5. #5
    Join Date
    Sep 2009
    Posts
    66
    Can regular char data be stored in this column?

  6. #6
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  7. #7
    Join Date
    Jun 2009
    Location
    Pennsylvania
    Posts
    22
    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.

  8. #8
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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).
    Last edited by Marcus_A; 02-10-11 at 16:39.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  9. #9
    Join Date
    Aug 2016
    Posts
    4

    How to convert 'FOR BIT DATA' field to readable format?

    Hi All

    I am trying to unload a table into a mainframe file. The table structure contains a field with datatype CHAR(13) FOR BIT DATA NOT NULL.

    Please guide how to convert this field in to a readable field in the file. Thanks in advance for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •