Re: Alternative COBOL "telco" source program
From: David Frank (dave_frank_at_hotmail.com)
Date: 05/27/04
- Next message: Chuck Stevens: "Re: XML and OO COBOL"
- Previous message: Peter E. C. Dashwood: "Re: XML and OO COBOL"
- In reply to: dot: "Re: Alternative COBOL "telco" source program"
- Next in thread: L Russ: "Re: Alternative COBOL "telco" source program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Chuck Stevens: "Re: XML and OO COBOL"
- Previous message: Peter E. C. Dashwood: "Re: XML and OO COBOL"
- In reply to: dot: "Re: Alternative COBOL "telco" source program"
- Next in thread: L Russ: "Re: Alternative COBOL "telco" source program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|