| Last Boy Scout 2005-11-24, 6:55 pm |
| There is no LIKE statement in the COBOL Standard language.
You would have to find a way to program such a condition
using some kind of method you do inside of COBOL.
I will give you a hint. Maybe you can use a routine
where you use address modificaion.
If you have a field called TARGET then
TARGET (1:5) is a location inside TARGET starting at the
first character to 5th charcter from the starting point, including
the starting point. So you can use variable instead of numbers.
Example TARGET (IDX1:LENGTH) could be used where IDX1 is a variable
for the location and LENGTH is the LENGTH is the field. I could think
of several ways to do this. All of which would require some original
thought.
The INSPECT verb can find the instance of the first letter and count
the characters as you cycle through the field. You know you have to
find the first letter before you need to test the field and the field
has to have enough charcters left to actually work.
Another idea is to describe the field as a table with data elements
all Pic x(01) and just add one to IDX. If you reach a miximum for
the field size you found nothing if the letter matches you use the IDX
to test for a match using the address modification. Of course you
could just use address modification and test for a match every single
time.
Good luck.
|