For Programmers: Free Programming Magazines  


Home > Archive > Cobol > November 2005 > Re: help-me with a little cobol project









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: help-me with a little cobol project
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.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com