[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: File numbering



If you put the find filenumber and insert new
filenumber as well as the open file in an include file
you can use this method in every sqr program you
want...



--- "Ross, Steven" <sross@KCM.ORG> wrote:
> Thanks, but, again this isn't what I wanted.  Let me
> explain.
>
> My routine may be called from other SQRs that don't
> keep track of file
> numbers.  Therefore, if I hard code the file number
> as, say, "1", the
> existing code may have already used that file
> number.  So I would like a way
> to find a number that hasn't already been used.  I
> may not be able to do
> this...I was just hoping...
>
> Steven Ross
> Applications Developer/Analyst
> sross@kcm.org
>
>
>
> > -----Original Message-----
> > From: Arjan Hoornstra [mailto:ahoor@YAHOO.COM]
> > Sent: Tuesday, December 05, 2000 3:51 AM
> > To: SQR-USERS@list.iex.net
> > Subject: Re: File numbering
> >
> >
> > Steven,
> >
> > Not a native routine as far as I know, however you
> may
> > use a table to store the used filenumbers in and
> > select from that table, than add 1 and update the
> > table. Or maybe just insert the filenumbers, and
> > remove them when the file is closed. This way if
> no
> > sqr runs the table will be empty again starting
> with 1
> > for the next file. You may want a zero in the
> table as
> > a not-used initialising value.
> > This is best I guess when using the routine from
> > different sqr's at the same time.
> >
> > Arjan
> >
> >
> >
> >
> >
> >
> > --- "Ross, Steven" <sross@KCM.ORG> wrote:
> > > Rick,
> > >
> > > Thanks, but I didn't want a status checker.  I
> need
> > > to know if there's a
> > > native way to get the next free file number, as
> I
> > > can in Visual Basic.  I
> > > would really rather not loop through an "open
> > > routine" until I get a number
> > > that works...
> > >
> > > Thanks,
> > >
> > > Steven Ross
> > > Applications Developer/Analyst
> > > sross@kcm.org
> > > sross11@mail.com
> > >
> > >
> > > > -----Original Message-----
> > > > From: richard.mitchell@GSA.GOV
> > > [mailto:richard.mitchell@GSA.GOV]
> > > > Sent: Monday, December 04, 2000 4:33 PM
> > > >
> > > > From the help file:
> > > >
> > > > OPEN { filename_lit | _var | _col } AS {
> > > filenum_num_lit |
> > > > _var | _col }
> > > > { FOR-READING | FOR-WRITING | FOR-APPEND }
> > > > { RECORD = length_num_lit [ :FIXED |
> :FIXED_NOLF |
> > > :VARY ] }
> > > > [ STATUS = num_var ]
> > > >
> > > > STATUS - Sets the numeric variable to zero if
> the
> > > OPEN
> > > > succeeds and to -1 if it fails.
> > > >   Without the STATUS argument, a failure on
> OPEN
> > > causes SQR
> > > > to halt.  By using a
> > > > STATUS variable, you can control what
> processing
> > > should occur when
> > > >  a file cannot be opened.
> > > >
> > > > open $filename    as 6  for-reading
> > > record=132:vary status=#filestat
> > > >
> > > > if #filestat != 0
> > > >   ... error processing ...
> > > > end-if
> > > >
> > > > So slap a loop around it and you'll have your
> > > status checker.
> > > >
> > > > Then make an include out of it...
> > > >
> > > > hth,
> > > >
> > > > Rick
> > > >
> > > > "Ross, Steven" <sross@KCM.ORG>@list.iex.net>
> on
> > > 12/04/2000 01:49:41 PM
> > > > To:   SQR-USERS@list.iex.net
> > > > Subject:  File numbering
> > > >
> > > > Is there a way to obtain "the next valid free
> file
> > > number"
> > > > when running
> > > > SQR?  In Visual Basic, we can use the code:
> > > >
> > > >    FileNumber = FreeFile   ' Get unused file
> > > number.
> > > >    Open "TEST.DAT" For Output As FileNumber
> > > >
> > > > I'm writing a "common" routine that can be
> called
> > > by many
> > > > SQRs, and I don't
> > > > want to have to hard code the file number.
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Shopping - Thousands of Stores. Millions of
> Products.
> > http://shopping.yahoo.com/
> >
>


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/