• No se han encontrado resultados

Técnica de visualización científica para datos discretos o continuos a trozos 48

Capítulo II: Algoritmos de pre y post-proceso para la generación de nubes de puntos y la visualización de

2.3 Visualización de datos discretos 48

2.3.1 Técnica de visualización científica para datos discretos o continuos a trozos 48

——————————————————-————— —-—————

C-72 SAMPLE APPLICATIONS DataF1ex 2.0 User's Manual

CUSTOMER FILE DESCRIPTION:

The specifications (sizep content and indexing) of the CUSTOMER data base

file

can be displayed or printed out with the FILEDEF program. The display/printout looks like this:

FILE DEFINITION LISTING FOR FILE #25

***************************************************

FILE ROOT NAME = CUSTOMER USER DISPLAY NAME = CUSTOMER FILE SHORT NAME = CUSTONER

***************************************************

RECORD LENGTH = 128 (USED = 103) MAX NUMBER OF RECORDS = lOó (USED = 4) DELETED SPACE IS REUSED

MULTI-USER RE-READ INACTIVE

***************************************************

FIELD FIELD FIELD FIELD DEC MAIM RELATES--TO NMBR OFFSET LEN TYPE PTS INDEX FILE FIELD

1 1 30 ASCII O O O O CUSTOMER 2 31 30 ASCII O O O O ADDRESS 3 61 14 ASCII O O O O CITY 4 75 2 ASCII O O O O STATE 5 77 10 ASCII O O O O ZIP 6 87

l

NUMERIC O O O O DISCOUNT

7 88 4 NUMERIC 2 O O O PUR MONTH

8 92 4 NUMERIC 2 O O O PUR YEAR

9 96 4 NUMERIC 2 O O O PROFIT

10 lOó 4 NUMERIC 2 O O O DUE

INDEX

l:

FIELD SEGMENTS: <1> <0>

This display

tells

us the following things about the ájSTOMER

file:

The CUSTOMER

file

is DataFlex

file

number 25

The ROOT FILE NAME (the one that

will

show on a disk directory) is

"CUSTOMER"

When a

file list

is displayed to the operator

it

will

show as "CUSTOMER FILE"

Each CUSTOMER record

will

take up 128 bytes in the data

file

(record

length) and that of the l28g 103 bytes have been used.

The

file

can contain up to lOó customers (provided there is sufficient

disk storage) but that only four records currently exist.

====."=====".======"==="=====—_———————————__— —————————————

DataFlex 2.0 User's Manual SAMPLE APPLICATIONS C-73

If

a custaner is deleted. the next customer to be added

will

be assigned the deleted custanerts disk and record number automatically by DataFlex (deleted space is REUSED).

The CUSTOMER

file

is not expected to be used in a multiuser environ- ment. (Multi-user Re-read is set INACTIVE).

There are 10 data fields in each custaner record. Their lengths, data

types, and names are also shown.

One index is active for the CJJSTOMER

file,

composed of field <1> (the customer name), and field <0> (the system record number).

Note that the 4-byte NUMERIC fields

will

each hold 8 digits. 2 after

the decimal point.

Notice that in this

file

the record number is used as a system assign- ed account number. This provides for maximum operator and systan speed when finding a custcmer record (particularly since the operator would remember frequently used customer numbers). Where this doesn't work welb you could create an additional indexeci field

for user-

assigned account IVS or not use any codes at all by always using the CUSTOMER NNE. The operator can easily FIND the record by QJSTOMER NN4E since that field is also indexed. Although access by record number is fastest, the INDEXING in DataFlex is so fast that indexing

should not be avoided for reasons of performance.

The record number <0> is made part of the index with CUSTOMER NAME to

create unique index entries to allow two customers with same name. THE <CUSTOMER> CONFIGURATION FILE

The

file

name of the ájSTOMER

file

configuration on your demo disk is "CUSTOMER.FRM". The configuratfon

file

looks like this:

C-74 SAMPLE APPLICATIONS DataFlex 2.0 User's Manual

/F0RM

DATA ACCESS CORPORATION CUSTOMER MASTER FILE

CUSTOMER NUMBER:

<_.>

NAME: <

'

ADDRESS: CITY: ST:

_

ZIP: DISCOUNT: _.% PURMASES/MONTH $ .

_

PURMASES/YEAR $

._

PROFIT/YEAR $

._

Windows with < > can be used to FIND customers

l*

//

This is a simple ENTER configuration for customer

file

maintenance.

//

