|
From: Arnold T. <arn...@wo...> - 2005-08-20 06:45:09
|
John R. Culleton Morcombe wrote: > > Message: 2 > From: "John R. Culleton" <jo...@we...> > Organization: WexfordPress > To: tin...@li... > Subject: Re: [Tiny-cobol-users] A problem with EVALUATE > Date: Fri, 19 Aug 2005 08:06:05 +0000 > Cc: Jim Morcombe <ro...@vi...> > > On Friday 19 August 2005 07:50 am, Jim Morcombe wrote: > >>Here is another cut down listing. >> >>It demonstrates what I believe to be a bug in the compiler concerning >>the EVALUATE statement. >> >>When I compile it, I get the following error message: >> >>jim.cbl: 18: error: incompatible selection object, on or before '=' >> >>Jim >> >> IDENTIFICATION DIVISION. >> 2 000300 PROGRAM-ID. rgmssch. >> 3 001200 ENVIRONMENT DIVISION. >> 4 001700 >> 5 001900 DATA DIVISION. >> 6 002100 FILE SECTION. >> 7 002300 >> 8 002500 WORKING-STORAGE SECTION. >> 9 >> 10 01 LICENCE-DAYS PIC 9(5). >> 11 >> 12 >> 13 >> 14 019500 PROCEDURE DIVISION. >> 15 020200 MAINLINE. >> 16 >> 17 EVALUATE TRUE >> 18 WHEN LICENCE-DAYS = ZERO >> 19 CONTINUE >> 20 END-EVALUATE. > > > > I am not familiar with such a construct. According to the books > I have, (three at the moment) you EVALUATE FIELDNAME. > > And then the following WHEN statements are equivalent to > IF FIELDNAME = (value) (executable statement) > ELSE IF.... > > The EVALUATE TRUE statement in your program does not refer to a field name > but a condition-name. This in turn requires a level 88 appended > to a field name in e.g., WORKING STORAGE. > > CONTINUE is used in an IF statement. I have not found it used in > a EVALUATE statement. > > TRUE is not a field but a condition name attributed to a field > that has an 88 statement like: > > O1 WS-ANOTHER-RECORD PICTURE X. > 88 ANOTHER-RECORD VALUE "Y" FALSE "N". > > EVALUATE with WHEN statements is an alternative to the use of IF with > condition > names. Don't mix the two. Jim Morcombe's sample COBOL program is perfectly legal COBOL. It compiles cleanly under Realia COBOL, the ANSI-85 "educational" version from about 1990. Of course, it does nothing upon execution. If you use the EVALUATE TRUE option, you can put pretty much any conditional statement you want in a WHEN clause. With kindest regards, -- http://arnold.trembley.home.att.net/ |