• No results found

ind1cator_arg

In document DataFlex V2 Jul1984 pdf (Page 119-129)

EXAMPLES:

INDICATOR pass

fall

new old change

See the chapter on INDICATORs for more information.

————————————————

C-8 ELEMENTS OF CONFIGURATIONS DataFlex 2.0 User's Manual

THIS PAGE INTENTIONALLY LEFT BLANK

—— —————————

=============="""""":

"""""""":"""""""""""""::"::7"""

" C"9

=~"~==~===,~

="=""""""""""""""""""""""

""""""

=""======= """"

======="== ==========

DEa-ARINg DATA ELEMENTS

::::Z

--

——— ~ ~~

========== ———————

—————— There are five DataFlex Definition Commands:

STRING NUI¶3ER DATE INTEGER INDICATOR

They serve to provide the configurator with a means of identifying typed variables to the DataFlex compiler. Once identified, the

variable argument can be used at

will

throughout the configuration. The definition comnand which establishes a variable must precede the

first

use of the variable in a given configuration.

FORMAT:

COMMAND var1ab1e_arg EXAMPLE:

STRING keyboard_1nput

The

first

three definition comands support the three data types which can be defined in a DataFlex

file

structure: ASCII strings, numbers

(stored as packed BCD), and dates (Julian - stored as packed BCD numbers). In the case of the NUMERIC and DATE connands9 up to nine

(9) variables can be defined on a single comand line. STRING Command

If

the maximum string length is not spéc1f"fédo a default maximum

length of 80 characters is assigned by DataFlex. Use of defined

string space is not dynamically allocated in memory; therefore, length specification can significantly conserve memory utilization. Strings consume their defined length plus 2 bytes in memory. The

allowable range for string length specification is from I to 255

characters.

FORMAT:

STRING variab1e_name {string length}

C-lO DECLARING DATA ELEMENTS DataFlex 2.0 User's Manual

EXAMPLES:

STRING flag I STRING response STRING my_entry lOó

The string variables HÁG$ RESPONSE, and MY_EN1RY are declared for a DataFlex configuration by the above commands. FLAG is

defined to one (I) character. RESPONSE is defined to eighty (BO) characters by default, and MY_ENTRY is defined to a

length of one hundred (LOO) characters.

If

entry is subsequently made to a string variable which exceeds the

declared length of the variable, excess input

will

be discardecb such as:

STRING code 3 MOVE "ABCDE" TO code

CODE will not contain ABCDE.

It will

contain only the

first

3

characters, ABC. No error will be declared unless one is provided for the condition in the configuration.

NUMBER Command

Multiple numeric variable arguments can be defined on a single definition line. The variable names must be separated by spaces. FORMAT:

NUMBER variab1e_namel variab7e_name2

...

variab1e_namen

EXAMPLES:

NUMBER quantity

NUMBER amount_due credit

NIM3ER area_code phone_exchange phone_number

A NUMBER variable consumes 10 bytes of memoryp and has a value of zero

automatically when

it

is declared.

If

there is sufficient m«nory for storing them DataF1ex can manage up to 32g767 active NUMBER variables

at one time. The range of numbers in DataFlex is: + or - 99,999.999.99%999.9999

"

DATE Command

Mu1tip1e date variable arguments can be defined on a single comand

line. FORMAT: DATE date_argl

...

date_argn EXAMPLES: DATE invo1ce_date

DATE due_date ffrst_reminder second_reminder

=,=~~———~~————~—"" =

"""""

DataFlex 2.0 User's Manual DECLARING DATA ELEMENTS C-ll

_—— —————

————.

INTEGER Command

The INTEGER command allows the creation of a memory variable to

contain an integer value.

It

differs from the NUMERIC variable in

that the INTEGER variable consimes less mmory for storagep anch of

course, does not support fractional accuracy in calculations.

However, the greatest value of integers in corifigurations is when they are used for counters, in FOR 1oopsp and with the INCREMENT command. Some pre-defined integers provide access to DataFlex systan variables

(e.g. ERRLINE = the last error line).

The range available for Integers is plus or minus 327767. There is no INTEGER storage type in the data base; all numbers are stored on disk as binary.coded decimals (BCD). In memoryg however, a NUMBER data

element constnes ID bytesp while an INTEGER data element occupies only 2 bytes. FORMAT: INTEGER argumentl

...

argumentN EXAMPLES: INTEGER my_age

INTEGER qty_so1d qty_returned qty_shipped

Integer variables are stored in an internal array in the order in

which they are declared. When the DataF1ex CHAIN connand is execute6

the integer array is jiQt reinitialized. This provides the

facility

to pass integer values from one configuration to another without writing

the values to a

file.

The internal integer array is sequentially allocated as the variables

are declared. Thereforeg

if it

is desired to pass integer values in

QiAINed configurations, we suggest that the same integer names be

declared at the beginning of each configuration to provide for a

consistency in variable referencing. When integer values are not

passed between configurations, they should be initialized before use. EXAMPLE:

MOVE O TO sheep_counter

//

inlt1alize sheep_counter

————————————————

C-12 DECLARING DATA ELEMENTS DataF7ex 2.0 User's Manual

——

————

INDICATOR Command

The INDICATOR definition command defines a special type of DataFlex

argument which is used for conditional processing and program control.

The INDICATOR comíand creates an "Indicator".

The named indicator established as the argument of the INDICATOR command takes on the characteristics of a "flag" which is tested by

the configuration to determine whether a cormand line or group is to

be executed. Indicators are discussed

fully

in the section on

"Conditional Execution".

FORMAT:

INDICATOR ind1cator_arg

