I am trying to programm some kind of Caesar Cipher in Cobol. But somehow I get the following compile error:
Numeric function "INTEGER FUNCTION ORD" was not allowed in this context.
This error gets fired here (both lines)
000048 MOVE FUNCTION ORD("A") TO a
000049 display function ord("A")
But NOT here
000054 MOVE FUNCTION CHAR(FUNCTION MOD(
000055 FUNCTION ORD(outstring (i:1))
000056 - a + offset, 26) + a)
000057 TO outstring (i:1)
i
is the position of the outstring
we are looking at. a
is the value of "a"
or of "A"
needed to make sure we stay in the 26 letters, defined as
000018 03 a pic S9(3).
Where is the difference? Why does the second work and the first not?