Re: Alternative COBOL "telco" source program

From: L Russ (lruss_at_superlink.net)
Date: 05/27/04


Date: 27 May 2004 12:51:39 -0700

robin <robin_v@bigpond.mapson.com> wrote in message news:<Iadtc.12799$L.1063@news-server.bigpond.net.au>...
> From: "Michael Mattias" <michael.mattias@gte.net>, SBC http://yahoo.sbc.com
> Date: Wed, 26 May 2004 12:09:48 GMT
> .
> | Some of these "can'ts" are so incredibly banal...
> .
> They all are.

They are all worse, much worse, than banal.

> .
> | e.g., # 18 "CANT find last
> | word index in trailing blank text using a loop <= 3 statements."
> .
> Not only can this be done in PL/I,
> it can be done by a beginner.
> Furthermore, it can be done in PL/I in one statement.

But if you do it in one statement, then it's not in a loop, and CAN'T
18 clearly states that you should use a loop, with at most 3
statements, implying that using a loop (with three statements or less)
is really the important thing when you do this task. Even if the
language you use doesn't require that you do it that way.

Here's my version using C++, no loop. Another FORTRAN CAN'T. Big
deal.
And yes, string and iostream are part of the C++ standard, so it's not
like anyone can't duplicate this code if you've got a conformant
compiler.

#include <string>
#include <iostream>
int main() {
 const std::string s = "The quick brown fox jumps over the lazy dog's
back. ";
 std::cout << s.substr(0, s.find_last_not_of(" ")+1) << std::endl;
 return 0;
}

And I expect, as you've said, that PL/I offers something similar.

Anyone care to try this in SNOBOL?

LR



Relevant Pages

  • Re: PL/I, COBOL, Advantages, Equivalence, et al
    ... as an index in an array. ... type Paint is arrayof Boolean; ... for I in Paint loop ... I'm moderately familiar with Ada and did most of my professional career in PL/I, and I double-checked each awkward translation in the current PL/I reference to ensure that there wasn't a better way in the newest form of the language. ...
    (comp.lang.pl1)
  • Re: PL/I, COBOL, Advantages, Equivalence, et al
    ... You are all correct that PL/I ... found no case where a keyword was used for anything other than its ... label to accomplish early exit from a loop. ...
    (comp.lang.pl1)
  • Re: PL/I, COBOL, Advantages, Equivalence, et al
    ... You are all correct that PL/I ... The number of keywords has grown somewhat since then. ... label to accomplish early exit from a loop. ... the Kednos compiler probably has something similar. ...
    (comp.lang.pl1)
  • Re: How to Read csv Files with both Characters and Numbers?
    ... For PL/I, a plain DO group is executed ... (an increment but no test loop). ... Then again, it reminds me of LOGICAL*1 for OS/360 Fortran, the ...
    (comp.lang.fortran)
  • Re: LOCALISATION
    ... "is required after the loop is executed." ... To make the value of the CV visible to the exception handler. ... Why not PL/I, I wonder. ... array that has "uninitialized" elements, or an array that has no elements? ...
    (comp.lang.pl1)