You are on page 1of 3

Creating a Program

Submitted by admin on 28 September, 2009 - 11:13 PROGRAM A Program is a set of instructions used to achieve the desired output. To create new program or to edit the existing one. MODI COMM OR MODIFY COMMAND <PRGRAM_NAME> 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 Example: ? "Hellow!" Sample Program NOTE prg for just print something on the screen Clear && To Clear the Screen or previous outputs ?"Welcome" ?"Hellow!" ?? " 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. Syntax: MODIFY COMMAND <prenames> Example: 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.

Syntax: DO <prgname> Example: 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. Syntax: INPUT [<char exp>] TO <memvar> Example: 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. Syntax: ACCEPT [<char exp>] TO <memvar> Example: Store space (15) to NAM ACCEPT "Enter the Name: " to NAM ? "Entered name: NAM Example 2 clear SET TALK OFF 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.

You might also like