I guess it depends on what you want to happen when the character is
"incremented". If you just want to add one to the EBCDIC value of the
letter, you can do that easily by overlaying the character in a data
D char 1a
D ebcval 3u 0 overlay(char)
CHAR = 'A';
EBCVAL += 1;
After this code runs, CHAR would contain 'B'. (Because the EBCDIC value
for A is 193. Add 1, you get 194. The EBCDIC value for B is 194)
However, if you add 1 to 'I', you will NOT get 'J', since I is 201 and J
is 209 in EBCDIC, they aren't contiguous. And this is why folks are apt
to use an array for this sort of thing.
Robert Munday wrote:
Greetings from sunny Florida (where it has thunderstormed every day for thepast five weeks).
Without using arrays (I can do that), is there a way to increment a character
two-character suffix to a field which increments `AA`, `AB`, `AC` etc.
CHAR = 'A';
CHAR += 1;
does not work, but is there something similar which would? I am adding a
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives