Joined: 06 Jun 2008 Posts: 8217 Location: Dubuque, Iowa, USA
It is not possible to do this with a single COBOL statement. However, with multiple COBOL statements it is easy. Use FUNCTION REVERSE to reverse the variable. Use INSPECT TALLYING LEADING SPACES to count the blanks until the first non-blank character. If the first non-blank character is a comma, use reference modification to change it. Use FUNCTION REVERSE to restore the variable.