Do we have REVERSE command in COBOL?
Can some one tell me if REVERSE command is available in COBOL? I tried in manuals but could not get it to work :(
I am looking to reverse a string."; ; ; ;
Not as far as i am aware of but COBOL can call C functions that may achieve the same result. i have not done that yet so am unaware of exactly how to go about that.
otherwise you can always do the following:
01 i pic s9(4) binary.
01 j pic s9(4) binary.
01 original-string pic x(255).
02 reversed-string pic X(255).
move length of original-string to j
perform varying i from 1 by +1 until i > length of original-string
move original-string(i:1) to reversed-string(j:1)
subtract 1 from j