==—————~—————~ """"""""""===————— C"l3 —— —————— ~~~~

—————————— ——————————

========== MANIFULATING DATA ELEKNTS ==========

=========~~~—————————————————————————— ——————————— =

——————————— MOVE Command

MOVE provides the

facility

to "transport" data throughout a DataFlex application without regard for the type or location of the source or

destination arguments. Data can be MOVEd from window to window» window to data base "e1ment"» element to windowp element to e1%entp

expression to window or e1emeñt» etc.p etc. Where expressions are

part of the MOVE connandp they will be automatica1ly evaluated with

the result being MOVEd to the destination argument. Further. any

required type conversions will also be executed automatically. FORMAT:

MOVE source_var TO dest1nat1on_var EXAMPLES:

MOVE "DataFlex" TO str1ng_arg MOVE 06/01/83 TO date_arg MOVE (invt.qty

-

qty_ordered) TO invt.qty

MOVE screen.date TO lnvo1ce_date

//

then... MOVE (invoice_date + 30) TO invoice.due

The MOVE command decodes the type of the destination variable and

internally generates one of the fOllowing types of move commands for

the comnand processor: MOVENUM for numbers MOVEINT for integers MOVESTR for strings

Neither variable may be a label or indicator. While the source may be a

literal

string or numbem the destination variable may not be. The MOVE command will not update accumulators in the SUBTOTAL section of

the REPORT macro. See the PRINT command for this purpose.

C-14 MANIPULATING DATA ELEMENTS DataFlex 2.0 User's Manual

INCREMENT Command

The INCREMENT comand operates on an integer variable, and is used as a counter for loops and repetitive operations. Literals, 1abelm and

indicators may not be used in this command.

It

incrwents only by the

integer

I.

FORMAT:

INCREMENT fnteger_var

This comnand is equivalent to:

MOVE ('lnteger_var + I) TO integer_var

...but is faster in operation.

—————— CALCULATE Command

The CALCULATE comnand is used to evaluate an expression and move the result to a destination variable of the numeric type. When using the CALCULATE comand you must determine

if

the destination argument is of

the numeric type.

If

you are not sure, use the MOVE connand instead. MOVE can also evaluate expressions.

An abbreviation of the CALCULATE commanch "CALC" can be used inter- changeably with the

full

comnand word.

FORMAT:

CALC{ULATE} expressfon_arg TO destinat1on_var EXAMPLES:

CALWLATE (12+6) TO g_tota1

CALC (date_ord+cust.tems) TO invo1ce.date_due CALC (3.14*66.4) TO area

The destination variable may not be a label. indicatorp constantg or

ASCII variable.

It

may be an integer9 numer1cg or date variable. The CALCULATE comnand will not update accumulators in the SUBTOTAL section

of the REPORT macro. See the PRINT command for this purpose.

—————-.————

~ ~—~~—_~———~—__~======"="="===== CR 5

==-==:::

DATA ENTRY =-EFE=-==-

"=""====== ——~— —~ —~ ———— ——~~———~——~~———~======= ——————————————————————————

Application requirements for data entryp

file

maintenance and

file

inquiry, are efficiently met by the DataFlex ENTER command macro. ENTER provides a complete program skeleton for data entry using IMAGE

formats and Flex-keys. The ENTER macro can handle multi pIe rela'ted f11esp

file

update proceduresp transaction creation and online

editing. There are user-defined procedures for specific operations so

the user can set up whatever auxiliary update procedures and error

trapping may be required.

Since connand macros are stand-alone program skeletons, they can only

be used once in a configuration. Specl

f

ic connand statements are used

within and around the command macros to provide functions to

accommodate a variety of requirements.

The ENTER comand invokes the ENTER macro, which is in fact an entire group of processing routines that perform the following functions:

l.

ENTER data via CRT screen images, with validation,

type checking, range checking and error trapping.

2. CREATE records in the data base with data entered through

the screen imagep and in the process» update related data base records, key iMéxésó etc.» all without having to

create routines and procedures for such activities.

3. FIND data in the data base by key field and display

it

on

the formatted CRT "image". Single records or multiple

related records can be "found" with a single key stroke. Data can then be inspected, scannéd» "edited, deleted.

4. EDIT existing records in the data base and in the process,

properly update related data base records, key indexesD

etc. without custom routines and procedures. 5

. DELETE records from the data base while processing

all

required updates on-line.

6. CLEAR displayed data from the screen image.

~ ~

————

C-16 DATA ENTRY DataFlex 2.0 User's Manual

=="·="'="'=

The operation of the ENTER command macro assumes that the database

fijes

dealt with have previously been defined with the DataFlex FILEDEF or AUTODEF

utilities.

Mu1tipie records from different database

files

can be displayed with ease and f1exibi11ty by the ENTER macro. However. the structure of

the ENTER comnand does impose the limitation that only one record from a given data

Íile

may be displayed on the screen at one time.

It

will not, for example, support a multi-item format like an invoice. Con-

figurations requiring mu1ti-1ine formats should be "programmed" with-

out the use of the ENTER macro. The ENTERGROUP comand is useful In

applications requiring multi-line formatting. See the INVOICE.FRM demo

file

for an example of a programmed mu1ti-1ine (non-ENTER)

configuration.

A specific command structure is used with the ENTER macrog and there are a series of optional comnands designed to control the formatting and actions which

occur within the data windows of the screen image.

Configuration examples at the end of this chapter can serve as a

useful guide during the discussion of these coimands.

————————————

DataFlex 2.0 User's Manual DATA ENTRY C-17

ENTER CONFIGURATION STRUCTURE:

//

IMAGE SECTION

---

lpagenamel

//

start image section

---- first

page of image

---

/pagename2

//

can have multiple images

----

following pages of image

---

l*

//

end of image section

//

PRE- ENTER COMMAND SECTION

""--

OPEN f11el

//

open all

files

and

OPEN f1le2

// initialize

any variables used and

//

give window formatting commands

//

"""___"____ INVOKE ENTER MACRO USING ENTER COMMAND

----

="="

ENTER

filel

fi1e2

//

start ENTER mini program

//

declare related

files

In order:

//

"senior" to "junior"

//

= ENTRY SECTION _______"___

AUTOPAGE page

//

AUTOPAGE required only for

//

second and following screens EN7RY field {windjw} {options}

ENTRY

In document DataFlex V2 Jul1984 pdf (Page 119-129)