Since the windows are processed sequentia11y9 the AUTOPAGE function can

//

be used and the windows do not have to be explicitly named.

OPEN CUSTOMER

//

All

files

must be opened

ENTER CUSTOMER AUTOPAGE FORM

//

Each ENTRY connand is followed by the database element

it

references.

//

The window is assigned by autopage. After the command the

//

options surrounded by {}.

ENTRY CUSTOMER.RECNUM {AUTOFIND,N0PUT}

//

Translation: Do data entry on the record number of the customer

// file.

Automaticaily FIND by this field when data in input, but

//

do not put data back into the record buffer since record number

//

caMt be changed.

ENTRY CUSTOMER.CUSTOMER

//

Translation: Do data entry on the customer name of the customer

file

ENTRY CUSTOMER.ADDRESS

ENTRY CUSTOMER.CITY ENTRY CUSTOMER.STATE ENTRY CUSTOMER.ZIP ENTRY CUSTOMER.DISCOUNT

ENTRY CUST0MER.PUR_MONTH {DISPLAYONLY}

//

Translation: When the customer

file

is founcb display purchases

//

for the month in this window

ENTRY CUST0MER.PUR_YEAR {DISPLAY0NLY} ENTRY CUSTOMER.PROFIT {DISPLAYONI-Y} RETURN

//

return from entry section ENTEREND

//

end of enter configuration ABORT

//

abort after escape key.

KEYPROC KEY.USER// Define action of user defined key OUTPUT FORM

//

Output the page

ENTAGAIN

//

Return to same window

RETURN

//

End definition of user defined key

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

DataF1ex 2.0 User's Manual SAMPLE APPLICATIONS C-75

The HELP screens in the actual configuration have been eliminated in

the above

listing

to save space» as have certain spacing lines in the screen image

.

The top of the configuration

file

is the IMAGE format of the screen.

DataFlex

will

display the form exactly as

it

appears in the

first

part of the configuration. First the page is named with the "/F0RM",

designating "FORM" as the name of the page. The DATA WINDOWS are numbered from

left

to right, top to bottom. Notice that the last four

windows are numeric and that the last three contain exactly two places

to the right of the decimal point. There

are ten windows in this image format.

In this image, there is a one-to-one correspondence between the fields

in the data

file

and the display windows on the CRT screen. Images do

not need to display all fields from a

file;

a single data field from a

file

might be all that was needed to be displayed.

The line following the end of the screen contains a

"l*".

This mark

indicates the end of the image format.

It

is a required e1«nent of

the configuraton.

It tells

the DataF1ex compiler where the end of the image is, and where the command part of the configuration begins. The

first

command line opens the CUSTOMER

file.

All

files

that are to be used in a configuration must be OPENed. OPENS should be at the

beginlng of the configuration.

The next line in the configuration "ENTER CUSTOMER" begins the ENTER Command Group. The ENTER command is a DataFlex macro that is really

more like a complete program than just a comnand since

it

controls the whole operation of this configuration.

The next line, "AUTOPAGE FORM",

tells

the DataFlex compil er that we

will be using the page named "FORM". By using AUTOPAGE, we don't have

to specify each window on the page. They are assigned automatically

in sequence by the connand.

The next 10 lines are ENTRY commands. ENTRY comands work with the ENTER ccmnand and specify each data element and window. The window numbers can be emitted because of the use of the AUTOPAGE Command. See the section of this manual on the ENTER Command Macro for a complete discussion of the functions and uses of ENTRY.

The

first

ENTRY connand line uses two options:

AUTOFIND: Executes a FIND using data in the window when the <RETURN> key is pressed.

NOPUT: Do not put data BACK INTO the record buffer since

the record number (the window data in this case) can

riot be changed.

C-76 SAMPLE APPLICATIONS DataF1ex 2.0 User's Manual ———————

Refer to the ENTER Ccmmand Macro section for a

full list

of options.

At this time, review each of the command lines to see how the

file

and

field element names correspond to the windows in the screen image and

the data

file

definition. Note that in line one, record number is connected to window one (account number). This is typical in

files

where the record number is used as a system-assigned account number. The last line of the ENTER configuration for CUSTCNER FILE is an ABORT. When a

file

maintenance session is complete. pressing the ESCAPE key will cause the configuration to abort.

WSTOMER FILE REPORT EXAMPLE:

You need a simple report to

list

our customers, their discount and

total purchases. The following is the output of the REPORT program:

ájsToMER FILE

CUSTOMER DISCOUNT PUR/YEAR

