Re: Selective record extraction/copy?

FrankS wrote:
On Oct 22, 10:20 pm, David J Dachtera <djesys...@xxxxxxxxxxxxxxxx>
AFAIK, DCL does not support any structured programming constructs, only
labels and GOTOs.

Boy, this'll take us off topic.

Structured programming doesn't require WHILE, and doesn't forbid the
use of GOTO. At its roots, it just says that any programming solution
can be expressed using three constructs: sequential blocks of code,
conditional execution, and looping.

All three of those constructs can be implemented in DCL. Granted, it
doesn't have many of the higher level statements that make it easier
to see the structure, but it can all be done.

For example, the construct

WHILE (condition)
. <one or more other statements go here>

can be expressed in DCL as

IF (.not. condition) THEN GOTO loopend
. <one or more other statements go here>
GOTO looptop

. <etcetera>

The SELECT (or CASE) statement is a shortcut for multiple IFs or IF/
ELSEIFs. And so on. You can express all of these so-called
structured constructs using just labels and GOTOs, and IFs.

So, go out there and start writing structured DCL. It can be done.

Well said!!

Relevant Pages

  • Re: Using "break" to Break Out of Multiple Loops in One Call
    ... Using a "goto" statement allows you to place that cleanup in a single place, jumping to it on an error, and otherwise falling straight through. ... But it would not have been nearly as clear what the goal was, or as efficient (had exception handling been used instead...frankly, exception handling is a red herring as it deals with an entirely different question). ... The reason language designers give us constructs such as "if" and "for" and "try...catch...finally" is to make code more readable. ... I can write a structured program in assembly, and I can write an unstructured program in a language that is designed to make structured programming easier. ...
  • Re: Selective record extraction/copy?
    ... Structured programming doesn't require WHILE, ... use of GOTO. ... All three of those constructs can be implemented in DCL. ... structured constructs using just labels and GOTOs, ...
  • Re: spaghetti code
    ... >> Imagine how spaghetti looks on a plate. ... Structured programming is based on focusing exclusively on control flow, ... the main insight behind structured programming was that willy-nilly jumps (goto) ... In modern C++ the single entry principle can only be broken by explicit use of 'goto', ...
  • Re: long double versions of functions in gcc under Cygwin
    ... The link is to Knuth's article "Structured Programming with go to ... the structured control constructs are, in a sense, syntactic sugar. ... In the meantime, here in the real world, a goto is sometimes the ... cleanest solution 477 times.) ...
  • Re: Alternative to goto
    ... it doesn't go into any practical reasons why goto is bad. ... Don Knuth wrote an article "Structured Programming ... This occurs less in Perl where I have other powerful ...