` Printed Icetips Article

Icetips Article



Clarion in general: Closing all files and cleaning up with one call
2002-11-04 -- Gordon Smith
 
Newsgroups: softvelocity.products.c55ee.bugs

Just call:

    module('')
ClaCloseAll  procedure, name('Cla$CloseAll')
    end

before you call Chain (this is what Halt does).

Gordon.

> Chain Help: "CHAIN terminates the current program, closing all files and
> returning its memory to the operating system, and executes another
program."
>
> The below sample demonstrates that CHAIN starts the new program before
> terminates the current program. I want to use CHAIN to shutdown the
current
> program and restart it. 16-bit does not work when CHAIN(COMMAND(0)), but I
> don't care. 32-bit starts new program before old copy shutsdown.
>
> In my app a file is not the problem, its a Mutex that I need released by
the
> shutdown process. CHAIN appears to besically be RUN('new.exe') ; HALT()
> which is not what the docs say.
>
>
>     PROGRAM
>     MAP.
>
> ChainTesFile
FILE,DRIVER('ASCII'),NAME('chaintest.$$$'),PRE(cht),CREATE
> Record                RECORD,PRE()
> Line                     STRING(255)
>                        END
>                   END
> FailCnt     LONG
> DummyWindow WINDOW('Caption'),AT(,,185,92),FONT('MS Sans
> Serif',8,,FONT:regular),GRAY
>      END
>
>     CODE
>     !A program CHAIN itself does not work
>
>     IF ~EXISTS(Name(ChainTesFile))
>         CREATE(ChainTesFile)
>     END
>
> !    OPEN(DummyWindow)  !See if opening a window helps
> !    ACCEPT
> !        IF EVENT() THEN BREAK.
> !    END
> !    CLOSE(DummyWindow)
>
>     LOOP  10000 times
>         OPEN(ChainTesFile)
>         IF ERRORCODE()
>            FailCnt+=1
>            !Without STOP fails 10000 times
>            STOP('Error OPEN file, Igone will try again <13,10,13,10> ' &  ERROR() )
>         ELSE
>             BREAK
>         END
>     END
>
>     cht:line=today()&'-'&clock()
>     ADD(ChainTesFile)
>
>     CASE MESSAGE('Please Select||' & COMMAND(0)&'||FailCnt=' &
> FailCnt,'Chain Test',,'Chain|Exit', 1, 0)
>     OF 1  ! Name: Chain  (Default)
>             !Message('Ready to chain')
>             CHAIN(COMMAND(0))
>             Message('after chain should not see')
>     OF 2  ! Name: Exit
>     END !CASE
>
>     CLOSE(ChainTesFile)



Printed November 21, 2024, 6:46 am
This article has been viewed/printed 35215 times.
Google search has resulted in 18 hits on this article since January 25, 2004.