Is there a trick to using transcendental functions in GNUCOBOL? I get a 'not defined' error for any functions I try. I see the functions in the manual but don't see how to activate them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks! I was a professional COBOL programmer for many years but I worked in the insurance business and financial sector. We never had much use for SIN, COS, TAN or SQRT!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks! I was a professional COBOL programmer for many years but I
worked in the insurance business and financial sector. We never had
much use for SIN, COS, TAN or SQRT!
Use the Programmers Guide (found on SF site at : https://gnucobol.sourceforge.io/guides.html ) for a full list of all
functions and there are a lot of them many of which are applicable to
programming for business and other commercial applications and yes, I
use a reasonable amount of them :)
Very handy.
Vincent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2023-07-01
For those like me whose C is abysmal a pure COBOL solution:
Yes. It even compiles and runs in gnucobol. The only change 'FUNCTION' to 'MY-FUNCTION' (reserved word).
More depressing than having written it 40 years ago, is that I already had 12 years experience.
👍
2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Keep the original (with FUNCTION, and compile with -std=cobol85 or with -fnot-reserved=FUNCTION should work, too.
EDIT: I stand corrected, while both options should work, they don't. That's a bug which will be solved; tried with [r5098] but that showed another bug - somehow FUNCTION is always reserved ?!?
Workaround: add REPLACE FUNCTION BY FUNC. in the first line.
Is there a trick to using transcendental functions in GNUCOBOL? I get a 'not defined' error for any functions I try. I see the functions in the manual but don't see how to activate them.
The standard way is to write the FUNCTION keyword in front of them.
As an alternative you can use the REPOSITORY paragraph: FUNCTION ALL INTRINSIC.
... or go non standard and imply that - see
Thanks! I was a professional COBOL programmer for many years but I worked in the insurance business and financial sector. We never had much use for SIN, COS, TAN or SQRT!
On 25/05/2023 12:59, Tom Lake wrote:
Use the Programmers Guide (found on SF site at :
https://gnucobol.sourceforge.io/guides.html ) for a full list of all
functions and there are a lot of them many of which are applicable to
programming for business and other commercial applications and yes, I
use a reasonable amount of them :)
Very handy.
Vincent
For those like me whose C is abysmal a pure COBOL solution:
and
Last edit: Simon Sobisch 2023-07-01
FUNCTION SIN ()
is quite "COBOL", too ;-)But thanks for sharing that code. Are the
DATE-WRITTEN
andSOURCE-COMPUTER
for real?Yes. It even compiles and runs in gnucobol. The only change 'FUNCTION' to 'MY-FUNCTION' (reserved word).
More depressing than having written it 40 years ago, is that I already had 12 years experience.
Keep the original (with
FUNCTION
, and compile with-std=cobol85
or with-fnot-reserved=FUNCTION
should work, too.EDIT: I stand corrected, while both options should work, they don't. That's a bug which will be solved; tried with [r5098] but that showed another bug - somehow FUNCTION is always reserved ?!?
Workaround: add
REPLACE FUNCTION BY FUNC.
in the first line.Related
Commit: [r5098]
Last edit: Simon Sobisch 2023-07-01