Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Perform forever
Does anyone have a favourite way of specifying that a PERFORM should
continue indefinitely?

Consider the following code:

move low-values to wpppauthorblurb
perform until 1 = 2
perform get-input
if itsa-tag OR finished
exit perform
end-if
string
wpppauthorblurb
delimited by low-values
INPUT-RECORD (1:INPUT-LEN)
delimited by size
'<br> '
delimited by size
into
wpppauthorblurb
end-string
end-perform

The first PERFORM should keep going until it is exited by the EXIT PERFORM
on line 5.

The best I could do on the spot was create a condition that can never be
true (1 = 2), but I think this is pretty lame...:-)

This is Fujitsu NetCOBOL but I'd be interested in seeing any solutions
anyone has.

PERFORM FOREVER   would be ...

Pete.




Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
09-06-05 08:55 AM


Re: Perform forever

Pete Dashwood wrote:

>
> Does anyone have a favourite way of specifying that a PERFORM should
> continue indefinitely?
>
> Consider the following code:
>
>                move low-values to wpppauthorblurb
>                perform until 1 = 2
>                  perform get-input
>                  if itsa-tag OR finished
>                     exit perform
>                  end-if
>                  string
>                       wpppauthorblurb
>                          delimited by low-values
>                       INPUT-RECORD (1:INPUT-LEN)
>                          delimited by size
>                       '<br> '
>                          delimited by size
>                             into
>                               wpppauthorblurb
>                  end-string
>                end-perform
>
> The first PERFORM should keep going until it is exited by the EXIT PERFORM
> on line 5.
>
> The best I could do on the spot was create a condition that can never be
> true (1 = 2), but I think this is pretty lame...:-)
>
> This is Fujitsu NetCOBOL but I'd be interested in seeing any solutions
> anyone has.
>
> PERFORM FOREVER   would be ...
>
> Pete.

My favorite way involved defining a condition name.

PERFORM UNTIL INFINITE-LOOP-DONE

Others might prefer a condition name such as HELL-FREEZES-OVER or
DOCDWARF-GETS-THE-LAST-WORD.  The actual definition of the condition
name is an exercise left to the programmer, but like all old mainframe
programmers, I prefer a one character alphanumeric field.

With kindest regards, and apologies to DocDwarf...

--
http://arnold.trembley.home.att.net/


Report this thread to moderator Post Follow-up to this message
Old Post
Arnold Trembley
09-06-05 08:55 AM


Re: Perform forever
> This is Fujitsu NetCOBOL but I'd be interested in seeing
> any solutions anyone has.
>
> PERFORM FOREVER   would be ...

Then look in your Fujitsu manual, Format 5 is:

PERFORM WITH NO LIMIT

IMHO the EXIT PERFORM is poor usage and should be put in the same bin
as GO TO, NEXT SENTENCE, EXIT PARAGRAPH and EXIT SECTION (and a few
others).

For example, if I wanted to reuse part or all of the imperitive
statement in the in-line PERFORM I could extract it and make it a
performable paragraph. My definition of 'clean code' is that which can
be moved without regard to any positional dependencies. The EXIT
PERFORM is not clean code, it would fail to work as designed if moved
to a paragraph.

(Actually I think it would continue to work correctly in Unisys if I
understood what was said).


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
09-06-05 08:55 AM


Re: Perform forever
> perform until 1 = 2

Some compilers may notice this and could either 1) optimize it as
always false or 2) flag an error that comparing two literals is
obviously wrong.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
09-06-05 08:55 AM


Re: Perform forever
> DOCDWARF-GETS-THE-LAST-WORD

Doesn't that always get to be true eventually, no matter how it takes ?


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
09-06-05 08:55 AM


