gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [open-cobol-list] RE: Question About Functions


From: Bill Klein
Subject: RE: [open-cobol-list] RE: Question About Functions
Date: Tue May 10 12:02:56 2005

It's two arguments.

The "B - C - 3" is all one arithmetic expression.  In order for any of the
"minuses" to be a unary operator, the following rule comes into play:

"... If the first operator in an arithmetic expression is a unary operator,
it shall be immediately preceded by a left parenthesis if that arithmetic
expression immediately follows an identifier or another arithmetic
expression.

NOTE For example, when '1' and '+ 2' are used as subscripts for a
two-dimensional table A, the arithmetic expression '+ 2' needs to be
enclosed in parentheses, as in A (1 (+ 2))."

See Rule 6 on page 121 of the '02 Standard.   

> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden On 
> Behalf Of Robert Sherry
> Sent: Tuesday, May 10, 2005 8:38 AM
> To: 'Roger While'
> Cc: address@hidden
> Subject: [open-cobol-list] RE: Question About Functions
> 
> Roger,
> 
>     Thanks for the response. Please consider the following 
> function call:
>                 FUNCTION MAX( A   B - C        - 3 )
> How many arguments are being passed to the function MAX and 
> how do you know?
> 
> Bob Sherry
> 
> -----Original Message-----
> From: Roger While [mailto:address@hidden 
> Sent: Tuesday, May 10, 2005 1:00 AM
> To: address@hidden
> Cc: address@hidden
> Subject: Re: Question About Functions
> 
> In so far that a specific function allows it, arithmetic and boolean 
> expressions
> are legal.
> 
> In fact you also can nest functions eg. from 2002 standard
> syntax rules :
> 
> -- quote --
> If a function's definition permits arguments and a left parenthesis 
> immediately follows function-prototypename-
> 1 or intrinsic-function-name-1, the left parenthesis is 
> always treated as 
> the left parenthesis of that
> function's arguments.
> NOTE For a function that may be referenced either with or without 
> arguments, such as the RANDOM function, careful
> coding is necessary to ensure correct interpretation. For 
> example, in the 
> following:
> FUNCTION MAX (FUNCTION RANDOM (A) B)
> 'A' is treated as an argument to the RANDOM function. If 'A' 
> is instead 
> meant to be a second argument to the MAX
> function, different coding is necessary - either:
> FUNCTION MAX ( (FUNCTION RANDOM) (A) B)
> or
> FUNCTION MAX (FUNCTION RANDOM () A B)
> or
> FUNCTION MAX (FUNCTION RANDOM A B).
> -- end quote --
> 
> Roger
> 
> 
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]