Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
01 char-to-convert pic x.
01 ordinal-position pic 99.
01 redefines ordinal-position.
02 ordinal-most-sig-digit pic X.
02 ordinal-least-sig-digit pic X.
...
move char-to-convert to ordinal-most-sig-digit
ordinal-least-sig-digit
inspect ordinal-most-sig-digit
converting "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
to "00000000011111111112222222".
inspect ordinal-least-sig-digit
converting "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
to "12345678901234567890123456".
display "The ordinal position of ",
char-to-convert, " is ",
ordinal-position.
01 OrdChar pic X(01).
01 OrdPos pic 9(02).
01 ConstChars pic x(27) value "_ABCDEFGHIJKLMNOPQRSTUVWXYZ".
inspect ConstChars tallying OrdPos for characters before initial OrdChar
01 OrdChar pic X(01).
01 OrdPos pic 9(02).
01 ConstChars pic x(27) value "ABCDEFGHIJKLMNOPQRSTUVWXYZ".
move 1 to OrdPos.
inspect ConstChars tallying OrdPos for characters before initial OrdChar
01 TBL-VALS.
05 FILLER PIC X(576) VALUE ' '.
05 A-I PIC X(027) VALUE
'A01B02C03D04E05F06G07H08I09'.
05 FILLER PIC X(021) VALUE ' '.
05 J-R PIC X(027) VALUE
'J10K11L12M13N14O15P16Q17R18'.
05 FILLER PIC X(024) VALUE ' '.
05 S-Z PIC X(024) VALUE
'S19T20U21V22W23X24Y25Z26'.
05 FILLER PIC X(066) VALUE ' '.
01 A-Z-TBL REDEFINES TBL-VALS.
05 TBL-ENTRY OCCURS 255 TIMES.
10 ALPHA-VAL PIC X.
10 NUM-VAL PIC XX.
01 SUB PIC S9(002) VALUE ZERO.
01 SUB1 REDEFINES SUB.
05 SUB-POS1 PIC X(001).
05 SUB-POS2 PIC X(001).
(code)
MOVE your-char TO SUB-POS2
IF SUB = ZERO do error stuff
IF NUM-VAL(SUB) = SPACES do error stuff
DISPLAY 'ALPHA CHAR >' ALPHA-VAL(SUB) '< IS AT POS >'
NUM-VAL(SUB) '< IN THE ALPHABET'