I rather prefer the 'A '||B format because it makes it very clear that I'm 
doing string concatenation. I use the same construct in other languages.

REXX
C = 'A '||B

Python and Java
C = "A " + B

Bash
C = "A "
C += B

Etc.

I don't know of any (normal) language where whitespace is important. I don't 
care for the fact that two (almost identical) lines give different results:

B = 'B';
C = 'A ' B;
SAY 'C = "'||C||'"';
C = 'A '||B;
SAY 'C = "'||C||'"';
C = 'A ' || B;
SAY 'C = "'||C||'"';

Gives two blanks between A and B in the first case and just one in the second 
two cases.

FWIW, the difference between SUBWORD and PARSE isn't nearly as large as you 
would think.

On z/OS, PARSE VAR completed a little over 6% more interations (13 million vs 
12.3 million)
    PARSE VAR A . . X .
Ran 30.000000 seconds and completed 13041893 iterations.

    X = SUBWORD( A, 3 )
Ran 30.000000 seconds and completed 12300937 iterations.

On Windows, PARSE VAR completed a little over 7% more interations (44 million 
vs 41 million)
    PARSE VAR A . . X .
Ran 30.000000 seconds and completed 44698913 iterations.

    X = SUBWORD( A, 3 )
Ran 30.000000 seconds and completed 41597318 iterations.

Eric Rossman

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
Paul Gilmartin
Sent: Tuesday, April 23, 2024 10:42 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: [EXTERNAL] Re: REXX vs other languages WAS: Rexx numeric digits and 
scientific notation question

On Tue, 23 Apr 2024 14:07:05 +0000, Schmitt, Michael wrote:

>You lost me when you say that rather than embrace the conventions, standards, 
>and features of the language I'm coding in (REXX), I should restrict it to the 
>limitations of other languages.
>
Did I say that?  I was trying to take a middle ground.

>The maxim is to assume that readers of your code are familiar with the 
>language you're coding in, and would expect your code to follow those 
>conventions. It would /defy/ their expectations to code otherwise.
>
Be sparse and elegant but not rococo.  I prefer:
    'A' B
to (the equivalent):
    'A ' || B
The latter seems to cater to the expectations of PL/I or some other language.

But I confess to an obsession with performance.  Function call/return is 
costly, so I'll use:
    PARSE VAR A . . X .
rather than (the sparser?):
    X = SUBWORD( A, 3 )


>-----Original Message-----
>From: Paul Gilmartin
>Sent: Monday, April 22, 2024 8:56 PM
>To: IBM-MAIN@LISTSERV.UA.EDU
>
>On Tue, 23 Apr 2024 10:59:47 +1000, Andrew Rowley  wrote:
>>    ...
>>To me, it is much clearer to be explicit, including the concatenation, e.g.
>>"DELETE " || foo
>>seems much clearer about exactly what is happening/expected, which are 
>>variables and which are (expected to be) constant etc.
>>
>That overkill is apt to confuse a POSIX shell partisan who would see 
>the blank as part of the command name and expect a failure such as:
>    813 $ 'rm ' foo
>    -bash: rm : command not found
>    814 $
>
>The maxim is assume your readers have a moderate, not advanced, 
>knowledge of the language and make little concession to conventions of 
>other languages.  Don't:
>    'DELETE' || ' ' || value( 'foo' )
>
>My stumbling block learning Shell was excessive familiarity with CMS, 
>where command strings built by Rexx  are parsed again by SVC 202.  I 
>tried to build command strings with sh to pass to a nonexistent 
>subsequent parser.  I got better in a couple days.

--
gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to