Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2016
    Posts
    4

    Question Unanswered: 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.

  2. #2
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    66
    Provided Answers: 6
    Hi,

    Try to convert such a value to its string representation like this:
    Code:
    select hex(x'010203')
    from sysibm.sysdummy1
    Regards,
    Mark.

  3. #3
    Join Date
    Aug 2016
    Posts
    4
    Quote Originally Posted by mark.bb View Post
    Hi,

    Try to convert such a value to its string representation like this:
    Code:
    select hex(x'010203')
    from sysibm.sysdummy1

    Hi

    I am getting following error:
    SQLCODE = -110, ERROR: INVALID HEXADECIMAL CONSTANT BEGINNING

    The value in the field seems to be encrypted, so i am getting junk value on unloading the table.

    Please advice.

  4. #4
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    66
    Provided Answers: 6
    Which query returns such an error?
    This one above works well on my zDB2.
    What's your zDB2 version?

    The CHAR FOR BIT DATA value can't be "encrypted". This value is simply a set of bytes, and if you want to have in a "readable" form, you can use hex function to get the string representation of such a set of bytes.
    Regards,
    Mark.

  5. #5
    Join Date
    Aug 2016
    Posts
    4
    Hi

    I am running SELECT query on the table using HEX display and it is throwing the above error.
    The DB2 version is 10.

    Regards
    Atul

Posting Permissions

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