Consultor Eletrônico



Kbase 12295: Defining RMS variable arrays in PROGRESS
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Defining RMS variable arrays in PROGRESS

This notebook entry describes how an RMS array is represented in
the PROGRESS database.

The following example shows the format of a RMS data file called
"employee.dat".

|name1|job1|phne1|name2|job2|phne2|name3|job3|phne3|name4|job4|phne4|
|-25--|-15-|-14--|-25--|-15-|-14--|-25--|-15-|-14--|-25--|-15-|-14--|

(NOTES: NAME is a STRING field with length 25.
JOB is a STRING field with length 15.
PHNE is a STRING field with length 14.)


In employee.dat there are four RMS records. Each record contains three
fields (name, job, and phone) which make up each RMS array.
You must specify the maximum number of record sets. For example,
100 employees.

To define the data in employee.dat, type the following:

Field name: Name RMS-type: string
Position: 1 Length: 25
Extent: 100 Spacing: 54

(NOTES: The first name field is at position 1 in the file.
Length is the length of the field.
Spacing is the distance from one name field to the next name
field: 25+15+14=54.
Extent is the maximum number of records: 100 employees.)


Field Name: Job RMS-type: string
Position: 26 Length: 15
Extent: 100 Spacing: 54

(NOTE: Position is the first position in the field plus the length
of the first field: 1+25=26.)


Field name: Phne RMS-type: string
Position: 41 Length: 14
Extent: 100 Spacing: 54


PROGRESS does not reference data in the format of employee.dat.
It references it in the following format:

|name1|name2|name3|name4|job1|job2|job3|job4|phne1|phne2|phne3|phne4|

(NOTE: The data types and lengths are the same as employee.dat)

Therefore, when you run the following code, PROGRESS lists all the
names, then all the jobs, and then the phones.

FOR EACH employee:
DISPLAY employee.

To display the data in the format of the employee.dat file (name1,
job1,phone1, name2,job2,phone2, etc.), use the following code:


DEF VAR x AS INTEGER.
X = 1.
FOR EACH EMPLOYEE:
DO x =1 TO 100:
DISPLAY name[x]
title[x]
phone[x].
END.
END.




Progress Software Technical Support Note # 12295