gnucobol-users
[Top][All Lists]
Advanced

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

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


From: Robert Sherry
Subject: [open-cobol-list] RE: Question About Functions
Date: Tue May 10 06:40:30 2005

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






reply via email to

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