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 structure.

D ds
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 the past five weeks).

Without using arrays (I can do that), is there a way to increment a character value?

CHAR = 'A';
CHAR += 1;

does not work, but is there something similar which would? I am adding a two-character suffix to a field which increments `AA`, `AB`, `AC` etc.


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].