Re: Alternative COBOL "telco" source program

From: David Frank (dave_frank_at_hotmail.com)
Date: 05/27/04


Date: Thu, 27 May 2004 12:11:38 GMT


"Tim Challenger" <"timothy(dot)challenger(at)apk(dot)at"> wrote in message
news:53d19407aa879851e2b9806445347a89@news.teranews.com...
> On Thu, 27 May 2004 03:23:20 GMT, robin wrote:
>
>> 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.
>> .
>>| 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.
>
> We all know that DF's knowledge of PLI and imagination are lacking.
>
> Here the code to demonstrate a 1 statement solution, a 3 statement loop
> and
> a 2 statement loop. So Mr Frank if you're listening, take down #18.
>
> It's complete except for Proc and end statements.
> Compiler: VisualAge(TM) PL/I for Windows(R) V2.R1.08
>
>
> dcl s char(80)
> init("The quick brown fox jumps over the lazy dog's back.");
> dcl i fixed bin(31) init(0);
>
> put edit(' one statement:')(skip, A);
> i = searchr(trim(s), ' ');
> put edit(substr(s, 1, i), substr(s, i+1))(skip, A);
>
>
>
> put edit(' 3 statement loop:')(skip(2), A);
> do i = length(trim(s))-1 to 1 by -1;
> if substr(s, i, 1) = ' ' then leave;
> end;
> put edit(substr(s, 1, i), substr(s, i+1))(skip, A);
>
>
>
> put edit(' 2 statement loop:')(skip(2), A);
> do i = length(trim(s))-1 to 1 by -1 while(substr(s, i, 1) ^= ' ');
> end;
> put edit(substr(s, 1, i), substr(s, i+1))(skip, A);
>
>
>
>
> Outputs:
> one statement:
> The quick brown fox jumps over the lazy dog's
> back.
>
> 3 statement loop:
> The quick brown fox jumps over the lazy dog's
> back.
>
> 2 statement loop:
> The quick brown fox jumps over the lazy dog's
> back.
>
>
> ***
> If your compiler doesn't have SEARCHR it can be replaced by this:
> i = index(reverse(trim(s)), ' ');
> i = length(trim(s)) -i +1;
>
> Which can easily be combined to 1 (somewhat untidy) statement:
> i = length(trim(s)) - index(reverse(trim(s)), ' ') +1;
>
>
> So Mr. Frank, any of these satisfy your "challenge"? Or are you going to
> move the goalposts yet again?
>
> --
> Tim C.
>

Its interesting you recognize Robin's blather as just that, blather, and
have
searched for cants you CAN tackle.

Congrats for providing loop solution(s) for #18, I will remove it from my
PLI_CANT.FAQ

BTW, why havent you tackled the TELCO benchmark challenge,
Robin says PL/I can do it in 43 lines but refuses to prove it.



Relevant Pages

height problem
... The quick brown fox jumps over the lazy dog ... I want the height of the top right cell just equal to the height ... For the Firefox behavior, ...
(alt.html)
  • Re: bash : offset to a substring in a string
    ... A quick brown fox jumps over the lAzY dog. ...
    (comp.unix.shell)
  • Re: substitute all spaces in a sentence except spaces in the first three words
    ... trailing whitespace and replaces the space between the third through the seventh ... words with a single colon; all other whitespace is replaced with a single space. ... my $sentence = 'the quick brown fox jumps over the lazy dog.'; ...
    (perl.beginners)
  • Re: AutoFit Row Height
    ... The quick brown fox jumps over the lazy dog.The quick brown fox jumps ... fox jumps over the lazy dog. ... does ayone know. ...
    (microsoft.public.excel.programming)