Skip to main content
Home
Live to Learn!

Main navigation

  • Home
  • Learn
    • FoxPro
    • MS-DOS
    • C PRG
    • Java
    • ASP
    • Ruby on Rails
    • ASP.NET
    • E-Books
    • Exam Preparation
    • Tools
  • Blog
  • Forums
  • Contact
User account menu
  • Log in

Breadcrumb

  1. Home
  2. FoxPro Programming

Input and Output Statements in Foxpro

Book navigation

  • FoxPro Commands - Part 1
  • Foxpro commands - Part 2
  • Data Types in FoxPro
  • Numeric Functions in FoxPro
  • Creating a Program
  • Input and Output Statements in Foxpro
  • Control Structures in Foxpro
  • Creating menu in Foxpro for DOS
  • Simple Journal Entry program
  • Simple Ledger creation & Posting Program
  • Trial Balance Program
  • Balance Sheet Program
  • Simple Weekly Calendar Generation
  • How to install FoxPro 2.6 in Windows 10 / Windows 8 / Windows 7?
  • How to install FoxPro 2.6 on Linux OS (Ubuntu 20.04 | 20.10 | 21.04)?
  • How to install FoxPro in Windows 10 64 bit using VDosPlus?
By Karthikeyan , 28 September, 2009

Input and output in foxpro

          As we already know that data can be entered into tables through the APPEND/BROWSE commands. Data entry for tables can also be done through programs. There arises a need to display and accept information in a formatted way.

          The @…say command is used to place data at a particular screen location and to display data stored in fields or memory variables. The @…get commands is used to retrieve data.

Displaying data

 @…say command: -

Syntax: -
@<Row, columns>SAY<expr>
[Function<exprC1>]
[Picture<expr2>]
[size<exprn],<exprn2>]
[font<exprC3>[,<exprN3]]
[STYLE, exprC4>]

Example:-

            @2, 10 say “hello welcome to FoxPro”

 

Syntax:

Input

@row,column | say <char_exp> get <mem_var>      

Output

@row ,column | say <char_exp> get <mem_var>

 

Clear

@row, column to row, column clear

Clear all

 

Ex

            @5, 5 clear to 20, 20

 

Box Command

                        @row1, column1 to row2, column 2

Picture clause

 PICTURE clause is used to control of display or the information to be accepted.

  @..SAY...GETS PICTURE CODES:

    A       -       Allows only alphabets

                9        -       Allows only digits, signs for numeric data

                N       -       Allows Letters and Digits

                #       -       Allows Only Digits, Blanks and Signs

                X       -       Allows any Character

                L       -       Allows any Logical Data T, t, F, f, Y, y, N, n

                Y       -       Allows Only Y, y, N, n

                !       -       Converts letters into uppercase.

                *       -       Displays asterisk in place of leading zeros.

                ,       -       Display the comma

                .       -       Display the decimal Point.

Function Clause

You can include the function clause, the picture clause or both to control how<expr> is displayed or printed. A function clause affects the entire expression. It contains only the following function code.

Function code & Purpose
B Left – justifies numeric data within the display region.
Example:
Clear
Store 2750 to num
@5,20 say num
@6,20 say num function “B”

C Cr is displayed after a positive number to indicate a credit. Can be used with numeric data only.
Example:-
Clear
Store 15432.00 to amt
@5,20 say amt
@6,20 say amt function “c”

D Uses the current set DATE format.
Example:-
Clear
Store 230801 to num
Store “foxproprograming” to tit
@5,20 say num function “D”
@6,20 say tit function “D”

E Edits date type data as British date
Example:-
Clear
Store 230904 to num
@6,20 say num function “E”

T Trim leading and trailing blanks from<expr>
Example:-
Clear
@5,20 ”fox” to tit
@6,20 say tit function “T”

X DB is displayed after negative numbers to indicate a debit. used only with numberic data.
Example:-
Clear
Store -15432.00 to amt
@5,20 say amt
@6,20 say amt function “X”

Z <expr> is displayed as all blanks if its numeric
value is 0. used only with numeric data.
Example:
Clear
Store o to amt
@5,20 say amt
@6,20 say amt function “z”

( Encloses negative numbers in parentheses. Used only with numeric data.
Example:-
Clear
Store –755 to amt
@5,20 say amt
@6,20 say amt function “(“

! Converts alphabetic characters to upper-case used with character data-only
Example:-
Clear
Store “foxpro programming” to tit
@6,20 say tit function “!”

^ Displays numeric data using scientific notation. Used with numeric data only.
Example:-
Clear
Store 75815 to amt
@6,20 say amt function “^”

$
Displays data in currently format. the currency symbol appears before or after the field value depending on the current setting of set currency. used with numeric data only.
Example:-
Clear
Store 75815 to amt
@6,20 say amt function “$”

Picture expression can include the following characters:-

X Allows any character.

Y Allows logical Y, y, N and n only. Converts y and n to Y and N, respectively.
! Displays the current currency symbol specified by set currency. By default, the symbol is placed immediately before or after the field.
* Asterisks are displayed in front of the numeric value. Use with a dollar sign $ for check protection.
. A decimal point specifies the decimal point position.
, A comma is used to specifies digits to the left of the decimal point.

 

  • Add new comment

Comments

Featured Blog Posts

Convert Currency in Number to Words (Indian Rupees) - MS Excel
Foxpro Tutorial and Programs
Convert Currency in Number to Words in MS Word
Convert Currency in Number to Words (Indian Rupees) - Version 2
Best way to Use Rupee Symbol in Windows – Easy steps
Convert Currency in Number to Words - MS Access
Creating All in One Windows XP DVD with all Important Applications
RSS feed

© 2009-2025 Live to Learn.In

Terms of Use | Privacy Policy