ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Mixed Latin1 and Latin2 on 5250?

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

  • Mixed Latin1 and Latin2 on 5250?

    What is the perfect solution for having mixed environment (Latin1 & Latin2) of CCSID in the same database on IBM i? The database should hold US characters, Danish characters and Polish characters in the same physical file. Some records must even contain mixed special characters for all languages at the same time. To me UTF8 seems to be the perfect solution but we have a big issue when it comes to 5250 ? 5250 does not support UTF8. However, 5250 supports DBCS and this seemed to be a good solution because it is possible to convert UTF8 <=> DBCS on the fly. Unfortunately we have realized that DBCS always seems to occupy double data on the screen. This means that subsequently fields to disappear from the screen. As far as I know DBCS was original made to please Japanese environment where the users should be able to use a special key sequence (shift in and shift out) when typing Katakana.

    My question: do any of you know a way to only occupy the defined amount numbers of bytes in a DBCS field?

  • #2
    Why not use UCS-2/UTF-16?

    5250 supports it, and since it's Unicode, it should support nearly all characters from all major languages/cultures.

    Comment


    • #3
      The DDS 'G' type with CCSID 13488 is actually the "UCS-2" type. If you put CCSID 1200, it would be UTF-16. (These types are both considered as "UCS-2" by RPG.)

      Data with CCSID 13488 or 1200 doesn't necessarily require 2 bytes on the screen. That only happens for true Graphic characters such as Chinese or Japanese. Latin characters only require one byte on the screen. So if you know your data will only be Latin characters, you can use the same number of characters as you would for an A field.

      Comment


      • #4
        The reason for choosing UTF8 rather than DBCS is that we try to reuse as must as possible ? as easy as possible. We do not need to recompile all programs if we just change some of the needed character fields to UTF8 - e.g. names and addresses. And we do not need to expand the length of the converted fields because only few of the data records contain special characters. If we use UCS2 all characters will to two bytes each and we then need to do a lot more work.

        However, I?m have successfully managed to convert to UCS2 from UTF8 directly to screen. But here the problem occurs ? 5250 makes the input field double size as expected. E.g. if I have a char(30) field a 60 byte input field is displayed and I can only enter 30 bytes into the field on screen (Fig1) (The DDS looks like Fig2)

        To me it looks like an ACS problem, do you agree?

        Comment


        • #5

          Comment


          • #6
            Problem solved. We found out that the ?Protect Unicode Field Length? in the ASC Configuration must be set to NO:



            Click image for larger version

Name:	ASC.jpg
Views:	0
Size:	67.9 KB
ID:	148326

            Thanks for your help.

            /Bent

            Comment

            Working...
            X