Converting Upper to Lower Case

Question: In COBOL how do you convert a field that is in upper case to lowercase.
Example:JOHN TO john
anonymous

Answer:Converting uppercase to lowercase would use the INSPECT statement.

INSPECT MYFIELD CONVERTING 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' TO 'abcdefghijklmnopqrstuvwxyz'.

If MYFIELD contained JOHN this would be converted to john.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate