Creating a Program

Submitted by Karthikeyan on


       A Program is a set of instructions used to achieve the desired output.

To create new program or to edit the existing one.



NOTE command

            If ignore the particular line or command, NOTE can be used at the beginning of that line.

Comment Line

            To add comments to the right of the Programming code , use &&

 Clear All Command

            This command is used to closes all databases files and releases all active memory variables, arrays menus or popup.

Input / Output command

                         ? | ?? | ??? [expr1?]

?      - To print the expression in new line

??    - To print the expression in the same line

???  - The Output will going to the printer


          ? "Hellow!"

Sample Program

            NOTE prg for just print something on the screen

Clear           && To Clear the Screen or previous outputs



?? " World...!" 

??? "Thank you” 


Writing Programs

 * FoxPro has powerful built-in editor for writing    and editing.

* It can be invoked from the command window by   using the MODIFY COMMAND.   


            MODIFY COMMAND <prenames>


    Modify Command journal

    (This program will automatically save with the      extension .PRG)

 Press CTRL + W - To save and close the program window

 Executing Program

            Programs can be executed by DO command.


            DO <prgname>


             Do journal

 When compile the executed file the FoxPro creates an object code program with .FXP extension. If there are any errors, creates a file an .ERR extension.

 INPUT command

 It is used to accept Numeric input from the user and store it into a memory variable.


            INPUT [<char exp>] TO <memvar>


Store 0 to eno

INPUT              "Enter your Enrollment No : " TO eno

? Eno

ACCEPT command

It is used to accept character input from the user and store it into a memory variable.


            ACCEPT [<char exp>] TO <memvar>


            Store space (15) to NAM

ACCEPT "Enter the Name: " to NAM

? "Entered name:” NAM

Example 2



Accept  "Enter your nane :" to nam

Input "enter your Age  : " to age

Accept " enter your city  :" to cit

Accept "Enter your Mail id  : " to mail

? "******************************************"

? "NAME  ::  " ,nam

? "AGE      ::  " ,age

? "CITY     ::   " ,cit

? "MAIL ID::  " ,mail

? "******************************************"


Setting/restoring the environment

         Every FoxPro program includes all commands required to establish the working environment and restore it to its prior state before the program terminates execution. This is achieved by issuing some set.

 Set notify on/off

            Enables the display of certain system messages.

Set talk window

            Directors the display of system messages to an user-defined window instead of the system window. Sets notify should be ON.

Set deleted on/off

            Processes records marked for deletion.



Feb 26, 2018 - 15:52



Sep 06, 2012 - 12:34

like this

Recommended :
FoxPro e-Book
  1. FoxPro Programming Quick Reference e-Book (New! Revised Edition)