Problems eliminating HEX 41 character.

65 pts.
Application development
I have a number of files on my DB2/400 database that have spaces with a Hex code of 41 instead of 40. This causes a problem when FTP'ing to a PC for integration with a barcode labeling application. Does anyone know how I can change this character to ANYTHING other than Space HEX 41 !! Potentially any space in a character field could be HEX 41 and I need to ensure it is changed to HEX 40. Many thanks.

Answer Wiki

Thanks. We'll let you know when a new response is added.


You can do this by creating a character conversion table and then specifying it on the FTP command:

a) Get a copy of the QASCII (EBCDIC to ASCII) conversion table by using the RTVTBLSRC command:


b) Use SEU (or WDSC) to edit the MYQASCII source member you just created. Line 3.00 of the source member should be changed to begin “2020” instead of “20A0”.

c) Save the source member and then create your new table using the CRTTBL command:


7) When using FTP, add the parameter TBLFTPOUT and specify your new conversion table:


Hope it helps



Note that you only want to use a translation table against character fields. A hex-41 byte can appear in non-character areas of a record and those <i>should not</i> be translated.

<pre>UPDATE myfile SET mycol = replace( mycol ,x’41’,x’40’)</pre>You should be able to run that against any table MYFILE for any column MYCOL. If you create it as a QM query, you can place substitution variables for the table and column names.


Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Atgidm
    Use the xlate opcode to change the as400 data: CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result c X'41':X'40' xlate Fldnam Fldnam You can also use the %xlate, just fill in the parms with data from above and is also a %xlate in /Free.
    0 pointsBadges:
  • Selectsoft
    I have solved the problem within RPG : I load the field into an array and read a character at a time looking for X'41' and replace with X'40'. if array(X) = X'41' eval array(X) = X'40' endif Perhaps this will help others who encounter this problem. Thanks for everyone who took the time to think about this one. Neil.
    65 pointsBadges:
  • Splat
    Unless you're using an earlier version of RPG that doesn't support either the XLATE opcode or the %XLATE bif, you're not improving your program performance by cycling through arrays.
    12,915 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: