Condition names can also be qualified.
When a condition name has been assigned to a data item, the condition name can be uniquely referenced using qualification.
000010 @OPTIONS MAIN 000020*---------------------------------------------------------------------- 000030* Condition names can also be qualified. 000040*---------------------------------------------------------------------- 000050 IDENTIFICATION DIVISION. 000060 PROGRAM-ID SAMPLE. 000070 DATA DIVISION. 000080 WORKING-STORAGE SECTION. 000090*---------------------------------------------------------------------- 000100* The correct values for month and date are both defined using the 000105* condition name "CORRECT". 000110*---------------------------------------------------------------------- 000120 01 VACATION. 000130 02 V-MONTH PIC 9(2). 000140 88 CORRECT VALUE 1 THRU 12. 000150 02 V-DAY PIC 9(2). 000160 88 CORRECT VALUE 1 THRU 31. 000170*---------------------------------------------------------------------- 000180 01 CR-DATE. 000190 02 PIC 9(4). 000200 02 CR-MONTH PIC 9(2). 000210 02 CR-DAY PIC 9(2). 000220 01 ANS PIC 9(3). 000230 PROCEDURE DIVISION. 000240 DISPLAY "When do you get vacation? Example: 0801 >>" 000245 WITH NO ADVANCING. 000250 ACCEPT VACATION. 000260 MOVE FUNCTION CURRENT-DATE TO CR-DATE. 000270*---------------------------------------------------------------------- 000280* The condition name is be qualified using OF and uniquely referenced. 000290*---------------------------------------------------------------------- 000300 IF CORRECT OF V-MONTH AND 000310 CORRECT OF V-DAY THEN 000320*---------------------------------------------------------------------- 000330 IF V-MONTH = CR-MONTH AND V-DAY >= CR-DAY THEN 000340 COMPUTE ANS = V-DAY - CR-DAY 000350 ELSE 000360 COMPUTE ANS = 30 - CR-DAY 000370 COMPUTE CR-MONTH = CR-MONTH + 1 000380 IF CR-MONTH > 12 THEN 000390 COMPUTE CR-MONTH = CR-MONTH - 12 000400 END-IF 000410 IF V-MONTH >= CR-MONTH THEN 000420 COMPUTE ANS = ANS + ((V-MONTH - CR-MONTH) * 30) + V-DAY 000430 ELSE 000440 COMPUTE ANS = ANS + ((12 - CR-MONTH) * 30) + (V-MONTH * 30) 000445 + V-DAY 000450 END-IF 000460 END-IF 000470 DISPLAY "Approximately " ANS 000475 " days remain until you get vacation." 000480 ELSE 000490 DISPLAY "The input data is incorrect." 000500 END-IF. 000510 END PROGRAM SAMPLE.