In COBOL, a hyphen can be used in a field name and in a specific program some field names would be identical to others except a suffix was added--sometimes a suffix to a suffix was used. For example, assume I am looking for AAA, AAA-BBB, and AAA-BBB-CCC and don't want to look at AAA-BBB-CCC results mixed in with just AAA. My try is to ignore the field if it ends with a final hyphen so I wouldn't see "AAA-".
---------- Post updated at 01:54 PM ---------- Previous update was at 01:22 PM ----------
On second thought, almost. If there is a hyphen anywhere later on the line, the line is thrown out. The first line of this code is OK, the second isn't, and the third is ok.
03 AAA PIC 999V99.
MULTIPLY AAA BY 100 GIVING OUT-AMT.
ADD XYZ TO AAA
Every field in a work area was supposed to be added to when certain filters were true and, in a control break, non zero values of those fields would trigger further processing. I had started by copying that work area to a new file, removing everything but the data names, then building identical grep commands around it. The suggestion RudiC made helped me check out and document that program as well as giving me a useful tool for the future.
I've used other compilers that produce sorted cross references of all data names but the compiler I use now doesn't do that.