4 DATA ACCESS CORPORATION 15% 100.00

3 DYSAN CORPORATION 5% 49,713.50

2 MAXELL 20% 12,056.00

l

MT MICROSYSTEMS» INC. 30% 57,000.00

118,869.50

~

DataFlex 2.0 User's Manual SAMPLE APPLICATIONS C-77 — —

This report is produced wIth the following report configuration: /HEADER

QJSTOMER FILE

CUSTOMER DISCOUNT PUR/YEAR

/BODY RESIDENT

0 _O%

»D_

/TOTAL

l*

OUTFILE

//direct

the output

OPEN CUSTOMER INDEX.I //open the custaner

file

REPORT CUSTOMER BY INDEX.I

//Print

the customers in custcmer name order.

SECTION HEADER

OUTPUT HEADER //slmply output the page headings SECTION BODY

PRINT QjST0t·ER.RECNUM //customer id number is system assigned PRINT ájSTOMER.CUSTOMER //custcmer name

PRINT ájsToMER.DIscoUNT PRINT ájsT0MER.pUR_YEAR OUTPUT BODY

SECTION TOTAL

SUBTOTAL BODY.4 //subtotal will take the accumulator

//for

any numeric window and print

//it

in another window.

//print

the total purchases for all

OUTPUT TOTAL //custcmers in the database

REPORTEND ABORT

~

—————— —

C-78 SAMPLE APPLICATIONS DataF1ex 2.0 User's Manual

THE VENDOR FILE:

The vendor

file,

like the CUSTOMER

file,

is a single

file

configura- tion. We will relate other

files

to

it

at a later time. The

first

step is to run the VENDOR configuration from the DEMO menu. Then examine the

file

definition for VENDOR and compare

it

with that of the

CUSTOMER

file.

FILE DEFINITION LISTING FOR FILE #21

***************************************************

FILE ROOT NAME = VENDOR USER DISPLAY NAME = VENDOR SHORT NAME = VENDOR

***************************************************

RECORD LENGTH = 128 (USED = 112) MAX NUMBER OF RECORDS = 400 (USED = 15) DELETED SPACE IS REUSED

. MULTI-USER RE-READ INACTIVE

***************************************************

FIELD FIELD FIELD FIELD DEC MAIN RELATES--TO NMBR OFFSET LEN TYPE PTS INDEX FILE FIELD

l

l

30 ASCII

l

O O VENDOR 2 31 30 ASCII O O O ADDRESS 3 61 14 ASCII O O O CITY 4 75 2 ASCII O O O STATE 5 77 9 ASCII O O O ZIP 6 86 3 ASCII O O O PHONE-AC 7 89 3 ASCII O O O FH0NE_Exá-g 8 92 4 ASCII O O O FH0ME_NUMBER 9 96 2 NUMERIC O O O O TERMS 10 98 4 NUMERIC 2 O O O CREDIT_LIMIT

li

102 4 NUMERIC 2 O O O CREDIT_USED 12 106 4 NUMERIC 2 O O O PURCHASES 13 110 3 DATE O O O LAST_PURCHASE

INDEX

l:

FIELD SEGMENTS: <1> <0>

Note that the use of record number as an account number is used here as well. The indexing is also very much the same as in the CUSTOMER data base

file.

The only real difference is the content of the

DataFlex 2.0 User's Manual SAMPLE APPLICATIONS C-79

fields. This is an important DataF1ex concept: that the way infor-

mation is dealt with remains constant even though the application may change.

The VENDOR

file

introduces us to the DATE data type and field format. Dates in DataF1ex are kept in JULIAN format, or, the number of days

since day zero. SInce dates are kept as numbers we can use them in

arithmetic expressions (add or subtract them). This is quite useful for ageing reports and due date calculations, etc. Even though dates

are stored as numbers, they are always displayed in a DATE format window

(_J_J_)

automatically converted to the conventional MM/DD/YY

format.

File maintenance on the VENDOR

file

uses the following configuration:

——————————————————-———————————— —-——

————

C-80 SAMPLE APPLICATIONS DataFlex 2.0 User's Manual

/F0RM

DATA ACCESS CORPORATION VENDOR MASTER FILE

VENDOR NUMBER: <

_

.> CCN'ANY: <

'

ADDRESS: CITY: ST:

_

ZIP: PHONE: ( )

-

TERMS (DAYS) :

_.

OUTSTANDINGCREDIT LIMIT:CREDIT: $$

._

._

Documento similar