I have thousands of COBOL Copybooks where I need to make modifications to various number of PICS. I am looking for a regular expression that will replace the following '9' to an 'X'
From:
~PIC~9(N).
to
~PIC~X(N).
where the '~' is a VARIABLE number of spaces, and where 'N' is a VARIABLE number of digits. The period '.' at the end of the line is required on the line. The parentheses '( )' are also required as part of the PIC line.
Finally, I do not want to modify any PIC 9's that are COMP or COMP3. For instance, the following is not a candidate for modification:
~PIC~9(7)~COMP3.
I am new to regular expressions, and do not know how to handle the parentheses and periods, inasmuch as they are actually part of the expression. The type of regular expression can be Perl or Unix.
Thanks in advance.
Our community of experts have been thoroughly vetted for their expertise and industry experience.