On Fri, 19 Oct 2012 18:18:11 -0500, Paul Gilmartin <[email protected]> wrote:
>On Fri, 19 Oct 2012 16:33:20 -0400, Kirk Talman wrote:
>
>>Cobol has EVALUATE and 88 levels that can accomplish this.
>>
>I know very little COBOL. But I understand that the "levels" are for
>record/control block definitions. How does this (help to) provide the
>function of strcasecmp()? (Perhaps a schematic example?)
(Example assumes ANSWER-FIELD is set to some value by a Move or Accept or from
a Parm, etc.)
05 ANSWER-FIELD Pic XXX Value Spaces.
88 ANSWER-YES Values 'YES' 'YEs' 'Yes' 'yes' 'yES' 'yeS' 'yEs' 'YeS'.
88 ABSWER-NO Values 'NO' 'No' 'no' 'nO'.
05 ANSWER-UPPER Pic XXX Value Spaces.
...
Evaluate ANSWER-FIELD
When ANSWER-YES Then
...
When ANSWER-NO Then
...
When Other
...
End-Evaluate
Of course COBOL also has built in functions to convert lower case to upper case
or vice versa so I would use that instead for a "case" like this. :-)>
Move Function Upper-Case (ANSWER-FIELD) to ANSWER-UPPER
Then ANSWER-UPPER could be tested for 'YES' or 'NO '.
88 levels are useful tools, and should be part of a COBOL programmers tool box.
--
Dale R. Smith
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN