Re: Constant Identifiers

2020-09-07 Thread Paul Gilmartin
On Tue, 8 Sep 2020 01:04:43 +1000, Greg Price wrote: >On 2020-09-05 3:01 AM, Paul Gilmartin wrote: > >... A few years back there seemed to be a >religious phase where IBM ID went on a crusade to remove weasel words >from documentation. >... >As it was, whole sections of text I wrote for

Re: Constant Identifiers

2020-09-07 Thread Seymour J Metz
From: IBM Mainframe Discussion List on behalf of Greg Price Sent: Monday, September 7, 2020 11:04 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On 2020-09-05 3:01 AM, Paul Gilmartin wrote: > If the number 3.1416 is used in more than one pl

Re: Constant Identifiers

2020-09-07 Thread Greg Price
On 2020-09-05 3:01 AM, Paul Gilmartin wrote: If the number 3.1416 is used in more than one place in the program, or if it requires specific data or precision attributes, you must declare it as a named constant. In the olden days - years before the iPhone 6 was a thing - there

Re: Constant Identifiers

2020-09-07 Thread Seymour J Metz
://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List on behalf of Joe Monk Sent: Monday, September 7, 2020 8:04 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers "No, FIXED BIN(15,0) is not an integer, and the precision rule

Re: Constant Identifiers

2020-09-07 Thread Joe Monk
Actually it does... Under the IBM suboption: - Nonzero scale factors are permitted in FIXED BIN declarations. - If the result of any precision-handling built-in function (ADD, BINARY, and so on) has FIXED BIN attributes, the specified or implied scale factor can be nonzero. Under

Re: Constant Identifiers

2020-09-07 Thread Joe Monk
Fortran mindset. > > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > > > From: IBM Mainframe Discussion List on behalf > of Joe Monk > Sent: Sunday, September 6, 2020 7:35 PM > To: IBM-MAIN@LISTSERV.UA.EDU &

Re: Constant Identifiers

2020-09-07 Thread Seymour J Metz
: IBM Mainframe Discussion List on behalf of Robin Vowels Sent: Sunday, September 6, 2020 7:06 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers - Original Message - From: "Seymour J Metz" To: Sent: Monday, September 07, 2020 5:33 AM > PL/I doesn't have in

Re: Constant Identifiers

2020-09-06 Thread Seymour J Metz
:58 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers From: "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu> To: Sent: Sunday, September 06, 2020 1:33 PM On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote: > >As for writing formulas, I p

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
On 2020-09-07 13:05, Joe Monk wrote: "No it isn't. 4/3 yields 1.33... to 15 digits, and is of precision (15,14)" Depends on RULES(IBM) or RULES(ANS). If its RULES(IBM) it will never be integer division. It doesn't depend on whether IBM rules or ANS rules are in force. What I said it

Re: Constant Identifiers

2020-09-06 Thread Seymour J Metz
, September 6, 2020 7:35 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers "PL/I doesn't have integers." Sorry Shmuel, youre incorrect. FIXED BINARY (15,0) is a 2 byte integer and FIXED BINARY (31,0) is a 4 byte integer. "The ratiio 4/3 is FIXED BIN," No, it

Re: Constant Identifiers

2020-09-06 Thread Seymour J Metz
PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers From: "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu> To: Sent: Sunday, September 06, 2020 1:33 PM On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote: > >As for writing formulas, I p

Re: Constant Identifiers

2020-09-06 Thread Seymour J Metz
List on behalf of Robin Vowels Sent: Sunday, September 6, 2020 8:09 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers - Original Message - From: "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu> Sent: Sunday, September 06, 2020 11:07 PM On

Re: Constant Identifiers

2020-09-06 Thread Joe Monk
"No it isn't. 4/3 yields 1.33... to 15 digits, and is of precision (15,14)" Depends on RULES(IBM) or RULES(ANS). If its RULES(IBM) it will never be integer division. If its RULES(ANS) and the operands are unscaled, then it will be integer division. Joe On Sun, Sep 6, 2020 at 7:34 PM Robin

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
On 2020-09-07 09:35, Joe Monk wrote: "PL/I doesn't have integers." Sorry Shmuel, youre incorrect. FIXED BINARY (15,0) is a 2 byte integer and FIXED BINARY (31,0) is a 4 byte integer. "The ratiio 4/3 is FIXED BIN," No, its FIXED DECIMAL (1,0)... No it isn't. 4/3 yields 1.33... to 15

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
From: "Bob Bridges" Sent: Monday, September 07, 2020 8:29 AM To tell you the truth, I haven't written for a compiler in long enough that I don't have any idea which ones do what. I wouldn't trust REXX, CLIST or VBA to do it; I try to assume the worst, and make such things explicit. Actually

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
From: "Robert Prins" Sent: Monday, September 07, 2020 3:42 AM On 2020-09-06 13:07, Paul Gilmartin wrote: On Sun, 6 Sep 2020 17:25:45 +1000, Robin Vowels wrote: Beware! Than might left-associate as: volume = ( 4/3 ) * 3.14159 * radius**3 ... and the quotient of integers, 4/3, is 1.

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
- Original Message - From: "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu> Sent: Sunday, September 06, 2020 11:07 PM On Sun, 6 Sep 2020 17:25:45 +1000, Robin Vowels wrote: And C: 662 $ cat typetest.c #include int main() { printf( "%10.6f\n", 4/3 * 3.14159 );

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
From: "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu> To: Sent: Sunday, September 06, 2020 1:33 PM On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote: As for writing formulas, I prefer to follow a well-known formula, thus: volume = 4/3 * 3.14159 * radius**3 Beware!

Re: Constant Identifiers

2020-09-06 Thread Joe Monk
half > of Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu> > Sent: Saturday, September 5, 2020 11:33 PM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: Constant Identifiers > > On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote: > > > >As for writi

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
- Original Message - From: "Seymour J Metz" To: Sent: Monday, September 07, 2020 5:33 AM PL/I doesn't have integers. PL/I has always had integers. The ratiio 4/3 is FIXED BIN, No it not. It is FIXED DECIMAL -- as I said a few days ago. And it hasn't changed since. with some

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
"Seymour J Metz" wrote in message news:bl0pr05mb5156591ed17d7bddfaee695299...@bl0pr05mb5156.namprd05.prod.outlook.com... The default type for 3 and 4 is FIXED BINARY. No it's not. Constants have the type and precision of the constant. Thus, 3 and 4 are both FIXED DECIMAL (1) > PL/I does not

Re: Constant Identifiers

2020-09-06 Thread Seymour J Metz
: Sunday, September 6, 2020 6:29 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers To tell you the truth, I haven't written for a compiler in long enough that I don't have any idea which ones do what. I wouldn't trust REXX, CLIST or VBA to do it; I try to assume the worst, and make

Re: Constant Identifiers

2020-09-06 Thread Bob Bridges
To tell you the truth, I haven't written for a compiler in long enough that I don't have any idea which ones do what. I wouldn't trust REXX, CLIST or VBA to do it; I try to assume the worst, and make such things explicit. Actually I might not trust a compiler to do it, either, even if I knew

Re: Constant Identifiers

2020-09-06 Thread Bob Bridges
Ah, that makes more sense than my first guess. --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* Logic is an organized way of going wrong with confidence. -Kettering's Law, quoted in _The Number of the Beast_ by Robert A Heinlein. */ -Original Message- From: IBM Mainframe

Re: Constant Identifiers

2020-09-06 Thread Seymour J Metz
arc-requ...@listserv.ua.edu> Sent: Saturday, September 5, 2020 11:33 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote: > >As for writing formulas, I prefer to follow a well-known formula, thus: > >volume = 4/3 * 3

Re: Constant Identifiers

2020-09-06 Thread Seymour J Metz
://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List on behalf of Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu> Sent: Sunday, September 6, 2020 9:07 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On Sun, 6 Sep 2020

Re: Constant Identifiers

2020-09-06 Thread Robert Prins
On 2020-09-06 13:07, Paul Gilmartin wrote: On Sun, 6 Sep 2020 17:25:45 +1000, Robin Vowels wrote: Beware! Than might left-associate as: volume = ( 4/3 ) * 3.14159 * radius**3 ... and the quotient of integers, 4/3, is 1. No it's not. 4/3 yields 1.33.. to 15 digits in PL/I.

Re: Constant Identifiers

2020-09-06 Thread Rupert Reynolds
As I remember PL/1 from the 1980s (and very definitely pre-LE) the rules for implicit conversions were well-defined, but needed care. Simply adding parentheses would allow me to control the use of integer operations. I'll be watching for more recent (relevant) exerience :-) Rupert On Sun., Sep.

Re: Constant Identifiers

2020-09-06 Thread Paul Gilmartin
On Sun, 6 Sep 2020 17:25:45 +1000, Robin Vowels wrote: >>> >> Beware! Than might left-associate as: >> volume = ( 4/3 ) * 3.14159 * radius**3 >> ... and the quotient of integers, 4/3, is 1. > >No it's not. 4/3 yields 1.33.. to 15 digits in PL/I. >You're thinking of FORTRAN. > And

Re: Constant Identifiers

2020-09-06 Thread Robin Vowels
On 2020-09-06 13:33, Paul Gilmartin wrote: On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote: As for writing formulas, I prefer to follow a well-known formula, thus: volume = 4/3 * 3.14159 * radius**3 Beware! Than might left-associate as: volume = ( 4/3 ) * 3.14159 * radius**3

Re: Constant Identifiers

2020-09-05 Thread Paul Gilmartin
On Sat, 5 Sep 2020 08:13:42 +1000, Robin Vowels wrote: > >As for writing formulas, I prefer to follow a well-known formula, thus: > >volume = 4/3 * 3.14159 * radius**3 > Beware! Than might left-associate as: volume = ( 4/3 ) * 3.14159 * radius**3 ... and the quotient of integers, 4/3, is 1.

Re: Constant Identifiers

2020-09-05 Thread Robin Vowels
to floating-point). - Original Message - From: "Bob Bridges" Newsgroups: bit.listserv.ibm-main To: Sent: Sunday, September 06, 2020 6:18 AM Subject: Re: Constant Identifiers When you care about efficiency, I'd think this would be better: const=4/3*3.14159E0 /* in the init

Re: Constant Identifiers

2020-09-05 Thread Seymour J Metz
: Friday, September 4, 2020 9:04 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers "Seymour J Metz" wrote in message news:bl0pr05mb5156e311e88735a8afbef5ca99...@bl0pr05mb5156.namprd05.prod.outlook.com... > If you don't care about maintainable code than should is to strong.

Re: Constant Identifiers

2020-09-05 Thread Seymour J Metz
: Re: Constant Identifiers When you care about efficiency, I'd think this would be better: const=4/3*3.14159E0 /* in the initialization */ volume=const*radius**3 /* inside the loop */ --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* Things may come to those who wait, but only

Re: Constant Identifiers

2020-09-05 Thread Seymour J Metz
du/~smetz3 From: IBM Mainframe Discussion List on behalf of Bob Bridges Sent: Saturday, September 5, 2020 4:21 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers Going back to the beginning, Gil: SQRT(X**TWO+Y**TWO) looks like ~exactly~ the sort of thing t

Re: Constant Identifiers

2020-09-05 Thread Jeremy Nicoll
On Sat, 5 Sep 2020, at 21:21, Bob Bridges wrote: > Going back to the beginning, Gil: SQRT(X**TWO+Y**TWO) looks like > ~exactly~ the sort of thing that oughta be made a constant rather than > being coded more than once. That is, if X, Y and TWO all constants > themselves; and if they are not

Re: Constant Identifiers

2020-09-05 Thread Bob Bridges
Going back to the beginning, Gil: SQRT(X**TWO+Y**TWO) looks like ~exactly~ the sort of thing that oughta be made a constant rather than being coded more than once. That is, if X, Y and TWO all constants themselves; and if they are not then this isn't an example of what you're talking about.

Re: Constant Identifiers

2020-09-05 Thread Bob Bridges
When you care about efficiency, I'd think this would be better: const=4/3*3.14159E0 /* in the initialization */ volume=const*radius**3 /* inside the loop */ --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* Things may come to those who wait, but only those things left behind by

Re: Constant Identifiers

2020-09-05 Thread Bob Bridges
Gotta side with Robin on that one. --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* Law #37 of combat operations: Anything you do can get you killed, including nothing. */ -Original Message- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf

Re: Constant Identifiers

2020-09-04 Thread Robin Vowels
"Seymour J Metz" wrote in message news:bl0pr05mb5156e311e88735a8afbef5ca99...@bl0pr05mb5156.namprd05.prod.outlook.com... If you don't care about maintainable code than should is to strong. If you care about maintainable code then should is too weak. The purpose of a LRM is to tell you what

Re: Constant Identifiers

2020-09-04 Thread Seymour J Metz
Sent: Friday, September 4, 2020 6:13 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On 2020-09-05 05:03, Paul Gilmartin wrote: > On Fri, 4 Sep 2020 17:10:36 +, Farley, Peter x23353 wrote: > >> Sounds to me like the documentation writer was a bit confused. Looks &

Re: Constant Identifiers

2020-09-04 Thread Seymour J Metz
From: IBM Mainframe Discussion List on behalf of Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu> Sent: Friday, September 4, 2020 5:37 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On Fri, 4 Sep 2020 17:04:34

Re: Constant Identifiers

2020-09-04 Thread Robin Vowels
On 2020-09-05 05:03, Paul Gilmartin wrote: On Fri, 4 Sep 2020 17:10:36 +, Farley, Peter x23353 wrote: Sounds to me like the documentation writer was a bit confused. Looks to me like it should read instead: If th nnumber 3.1416 is used in more than one place in the program, then you

Re: Constant Identifiers

2020-09-04 Thread Robin Vowels
On 2020-09-05 01:43, Paul Gilmartin wrote: I'm a PL/I novice, or less. A recent thread here moved me to browse the Ref., where I read that any constant used more than once must be declared and the identifier used instead. Sorta tyrannical enforcement of coding conventions. OK. I agree that

Re: Constant Identifiers

2020-09-04 Thread Paul Gilmartin
On Fri, 4 Sep 2020 17:04:34 +, Seymour J Metz wrote: >Do you have a URL and page number? Is that an exact quote, or was there a >conditional? > I cited the Language Ref. >It is good form to use a constant that stands for itself, e.g., "X**2". It is >bad form to use a constant for, e.g.,

Re: Constant Identifiers

2020-09-04 Thread Paul Gilmartin
On Fri, 4 Sep 2020 17:10:36 +, Farley, Peter x23353 wrote: >Sounds to me like the documentation writer was a bit confused. Looks to me >like it should read instead: > >If th nnumber 3.1416 is used in more than one place in the program, then you >*should* declare it as a named constant. >If

Re: Constant Identifiers

2020-09-04 Thread Seymour J Metz
Sent: Friday, September 4, 2020 3:06 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On 2020-09-04 15:43, Paul Gilmartin wrote: > I'm a PL/I novice, or less. A recent thread here moved me > to browse the Ref., where I read that any constant used more > than

Re: Constant Identifiers

2020-09-04 Thread Robert Prins
On 2020-09-04 17:01, Paul Gilmartin wrote: I see everything twice: On Fri, 4 Sep 2020 19:05:32 +, Robert Prins wrote: On Fri, 4 Sep 2020 19:06:49 +, Robert Prins wrote: Yes, problems posting. Should be OK now. And I don't think that anyone in their right mind would ever use anything

Re: Constant Identifiers

2020-09-04 Thread Seymour J Metz
du/~smetz3 From: IBM Mainframe Discussion List on behalf of Farley, Peter x23353 <031df298a9da-dmarc-requ...@listserv.ua.edu> Sent: Friday, September 4, 2020 1:10 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers Sounds to me like the documentation writer wa

Re: Constant Identifiers

2020-09-04 Thread Seymour J Metz
u.edu/~smetz3 From: IBM Mainframe Discussion List on behalf of Paul Gilmartin <000433f07816-dmarc-requ...@listserv.ua.edu> Sent: Friday, September 4, 2020 1:00 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On Fri, 4 Sep 2020 10:

Re: Constant Identifiers

2020-09-04 Thread Farley, Peter x23353
in the program, then you *must* declare it as a named constant. Peter -Original Message- From: IBM Mainframe Discussion List On Behalf Of Paul Gilmartin Sent: Friday, September 4, 2020 1:01 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Constant Identifiers On Fri, 4 Sep 2020 10:55:19

Re: Constant Identifiers

2020-09-04 Thread Seymour J Metz
Do you have a URL and page number? Is that an exact quote, or was there a conditional? It is good form to use a constant that stands for itself, e.g., "X**2". It is bad form to use a constant for, e.g., an approximation, an empirical value, a value subject to regulatory change. The general

Re: Constant Identifiers

2020-09-04 Thread Paul Gilmartin
On Fri, 4 Sep 2020 10:55:19 -0500, Steve Smith wrote: >I'm not a PL/I novice, if not an expert. Whatever you read, it does not >mean what you think it means. > Enterprise PL/I for z/OS Language Reference Version 5 Release 1 IBM SC27-8940-00 Datatypes and attributes. . . 17 If the number

Re: Constant Identifiers

2020-09-04 Thread Robert Prins
On 2020-09-04 15:43, Paul Gilmartin wrote: > I'm a PL/I novice, or less. A recent thread here moved me > to browse the Ref., where I read that any constant used more > than once must be declared and the identifier used instead. > Sorta tyrannical enforcement of coding conventions. OK. > I agree

Re: Constant Identifiers

2020-09-04 Thread Robert Prins
On 2020-09-04 15:43, Paul Gilmartin wrote: I'm a PL/I novice, or less. A recent thread here moved me to browse the Ref., where I read that any constant used more than once must be declared and the identifier used instead. Sorta tyrannical enforcement of coding conventions. OK. I agree that

Re: Constant Identifiers

2020-09-04 Thread Steve Smith
I'm not a PL/I novice, if not an expert. Whatever you read, it does not mean what you think it means. A constant (or variable) named TWO is an abomination in any language. sas On Fri, Sep 4, 2020 at 10:44 AM Paul Gilmartin < 000433f07816-dmarc-requ...@listserv.ua.edu> wrote: > I'm a PL/I