Condition Types Simple Conditions Relation Conditions Class Conditions Sign Conditions Comp...
Condition Types
- Simple Conditions
- Relation Conditions
- Class Conditions
- Sign Conditions
- Complex Conditions
- Condition Name
Relation Condition :
Class Condition:
The target of a class test must be a data-item whose usage is explicitly or implicitly, DISPLAY. In the case of numeric tests, data items with a usage of PACKED-DECIMAL may also be tested.
The numeric test may not be used with data items described as alphabetic (PIC A) or with group items when any of the elementary items specifies a sign.
An alphabetic test may not be used with any data items described as numeric (PIC 9).
An data-item conforms to the UserDefinedClassName if its contents consist entirely of the characters listed in the definition of the UserDefinedClassName.
* Uses the UPPER Intrinsic Function to convert to uppercase
IF InputChar IS ALPHABETIC-LOWER
MOVE FUNCTION UPPER (InputChar) TO InputChar
END-IF
Sign Condition
Complex Condition:
Condition Name Syntax
More than one Condition Names may be true at the same time. For instance, if AgeInYears contains the value 20 both Teenager and Voter will be true.
E.g. 02 AgeInYears PIC 9(3).
88 Child VALUE 0 THRU 12.
88 Teenager VALUE 13 THRU 19.
88 Adult VALUE 21 THRU 999.
88 Voter VALUE 18 THRU 999.
1.Sams Teach Yourself COBOL in 24 Hours
2.COBOL for the 21st Century
3.Advanced COBOL for Structured and Object-Oriented Programming, 3rdEdition
No comments
Post a Comment