Re: Perform forever
Pete Dashwood wrote:
>
> Does anyone have a favourite way of specifying that a PERFORM should
> continue indefinitely?
>
> Consider the following code:
>
>                move low-values to wpppauthorblurb
>                perform until 1 = 2
>                  perform get-input
>                  if itsa-tag OR finished
>                     exit perform
>                  end-if
>                  string
>                       wpppauthorblurb
>                          delimited by low-values
>                       INPUT-RECORD (1:INPUT-LEN)
>                          delimited by size
>                       '<br> '
>                          delimited by size
>                             into
>                               wpppauthorblurb
>                  end-string
>                end-perform
>
> The first PERFORM should keep going until it is exited by the EXIT PERFORM
> on line 5.
>
> The best I could do on the spot was create a condition that can never be
> true (1 = 2), but I think this is pretty lame...:-)
>
> This is Fujitsu NetCOBOL but I'd be interested in seeing any solutions
> anyone has.
>
> PERFORM FOREVER   would be ...
>
> Pete.
>
>
>


In Microfocus

PERFORM UNTIL EXIT

Report this thread to moderator Post Follow-up to this message
Old Post
Steve Rainbird
09-06-05 08:55 AM


Re: Perform forever
In article <Yi8Te.13960$qY1.4299@bgtnsc04-news.ops.worldnet.att.net>,
Arnold Trembley  <arnold.trembley@worldnet.att.net> wrote:

[snip]

>With kindest regards, and apologies to DocDwarf...

zzzzZZZZzzzzzz... zzzzaaAAWWWKKHHHHhhh... eh? whuh? huh?  Oh, sorry, I was
just... resting my eyes, did I miss something?

DD


Report this thread to moderator Post Follow-up to this message
Old Post
docdwarf@panix.com
09-06-05 12:55 PM


Re: Perform forever
> Consider the following code:

I much prefer:

perform get-input
move low-values to wpppauthorblurb
perform
with test after
until itsa-tag OR finished

string
wpppauthorblurb delimited by low-values
INPUT-RECORD (1:INPUT-LEN)
delimited by size
'<br> '   delimited by size
into wpppauthorblurb
end-string
perform get-input
end-perform


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
09-06-05 12:55 PM


Re: Perform forever

"Richard" <riplin@Azonic.co.nz> wrote in message
news:1126000191.100198.280090@g47g2000cwa.googlegroups.com... 
>
> I much prefer:
>
>       perform get-input
>       move low-values to wpppauthorblurb
>       perform
>             with test after
>             until itsa-tag OR finished
>
>             string
>                  wpppauthorblurb delimited by low-values
>                  INPUT-RECORD (1:INPUT-LEN)
>                               delimited by size
>                  '<br> '   delimited by size
>                  into wpppauthorblurb
>               end-string
>               perform get-input
>       end-perform
>
Yes, you make a very good case, Richard.

I don't like (and use extremely rarely) PERFORM WITH TEST AFTER, but I
understand why it is necessary here and you have managed to remove the
requirement for PERFORM FOREVER..., which is a very useful way to solve
problems... :-)

I think your solution is elegant and I'm going to use it.

Thanks.

Pete.




Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
09-06-05 12:55 PM


Re: Perform forever
Thanks Arnold.

Comments below...

"Arnold Trembley" <arnold.trembley@worldnet.att.net> wrote in message
news:Yi8Te.13960$qY1.4299@bgtnsc04-news.ops.worldnet.att.net...
>
>
> Pete Dashwood wrote:
> 
>
> My favorite way involved defining a condition name.
>
> PERFORM UNTIL INFINITE-LOOP-DONE

I immediately thought of using a condition name like FOREVER, but I'm
ashamed to say  I  couldn't see how it would it work. (I was thinking of how
I could attach an 88 level to a comparison, but of course, it really only
needs to be a set value...Guess I've been away from COBOL too long :-)) Of
course, some hours later, in the  of the evening, I can see immediately,
but I just couldn't at the time...

>
> Others might prefer a condition name such as HELL-FREEZES-OVER or
> DOCDWARF-GETS-THE-LAST-WORD.  The actual definition of the condition name
> is an exercise left to the programmer, but like all old mainframe
> programmers, I prefer a one character alphanumeric field.

I agree on the one character (can't shake off my IBM youth where a CLI
instruction was better than any alternative... :-)), but I studiously make
no comment regarding the temperature of Hell or the loquaciousness of a
certain dwarf... :-)

Pete.




Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
09-06-05 12:55 PM


Sponsored Links




Last Thread Next Thread Next
Pages (6): [1] 2 3 4 5 6 »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:11 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.