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.
Software/Hardware used:
ASKED:
March 28, 2007 9:03 AM
UPDATED:
January 5, 2010 3:46 PM
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.
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.
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.