[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SET FORMAT*
 Activate a format when READ is executed
------------------------------------------------------------------------------
 Syntax

     SET FORMAT TO [<idProcedure>[.<ext>]]

 Arguments

     TO <idProcedure> is a format (.fmt) file, a program (.prg) file, or
     a procedure.

     <ext> is the extension of the format file.  If not specified, the
     default extension is (.fmt).

     SET FORMAT TO with no argument deactivates the current format.

 Description

     SET FORMAT defines a procedure to execute when a READ is invoked.
     Unlike the interpreted environment, formats are not opened and executed
     at runtime.  Instead, the CA-Clipper compiler treats SET FORMAT the same
     as a DO command.  The compiler first looks to see whether it has already
     compiled a procedure with the same name as <idProcedure>.  If it has, it
     uses that procedure for the reference.  If <idProcedure> is not found,
     the compiler looks to disk for a file with the same name.  If this file
     is not found, an external reference is generated that must be resolved
     at link time.

     SET FORMAT is a compatibility command and not recommended.

 Notes

     .  Active format procedures: Unlike other dialects where each
        work area can have an active format, CA-Clipper supports only one
        active format procedure for all work areas.

     .  Screen CLEARing: CA-Clipper does not clear the screen when a
        format procedure is executed.

     .  Legal statements: Format procedures allow statements and
        commands in addition to @...SAY and @...GET.

     .  Multiple pages: CA-Clipper does not support multiple-page
        format procedures.

 Examples

     .  This example uses a format procedure to add records to a
        database file until the user presses Esc:

        USE Sales NEW
        SET FORMAT TO SalesScr
        DO WHILE LASTKEY() != 27
           APPEND BLANK
           READ
        ENDDO
        RETURN

        PROCEDURE SalesScr
           @ 12, 12 SAY "Branch     : " GET  Branch
           @ 13, 12 SAY "Salesman   : " GET  Salesman
           RETURN

 Files   Library is CLIPPER.LIB.


See Also: @...GET @...SAY PROCEDURE READ
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson