ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CONVERT DBCS-OPEN Data type to DBCS-Graphic Data type

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CONVERT DBCS-OPEN Data type to DBCS-Graphic Data type

    Please help ...
    CONVERT DBCS-OPEN Data type to DBCS-Graphic Data type
    old file has O data type in my PF but new files has G datatype. I need to convert the data from old to new.

  • #2
    Does simply copying the data not work? I would have thought the database would have taken care of the conversion.

    Comment


    • #3
      No, The open type has CCSID 937 and the graphic value has a ccsid 13488.

      Comment


      • #4
        What is your job CCSID, or system CCSID if job CCSID is not set? Is it perhaps 65535? If so, then the CPYF will not work as required. Set the job CCSID to a proper CCSID e.g. 37, then it might work.
        Regards

        Kit
        http://www.ecofitonline.com
        DeskfIT - ChangefIT - XrefIT
        ___________________________________
        There are only 3 kinds of people -
        Those that can count and those that can't.

        Comment


        • #5
          CPYF FMTOPT(*MAP) worked for me to convert between type O with CCSID(937) and type G with CCSID(13488).

          Here's what DSPPFM shows for the file with the Open data type (10O CCSID(937):
          Code:
          C1C2C3C4 C5C6C7C8 C9D1   (the EBCDIC value for 'BCDEFGHIJ'
          0E414141 42414341 440F   (some DBCS characters, surrounded by shift-in and shift-out)
          Here's what DSPPFM shows for the file with the UCS-2 data type (10G CCSID(13488).
          Code:
          00410042 00430044 00450046 00470048 0049004A   (the UCS-2 hex value for 'ABCDEFGHIJ')
          03B103B2 03B303B4 00200020 00200020 00200020   (the UCS-2 version of the 4 DBCS characters)
          Any DBCS data in the Open field will have fewer characters than the number of bytes. For my file, the first record has 10 EBCDIC characters, and the second record only has 4 DBCS characters. Your UCS-2 field in your new file should be at least as many characters as your Open field, but unless you make it varying length (VARCHAR in SQL, or VARLEN keyword in DDS), you'll have blanks following any DBCS data. (The x'0020' are blanks in the second record of my second file).

          So I would make the G field in your new file be varying length.

          Comment

          Working...
          X