DB2 EBCDIC TO SQL Server in SSIS

  • I have a description column in DB2 that I'm importing into a varchar(50) column in SQL Server 2012.  On the DB2 side, I see some chars that look like apostrophes and hyphens.  They import as question marks.  I found this solution for translating EBCDIC to ASCII:

    https://www.mssqltips.com/sqlservertip/3438/importing-mainframe-data-with-sql-server-integration-services/

    Sounds good in theory, but my output column ends up completely blank, not "repaired".  There are business reasons why I cannot simply replace with emptystring, etc.  I need the hyphen to look like a hyphen, and the apostrophe to look like an apostrophe.

    Thoughts?

    [font="Courier New"]ZenDada[/font]

  • there may be a lot more to it.

    first how are you extracting from DB2
    - Direct connection from SSIS (OLEDB or similar)
      -- in this case what is the code page selected on your connection - and have you tried other options
    - through a downloaded file
      - in this case is the file downloaded
        -- on binary mode
        -- on asci mode -- on this case the conversion code page may change the data incorrectly

    When you query the data in question on the mainframe what do you see for that character - and is this through a web page or through a terminal emulator. Again you may think the value is one thing and in reality it is a different one

    If the data you are transferring from DB2 happens to be data created by a COBOL program and eventually with COMP fields defined on that field you will be up to another load of problems - of which the first is to download in ebcdic/binary mode and process the data locally - for which you will need to know the exact definition of those COMP fields.

  • I would be curious to know if you could not resolve the issue by explicitly converting the source field (select cast(...)) and then using nvarchar as your destination data type? 

    Also check the properties of your DB2 DSN, as those could affect the results when extracting via the ODBC.

  • frederico_fonseca - Thursday, October 4, 2018 5:46 PM

    there may be a lot more to it.

    first how are you extracting from DB2
    - Direct connection from SSIS (OLEDB or similar)
      -- in this case what is the code page selected on your connection - and have you tried other options
    - through a downloaded file
      - in this case is the file downloaded
        -- on binary mode
        -- on asci mode -- on this case the conversion code page may change the data incorrectly

    When you query the data in question on the mainframe what do you see for that character - and is this through a web page or through a terminal emulator. Again you may think the value is one thing and in reality it is a different one

    If the data you are transferring from DB2 happens to be data created by a COBOL program and eventually with COMP fields defined on that field you will be up to another load of problems - of which the first is to download in ebcdic/binary mode and process the data locally - for which you will need to know the exact definition of those COMP fields.

    This is a direct connection with ODBC.

    [font="Courier New"]ZenDada[/font]

  • How is the field defined in DB2, is it varchar or is it a varbinary?

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply