SupportJPG
  Support Home   |   Search   |   Documentation
ArticleId = kb000122

HOWTO: Keep AS/400 data from being translated to ASCII.

The information in this article applies to:

    • ASNA Visual RPG
    • Aceler8DB
    • AS/400

SUMMARY:

This information below will help you keep AS/400 data from being translated to ASCII when sending information to/from a PC Client machine.

STATUS:

Current.

MORE INFORMATION:

When you have bit-wise data stored on the AS/400, it gets translated to its ASCII equivalent when retrieved by AVR or the Acceler8DB Toolboxes if you have defined the data file field as a CHARACTER data type.

Acceler8DB does not translate data defined as HEX. To avoid modifying other AS/400 applications, it may be easiest to define a logical view over the existing data file with non-translation fields defined as HEX.

Figure 1 demonstrates the physical file that has a character field that is being translated.

 

Figure 1

Figure 2 demonstrates the logical file that has the HEX field that is "mapped" over the character field in the physical file.

Figure 2

Figure 3 shows the data in the physical file. Notice the translation, or characters that aren't legible.

Figure 3

Figure 4 shows the data in the logical file.  Notice the HEX data.

Figure 4

Figure 5 shows AVR code that will translate the HEX data into ASCII data for only one character that isn't mapping correctly.  You will need to create your own translation tables to read each HEX character representation.

// AVR provides an XLATE RPG Op-Code:

dcldiskfile myfile dbdesc("cot_5045") type(*input) org(*indexed) filedesc("petertst/trnslxnl1")

dclfld mykey *binary len(9,0)

dclfld test *char len(20)

test = "À"

mykey = 15

chain myfile key(mykey)

iofield1 = number
xlate mapfrom(x'64') mapto(test) basestr(charfld) target(iofield2)
 

Figure 5

Other ASNA KB Articles:

Other KB Articles regarding translation code pages:

Keywords: character, ASCII, HEX, data, translation, code page

Last Modified Date: 8/5/2003 2:12:04 PM

Copyright © 2005, 2006 ASNA Inc.

  Support Home   |   Search   |   Documentation