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

Re: opening file - determine if empty



Excellent, dude! :-)

                -----Original Message-----
                From:   Wendel, Robbi [mailto:rwendel@NESPOWER.COM]
                Sent:   Tuesday, August 08, 2000 9:38 AM
                To:     SQR-USERS@list.iex.net
                Subject:        Re: opening file - determine if empty

                Thanks Bill and Ted !

                I had the check for end of file, but it was at the end of my
While loop.  I
                move it to the top of my loop similar to Bill's suggestion
and then also
                added a check for my count (see below)

                Move 0 to #count
                While 1 = 1
                   read 1 into $loadrec:51
                   If #end-file = 1
                      break    !exit while loop
                   Else
                     If #COUNT = 0
                        Do delete-process !Only want delete to execute first
time
                     End-if
                   End-if
                continue with read
                blah
                blah
                Do Insert-procedure
                Add 1 to #count
                end-while

                If this were a large file I would probably shy from this
because although
                the delete will execute only once it, causes a compare of
#count to 0 for
                every record read.  In our case it is not a large file, so
it will work
                great.

                Thanks again!
                Robbi


                -----Original Message-----
                From: THoughto@unitedroad.com
[mailto:THoughto@unitedroad.com]
                Sent: Tuesday, August 08, 2000 7:48 AM
                To: rwendel@NESPOWER.COM
                Subject: RE: opening file - determine if empty


                I don't have any code that does this, but you should be able
to accomplish
                this quickly.
                Add a routine to the job that counts the records.  Set the
variable = 0 at
                the beginning.  If the value is still 0 after your procedure
ran, then the
                file is empty.

                If you add an if statement to this, you would be able to
either load the
                table, or skip the load based on the record count.

                If you need a sample, I will try to throw a rough draft
together for you
                later this morning.
                Let me know if this helps!


                Ted Houghton
                United Road Services, Inc.



                                -----Original Message-----
                                From:   Wendel, Robbi
[mailto:rwendel@NESPOWER.COM]
                                Sent:   Tuesday, August 08, 2000 8:34 AM
                                To:     SQR-USERS@list.iex.net
                                Subject:        opening file - determine if
empty

                                Good morning,
                                I expect this is going to be a no brainer
for some of you,
                but I am drawing
                                a big blank (sad but truthful)

                                I have a flat file that based on it's
existence, we delete a
                table and
                                reload it with the contents of the file.
There is the
                possibility that the
                                file could exist but be empty. So EXIST
won't help. Is there
                a quick way
                                (function or code) that I can determine if
the file is empty
                before
                                proceeding?

                                TIA,
                                Robbi Anne Wendel
                                SCT Corporation
                                rwendel@sctcorp.com
                                rwendel@nespower.com
                                (615) 747-3078





                *************************** N O T I C E
                **************************************

                This message and any attachments is intended only for the
individual or
                company to which it is addressed and may contain information
which is
                privileged, confidential or prohibited from disclosure or
unauthorized use.
                If the recipient of this transmission is not the intended
recipient, or the
                employee or agent responsible for delivering such materials
to the intended
                recipient, you are hereby notified that any use, any form of
reproduction,
                dissemination, copying, disclosure, modification,
distribution and/or
                publication of this e-mail message or its attachments other
than by it's
                intended recipient is strictly prohibited by the sender. If
you have
                received it in error, please notify us immediately and
destroy the message
                and all copies in your possession.

                This message has been scanned for viruses by Norton
Antivirus.




-------------------------------------------------------------------------
                This email server is running an evaluation copy of the
MailShield anti-
                spam software. Please contact your email administrator if
you have any
                questions about this message. MailShield product info:
www.mailshield.com