IMHO, my somewhat criticism of the OPEN THEN OPEN THEN as earlier
illustrated was focused on the standard opening of many files for the
program's purpose. 99.999% of the time the ELSE statement is meant to be
terminal, in that the program stops without further processing. That's why I
wrote an article in Spectrum a few years ago endorsing a technique I picked
up called OPENER as in CALL OPENER("FILENAME", FILEHANDLE) and the
subroutine handles the very repeated exception logic, ie informing the user,
returning to the menu etc. (P.S. my OPENER also prevents the opening of a
file to no handle, which is okay for tiny programs but not when you have 20
files and 19 have handles.)

The 0.001% of the other time there could be some programming need to be in
the ELSE part of the OPEN, as in your 2 examples or to create temp files on
the fly. But by and large OPEN is a forward moving process.

Thanks
Mark J.
----- Original Message -----
From: "Bill H." <[EMAIL PROTECTED]>
To: <u2-users@listserver.u2ug.org>
Sent: Saturday, April 16, 2005 2:31 PM
Subject: RE: [U2] Multiple OPEN statements


> Mark:
>
> I would say this is legitimate if one is reading from, or opening, a
> prioritized list of files.  For instance, say I want to get a
configuration
> parameter and want to:
>
> READ ParameterValue FROM ParameterFile.Fv, ParameterId THEN...ELSE...
>
> This parameter can come from any of several files already prioritized,
say:
>
> LOCAL_PARAMETERS
> GLOBAL_PARAMETERS
>
> Then one might:
>
> OPEN 'LOCAL_PARAMETERS' TO ParameterFile.Fv ELSE
>    OPEN 'GLOBAL_PARAMETERS' TO ParameterFile.Fv THEN...ELSE...
> END
>
> Just a thought.  :-)
>
> Bill
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Mark Johnson
> > Sent: Friday, April 15, 2005 7:00 PM
> > To: u2-users@listserver.u2ug.org
> > Subject: Re: [U2] Multiple OPEN statements
> >
> > Call me old-school but I prefer top-down OPEN file TO handle
> > ELSE STOP (sic) to get them all out of the way. Whether 1 or
> > 50 files, the get all opened at the same time. If those
> > choose to have a CALL OPEN.FILES internal sub or named
> > commons, then that's also a respectable method.
> >
> > To have the main portion of the code be that indented only
> > makes maintenance later that much more difficult. Very, very
> > few people seem to label their END statements to indicate
> > what they're matched to.
> >
> > Upon further investigation (using that programmers initials)
> > i found that when there were 8 or more file, he did it in a
> > more top-down or sequential fashion. That introduces 2 forms
> > of coding for the same concept which is 1 form too many.
> >
> > That programmer is still at this client and uses the tired
> > response "That's what I was taught" when shown how hard it is
> > to follow all of those indents.
> > Can't teach an old dog...
> >
> > my 1 cent
> > ----- Original Message -----
> > From: "Jerry Banker" <[EMAIL PROTECTED]>
> > To: <u2-users@listserver.u2ug.org>
> > Sent: Friday, April 15, 2005 10:36 AM
> > Subject: Re: [U2] Multiple OPEN statements
> >
> >
> > > ----- Original Message -----
> > > > From: "Don Kibbey" <[EMAIL PROTECTED]> You did mention
> > only a few
> > > > files display this type of syntax.  Perhaps said programmer was
> > > > shown the door....
> > >
> > > I don't see why you would think that and frankly I'm surprised you
> > > haven't come across this style of programming before. This style of
> > > programming
> > was
> > > taught in classrooms all over the country before the advent
> > of point
> > > and click programming. It is a structured way of
> > programming based on
> > > a logic
> > > sequence:
> > > What is the first file I need?
> > > OPEN FILE1 TO F.FILE1 THEN
> > > END ELSE PRINT "CAN'T OPEN FILE1"
> > > END
> > >
> > > Do I need another one?
> > > OPEN FILE1 TO F.FILE1 THEN
> > >      OPEN FILE2 TO F.FILE2 THEN
> > >      END ELSE PRINT "CAN'T OPEN FILE2"
> > > END ELSE PRINT "CAN'T OPEN FILE1"
> > > END
> > >
> > > And another?
> > > OPEN FILE1 TO F.FILE1 THEN
> > >      OPEN FILE2 TO F.FILE2 THEN
> > >          OPEN FILE3 TO F.FILE3 THEN
> > >          END ELSE PRINT "CAN'T OPEN FILE3"
> > >      END ELSE PRINT "CAN'T OPEN FILE2"
> > > END ELSE PRINT "CAN'T OPEN FILE1"
> > > END
> > >
> > > Now that I've got these open what do I do with them> OPEN FILE1 TO
> > > F.FILE1 THEN
> > >      OPEN FILE2 TO F.FILE2 THEN
> > >          OPEN FILE3 TO F.FILE3 THEN
> > >              EOF=0
> > >              LOOP READNEXT ID ELSE EOF=1 UNTIL EOF DO
> > >              PROCESS, PROCESS, PROCESS
> > >              REPEAT
> > >          END ELSE PRINT "CAN'T OPEN FILE3"
> > >      END ELSE PRINT "CAN'T OPEN FILE2"
> > > END ELSE PRINT "CAN'T OPEN FILE1"
> > > END
> > >
> > > Although when the gosub came out most programmers took the
> > center out
> > > and put it into a separate subroutine.
> > > -------
> > > u2-users mailing list
> > > u2-users@listserver.u2ug.org
> > > To unsubscribe please visit http://listserver.u2ug.org/
> > -------
> > u2-users mailing list
> > u2-users@listserver.u2ug.org
> > To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to