M204 Concepts

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 241
At a glance
Powered by AI
Model 204 is a comprehensive database management system developed by Computer Corporation of America for mainframe computers. It can handle large volumes of data and supports high concurrency.

Model 204 is a registered trademark of Computer Corporation of America. It is a database management system used on IBM mainframe computers to store and query large amounts of data.

Model 204 includes a versatile programming language called User Language for querying, updating, reporting and application development. It also supports features like set processing, data dictionary services and time-saving abbreviations.

Concepts of Model 204

compiled by Deepak Cherian

Model 204
Model 204 is a registered trademark of
Computer Corporation of America,
Massachusetts.

Computer Corporation of America


(CCA) is one of the top 30 privately
held software companies in the world.

Model 204

Users of Model 204 often have


exceptional demands:

terabytes of data,
millions of rows,
thousands of concurrent users,
open connectivity,
secure environments,
and almost instant response to complex
queries.

Model 204

Model 204 is a comprehensive,


multipurpose database management
system for IBM and compatible
mainframes.

Model 204 incorporates a versatile selfcontained User Language programming


language for ad hoc inquiry, simple and
complex data retrieval, updating, report
writing, transaction processing, and
application development.

Model 204

Model 204 represents the culmination of


many years of research and development
specifically targeted at solving the realworld needs of large-scale customers.

CCA invented bit-mapped indexing and


has continued to enhance the efficiency of
this technology. In recent years, other
database vendors have come to recognize
bit-map indexing as the fastest form of
indexing for many types of queries.

Features - User Language

Model 204 is not limited to bit-map


indexing. It automatically combines the
use of bit-mapping, hashing, B-tree, and
record list technologies to optimize speed
and efficiency of database access.

In-built Fourth Generation Language.


M204-UL uses simple English-like
statements.

Features - User Language

Applications automatically recognize


dynamic changes to the data-base
structure without the need to modify or
recompile programs.

High-level statements and functions


perform work that would require several
statements in other programming
languages. This reduces the
programming effort and makes
applications easier to maintain.

Features - User Language

Many statements create or manipulate


sets of rows.

Users can reference sets by meaningful


names.

Working with sets as a single entity,


rather than working with one row at a
time, greatly simplifies many operations.

Features - User Language

User Language accepts long names (up to 512


characters), uses meaningful keywords,
provides data dictionary services, and allows inline comments, it is self-documenting. Thus, it
eliminates considerable external documentation
and the effort required to create it.

make use of time-saving abbreviations, such as


FD instead of FIND ALL RECORDS FOR
WHICH.

Features - Procedures

Can compose, edit, and run User


Language requests interactively on an ad
hoc basis

Ability to reuse requests later in a


session

saving requests in procedure libraries for


subsequent on-line or batch invocation.

Summary of Course Topics

1.
2.
3.
4.
5.

Model 204 Database Structure


Model 204 User Language
Subroutines and Procedures
Full Screen Facility
Application Subsystem Facility

Section1

Model 204 Database Structure

Model 204 Database

Model 204 databases are structured to


provide a very high degree of flexibility,
data independence, and retrieval
efficiency.

Model 204 Database


At any time, without stopping your
systems, it allows you to dynamically:

Define new tables, columns, indices, and


relationships between tables.
Relax or tighten security.
Add/Change columns, attributes and usage
conditions.
Each index acts as a primary index
Relationships are maintained in User
Language Code

Model 204 Database


Inverted data access method
when the Database maintains (in
addition to the data records) a map of the
records that contain particular values for
certain fields called retrieval fields.

permits very rapid access to records that


satisfy selection conditions based on the
values of key fields.

Relevant Data
Structures

Binary Tree

Trees contain data in structures called


nodes,which are in turn linked to other
nodes in the tree.

Every tree has a primary node called a


root, from which all other branch nodes in
the tree descend.

the nodes that have no descendents are


called leaf nodes

Binary Tree

Each node is the parent of


subtrees. Every node in a tree has
0 or more children.

For a binary tree, each node can


have at most two descendents.
These descendents are described
as "left" and "right" children of the
parent node

Binary Tree

Binary Tree

A node is constructed of a left pointer


(LP), a right pointer (RP), and a data
field (DATA).

A balanced binary tree is one for whom


the longest path through the left subtree
is the same length as the longest path of
the right subtree, from root to leaf.

Binary Tree

Pre-Order Transversal

Binary Tree

In Order Transversal

Binary Tree

Post-Order Transversal

Hashing

The position of a key within the data


structure is computed directly from the value
of the key.

This computation is carried out by a hash


function h.

Given a key K, compute its address in the


data structure by calculating h(K)

M204 File Structure

Files

A collection of related records stored


together with their associated index
pointers forms a Model 204 file.

Consist of sets of variable-length,


variable-format records.

Defined by File Manager using the


create File Command.

Sample records in a file:


1st

Name = Smith,
John
SSN = 9963463689
Emp ID = 42134
DIVISION = Sales
SALARY = 22500

2nd

Name = Smith, Tom


SSN = 123456789
Emp ID = 42183
SALARY = 38500

3rd

Emp ID = 42166

Records
Collection of Fieldname = Value Pairs
Each record is automatically assigned a unique
internal record number that is used by the
system to build index entries for the record.
A Sample record:
Name = Smith, Tom
SSN = 123456789
Emp ID = 42134
DOB = 56071
DIVISION = Sales
SALARY = 36500

Records

The field (not the record) is the


fundamental unit of data

Records within a given file can all have


the same collection of field names, or
they can be different.

File maintenance activities such as


adding new fields to individual records
can be performed at any time.

Model 204 imposes no limit on the


number of fields per record.

Records
Model 204 optimizes the relational model by,
incorporating embedded tables.
Employee skill
is an example
of a repeating
field since
employees can
have multiple
skills and the
number of skills
varies for each

Fields

Smallest Element of Storage


Fieldname = Value Pair
Name = Smith, Tom
Address = 515 Main St.
Address = Apt #7
City = Dunedin
State = FL
Zip = 89422

Fields

Field names and field values are treated


by Model 204 as variable-length strings
of information.

Both field names and field values can


contain any number of words up to a
limit of 255 characters.

When more than one space is left


between words in a field name or value,
the extra spaces are ignored. Blanks
surrounding the equal sign are optional.

Fields

Each Model 204 field has a set of one or


more attributes called the field
description.

Field Names can have :

255 Characters Long

Embedded blanks

A-Z, 1-9, ., _ ,&

Cannot have reserved words or operators

Fields

Field Values can have:

255 Characters Long


Embedded blanks
Any Characters

a new field can be added to records even


though it was not originally defined.

A completely new type of record can be


added to a file at any time.

File Group

A collection of Model 204 files that


Model 204 treats as a single file.

useful in applications where certain


data is maintained in separate files
but it is necessary to process all of
the data together.

File Group
Claims 95
MPSCCASE

MPSHCCS
MPSECCS
MPSWCCS
MPSOCCS

Claims

MPSCASM

MPSHCASE

MPSHHCS
MPSEHCS
MPSWHCS
MPSOHCS

MPSICASM

MPSICASE

Claims 96

MPSHICS
MPSEICS
MPSWICS
MPSOICS

Internal File Structure

A Model 204 file consists of one or


more datasets.

Each dataset consists of fixed-length


physical records called pages.

All Model 204 files have the same


page size of 6184 bytes.

Internal File Structure

A file is divided into the following logical


sections:

File Control Table Parameters, Data set, File


Definition for all datasets in
the file, File
Status, etc.
Table A
Field Definitions and
Coded
Values in the file
Table B
Retrievable Data
Table C
Primary Hashed Index
(KEY)
Table D
Secondary and ordered
Index. Procedures also
stored here

Table A

It is subdivided into sections for

field names,
values of FEW-VALUED fields, and
values of MANY-VALUED fields.

Table A usually is small in relation to


the rest of the file.

Table B

Table B contains the retrievable data


of all of the records in the file.

Table B usually is the largest section


of the file and can be expanded
after being loaded using the
INCREASE command.

Table C

Contains an entry for every field name = value


pair that occurs in the file for fields defined as
KEY.
There also many entries for every field name =
value pair that occurs for fields that have the
NUMERIC RANGE attribute.
If a field name = value pair is unique in the file,
Table C contains the number of the Table B
record in which the field occurs. If the field name
= value pair is not unique in the file, Table C
contains a pointer to an entry in Table D.

Table D

Contains lists of Table B record numbers


for all of the KEY, NUMERIC RANGE, and
ORDERED field name = value pairs that
occur more than once in the file.

Table D also stores the Ordered Index Btree node pages, which contain the
values and record accessing information
for all ORDERED fields.

Types of Files

Entry Ordered

Most Frequently used


Records are retrieved in the order in which
they were entered.
When a record is deleted, the record number is
not reused.
The space occupied by the deleted record
becomes available for the expansion of
existing records.
New records are appended to the end of the
file.

Types of Files

Unordered
the space freed by deleted records can
be reused when new records are
added.

Types of Files

Sorted

Records are stored in order of the value of a


particular field called the sort key. The sort key is
designated by the file manager when the file is
initialized.

When a sort field is mandatory, all records must


have it. If it is optional, records without sort fields
are accepted.

Sorted files are useful when a large percentage of


reports are produced in the same sort sequence.

Types of Files

Hash Key

Hashing is a technique for key-to-storage


address translation that eliminates the need
for multiple levels of indexing.

This file order allows Model 204 to retrieve


quickly on a single unique key, without the
overhead of index searches.

The records themselves are stored in


random order.

Types of Files

Hash Key

The hash key can be specified as either


mandatory or optional.

A record can have only one value for the hash


key field. Several different records can have the
same value for their hash key fields. These
records will be stored near each other in Table B.

The value of a records hash key field can be


changed only by deleting the entire record and
store it again with a different hash key value.

Procedure Storage
Permanent Procedures (routines) are
stored in Model 204 Files in the Table
D section of the file.

Stored procedures can be included as


parts of requests, or they can be run
alone either unconditionally or as a
result of a specified test.

M204 File Field


Attributes

Field Attributes

Attributes determine how a field is


accessed and how it is stored
internally.

Within a record, there is no restriction


on the number of different fields that
can have the same attribute.

Field Attributes

They are of 2 types:

Representational Attributes
storage)

(data

Operational Attributes (data use)

Representational Attributes

VISIBLE, INVISIBLE

STRING (default)

FLOAT

BINARY

CODED, NON-CODED

FEW-VALUED, MANY-VALUED

OCCURS

LENGTH

PAD

UPDATE IN PLACE, UPDATE AT END

Operational Attributes

KEY, NON-KEY (equality retrieval)

ORDERED NUMERIC, NON-ORDERED (numeric range


retrieval)

ORDERED CHARACTER, NON-ORDERED (character range


retrieval)

FRV, NON-FRV (value processing)

UNIQUE, NON-UNIQUE (primary key enforcement)

NUMERIC RANGE, NON-RANGE

DEFERRABLE, NON-DEFERRABLE

AT-MOST-ONE, REPEATABLE

Level

KEY and NON-KEY

When storing fields that have the KEY


attribute, Model 204 makes special
entries in the hashed index.

During retrieval, Model 204 goes


directly to the appropriate index entry
to find which records satisfy the
selection criteria, without searching
through other records in the file.

KEY and NON-KEY

ADD, CHANGE, or DELETE Fields will


take slightly longer for KEY fields
than for NON-KEY fields.

The space occupied by the index


entries can be considerable,
especially in large files and in fields
that take on many values.

ORDERED and NONORDERED

stored with their values in the Ordered


Index
maintains field values in an ordered
sequence to facilitate range retrievals.
NAME:
FIND ALL RECORDS FOR WHICH
NAME IS ALPHA LESS THAN SMITH
END FIND
SAL:
FIND ALL RECORDS FOR WHICH
SALARY IS GREATER THAN 30000
END FIND

ORDERED and NONORDERED

ORDERED fields can be used in


value loop processing because the
Ordered Index maintains key values
in order and highly clustered.

can have an index with either


CHARACTER or NUMERIC ordering.

ORDERED and NONORDERED

ORDERED CHARACTER fields use the


standard EBCDIC collating sequence.

ORDERED NUMERIC fields contain


numeric values stored as standardized
floating-point numbers in one section
of the index and non-numeric values
in EBCDIC order in another section.
Leading zeros are ignored.

ORDERED and NONORDERED

Restrictions

A field cannot be both ORDERED and FRV.


A field cannot be both ORDERED
NUMERIC and NUMERIC RANGE.
A field can be both KEY and ORDERED.
A field can be both INVISIBLE and
ORDERED.
A field can be both DEFERRABLE and
ORDERED.
A UNIQUE field must be ORDERED.

FRV and NON-FRV

The For-Each-Value attribute is useful


when creating fields that will be used
in value loop processing.

The loop is initiated by the FOR EACH


VALUE statement

The field must have the FRV or


ORDERED attribute.

FRV and NON-FRV


EACH.STATE:
FOR EACH VALUE OF STATE
GET.RECS:
FIND ALL RECORDS FOR WHICH
STATE = VALUE IN EACH.STATE
END FIND
TOT.RECS:
COUNT RECORDS IN GET.RECS
PRINT.CT:
PRINT VALUE IN EACH.STATE WITH COUNT IN TOT.RECS AT COLUMN 20
END FOR

FRV and NON-FRV

The IN ORDER option of the FOR EACH


VALUE statement that specifies that
the values of an FRV KEY field be
presented in an ordered sequence

When the FOR EACH VALUE statement


with the IN ORDER option is used for
NON-FRV, ORDERED fields, ORDERED
retrievals can be significantly faster
than FRV ordered retrievals.

FRV and NON-FRV

Every value of an FRV field is


automatically encoded in Table A, in
addition to entries in Table C and D,
whether or not the value is stored
in Table B

used for fields in which the number


of different values does not exceed
approximately 200.

FRV and NON-FRV

The BINARY attribute overrides the FRV


attribute except for values that cannot
be compressed. The statement FOR
EACH VALUE OF AGE would retrieve only
the values not over-ridden

Once a value is added to an FRV field list


in Table A, the value remains on the list
even if all occurrences of the value are
removed. The value will be retrieved by
a FOR EACH VALUE statement.

DEFERRABLE and NONDEFERRABLE

NON-DEFERRABLE: storing and updating


of logical records in the Model 204 file is
usually done all at once in all relevant
tables.

DEFERRABLE: When there is a high


volume of updates, efficiency and space
reductions can be gained by deferring
the updates to Tables C and D.

DEFERRABLE and NONDEFERRABLE

The DEFERRABLE attribute is


invalid for a field that is NON-KEY,
NON-ORDERED, and NON-RANGE.

NUMERIC-RANGE and NONRANGE

The NUMERIC RANGE attribute


allows you to perform

equal to,
less than,
greater than,
or between

retrievals quickly.

NUMERIC-RANGE and NONRANGE

fieldname IS value
fieldname IS EQ (=) value
fieldname IS LESS THAN (LT or <) value
fieldname IS GREATER THAN (GT or >) value
fieldname IS BETWEEN (GT or >) value AND (LT
or <) value
fieldname IS GREATER THAN (GT or >) value
AND LESS THAN (LT or <) value
fieldname IS LESS THAN (LT or <) value AND
GREATER THAN (GT or >) value

NUMERIC-RANGE and NONRANGE

If a NUMERIC RANGE field is stored with a


value that cannot be interpret as number,
the system stores a special index entry the retrieval field name with ++ appended.

The entry has a value of NON NUMERICAL.


ALL:
FIND ALL RECORDS FOR WHICH
AGE++ = NON NUMERICAL
END FIND

NUMERIC-RANGE and NONRANGE

The cost of an update of an ORDERED field


is lower than that of a NUMERIC RANGE field.

In most cases, especially with large


numbers, the Ordered Index uses less space
to maintain the index information.

NUMERIC RANGE retrievals are faster for


very large ranges with densely distributed
data values.

Section 2

Model 204 User Language

Request Structure

User Language statements are


grouped together into requests.

Requests can

retrieve specific sets of records,


operate on each record retrieved oneby-one or as a set, and
display or manipulate data from the
retrieved records.

Request Structure

A typical User Language request


begins with statements that select
records from one or more files.

Loop statements specify a series of


operations to be performed on each
of the selected records.

Request Structure

BEGIN starts a request.

The User Language statements that make


up the request follow on separate lines.

When a statement is too long to fit on one


line, a - is used to continue the statement
on the next line.

Request Structure

Statement labels provide a method for

naming User Language statements.

The request is ended by an END


statement.

BEGIN
GET.RECS: FIND ALL RECORDS FOR WHICH
CITY = SAN DIEGO
TOTAL PREMIUM IS GREATER THAN 200
AGENT = KESSLER OR WAGNER
END FIND
FOR EACH RECORD IN GET.RECS
PRINT FULLNAME WITH AGENT AT COLUMN 30
END FOR
END

Implied AND
RECS: FIND ALL RECORDS FOR WHICH
MAKE = FORD AND COLOR = BLUE OR COLOR = RED
END FIND

RECS: FIND ALL RECORDS FOR WHICH


MAKE = FORD
COLOR = BLUE OR COLOR = RED
END FIND

Labels

begin with a letter (az, AZ)


can be followed by letters, digits (09),
periods (.), or underscores (_). The label
can be a maximum of 254 characters.
The label must end with a colon and be
followed by a space.
Within a request, statement labels must
be unique.
A label reference must be coded
exactly as the label, including upperand lower-case lettering.

Statement Blocks

A series of nested statements or


multiline conditions is called a block.
FIND.FORDS: FIND ALL RECORDS FOR WHICH
MAKE = FORD
COLOR = BLUE
END FIND

Statement Blocks
END BLOCK closes all open blocks and
returns the nesting level to the level
of the label that is being ended.
END BLOCK is particularly useful when
several types of block statements
are nested within each other.

FIND.FORDS: FIND ALL RECORDS FOR WHICH


MAKE = FORD
END FIND
PRINT.INFO: FOR EACH RECORD IN FIND.FORDS
IF YEAR = 80 THEN
PRINT MODEL AND COLOR
END BLOCK PRINT.INFO

Line Continuation

hyphen as the last character on the


line to indicate that the statement
continues on the next line

no other characters should follow it.

should not use blank lines or comment


lines between continued lines.

Variables

Variables

%Variables
Global Variables
Fieldname Variables
Arrays
Image Item Variables
Screen Item Variables

What is a %Variable

A named location in memory where a value


can be stored, retrieved, modified and
printed.

Variables names: 255 Chars


A-Z, 1-9,& . _
No embedded blanks
Begins with %

Value:

255 Chars.

Variable Declaration

Variables can be declared either:

Implicitly by their use


Explicitly by a variable declaration
statement

Variables do not have to be declared.


Still, Variable declarations are a good
programming practice.

Variable Declaration
(contd.)
Implicit Declaration
BEGIN

FD: IN CLIENTS FD CITY = SAN FRANCISCO


END FIND
FR FD
%LOCATION = CITY
PRINT NAME AND %LOCATION
END FOR
END

Variable Parameters
VTYPE
VLEN
VDP

=
=
=

STRING
20
0

%NAME = BOSTON, ETHAN


%NAME = HEARST, WILLIAM RANDOLPH
PRINT %NAME
output:
HEARST, WILLIAM RAND
RESET VLEN=30

Variables Are Statement


The VARIABLES ARE statement
overrides, for the remainder of
the current request, the default
values of the
VTYPE,
VLEN, and/or
VDP parameters.

Variables are Undefined


Statement
Explicit Declaration
BEGIN
VARIABLES ARE UNDEFINED
*
%LOCATION IS STRING LEN 30
FD: IN CLIENTS FD CITY = SAN FRANCISCO
END FIND
FR FD
%LOCATION = CITY
PRINT NAME AND %LOCATION
END FOR
END

Note: Error - M204.0595: UNDECLARED VARIABLES

ARE NOT PERMITTED WITH THE UNDEFINED OPTION

Variable Declarations

A %variable can be declared as one of


three distinct types:

%NAME IS STRING LEN 30


%SALARY IS FIXED DP 2
%AVERAGE IS FLOAT

Arithmetic is performed efficiently if all


%variables used in arithmetic
operations are defined as all FLOAT or
all FIXED

FIXED variables

%Variables declared as FIXED can


have a decimal place specification
associated with them.

A FIXED %variable can contain as


many as 15 significant digits

can be as many as nine decimal


places.

FLOAT variables

Variables are stored as doubleprecision floating-point numbers.

Precision is guaranteed to 15
decimal digits. The exponent must
be between 75 and -74.
%X IS FLOAT
%X = 0.999999999999997E-73

STRING variables

%Variables declared as STRING can


have a maximum length as well as
an optional decimal place
specification associated with them.
BEGIN
%AMOUNT IS STRING LEN 10 DP *
%AMOUNT = 1.2
PRINT %AMOUNT
%AMOUNT = 1.23
PRINT %AMOUNT
%AMOUNT = 1.234
PRINT %AMOUNT
END

Yields:
1.2
1.23
1.234

STRING variables

The maximum length of a STRING


variable is 255 characters.

use the $LEN function to find the


current length of a STRING variable

If the VARIABLES ARE UNDEFINED, the


length and DP must be specified with
each STRING %variable declaration.

Conversions In Calculations
BEGIN
%X IS STRING
%Y IS FIXED
%Z IS STRING
%X = 7
%Y = 9
%Z = %X * %Y
PRINT %Z
END

Conversions In Calculations

Global Variables
Located in Global variable table of user's server
Value set with $SETG function
Value retrieved with $GETG function
Value can be used with Dummy Strings (?& prefixed)
Evaluated at compile time
Global Images and Screens can be used
Is accessible only by setting user and lasts until end
of terminal session

$SETG and $GETG


Functions
Proc A
Proc B
$SETG('MFILE', SUPPLIES') OPEN

?&MFILE

BEGIN
BEGIN
%A = 'TOYOTA' %MAKE = $GETG('MAKE')
%X = $SETG('MAKE',%A)
FD: IN VEHICLES FD
END MAKE = %MAKE
END
CLOSE ?&MFILE

File Field Variables


%%Variables

(Evaluated at run time)

BEGIN
%FIELDNAME = CITY
FD1: IN CLIENTS FDLDNAME
END FIND

= DUNEDIN

ST: SORT RECORDS IN FD1 BY %%FIELDNAME


FR ST
PRINT %FIELDNAME AND %%FIELDNAME
END FOR
END

Arrays
BEGIN
%SALES.TOTALS IS STRING LEN 10 ARRAY(12)
%X IS FIXED
FD: IN SALES FD
RECTYPE = MONTHLY
END FIND
FR FD
%X = %X + 1
%SALES(%X) = MONTHLY SALES TOTAL
END FOR
END

Commands and
Statements

Commands vs. Statements

Commands:
level

Executed at command
Executed immediately
Not compiled

Statements:
User Language
instructions
Executed when
request is executed
Compiled

Basic Commands

Login :

Logs a User into the M204 region


LOGINCTSUSER1
***M204.0347:PASSWORD
>

Open :

opens a Model 204 file or group.


OSUPPLIES

Basic Commands

Logout :

Close :

Logs a User out of the M204 region


LOGOUT
closes a Model 204 file or group.
CLOSESUPPLIES

Close All:

closes all opened Model 204 files or


groups.

Field Value Presence


Condition

IS PRESENT

IS NOT PRESENT

Involves Non-Indexed Sequential


(Table B) search

Boolean Logic
AND
OR
NOT
NOR

Boolean Logic
Order of precedence Operator

NOT
NOR
AND (explicitly stated)
OR
AND (implied by a new line)

Boolean Logic (contd.)


FD: IN VEHICLES FD
MODEL = MUSTANG AND COLOR = RED
END FIND
FD: IN VEHICLES FD
MODEL = MUSTANG
COLOR = RED
END FIND

Boolean Logic (contd.)


FD: IN VEHICLES FD
MODEL = MUSTANG OR PINTO
END FIND
FD: IN VEHICLES FD
MAKE = FORD OR MODEL = NOVA
END FIND

Boolean Logic (contd.)


FD: IN VEHICLES FD
MAKE = NOT FORD
END FIND
FD: IN VEHICLES FD
MAKE = NOT FORD NOR CHEVY
END FIND

Retrieval Attributes

Equality Retrievals

If the field has been defined with

KEY and FLOAT field attribute or


ORDERED NUMERIC attribute

and the value is a number or in


exponent notation, then a numerical
comparison is performed.

Comparison of .1234E-3 = .0001234


is true

Equality Retrievals

If the field has been defined with

KEY and FLOAT field attribute or


ORDERED NUMERIC attribute

and the value is character string, then a


character string comparison is
performed.

Comparison of 001234 = 001234 is


true

Equality Retrievals

For other cases

the value is treated as string and a


character string comparison is
performed.

Comparison of .1234E-3 = .0001234


is false

Numeric Range Retrievals

When a field contains mostly


numerical values, the magnitude of the
numbers can be tested by using :

Less than
<
LT
Greater than >
GT
Less than or equal to
<= LE
Greater than or equal to >= GE
Pattern Matching IS LIKE 'PATTERN'

Numeric Range Retrievals


Default type of comparison performed
IN RANGE
Numeric
EQ, =, or none
Numeric
NE or =
Numeric
LESS THAN, LT, or <
Numeric
LE or <=
Numeric
GREATER THAN, GT, or >
Numeric
GE or >=
Numeric
BETWEEN
Numeric
AFTER
Character string
BEFORE
Character string

Numeric Range Retrievals


BEGIN
GET.DRIVER: FD
DATE IS NUMERICALLY > 99001
END FIND
END

If a character string operator is used


with a numeric value, all numeric fields
will be converted to character and
character comparison performed.
FIND ALL RECORDS FOR WHICH
YEAR IS BEFORE 1996

will not retrieve 987 and 2.

Numeric Range Retrievals

If a numeric operator is used with a


nonnumeric value no records will be
retrieved.
FIND ALL RECORDS FOR WHICH
LAST NAME IS GREATER THAN ANDREWS

here every record in the file or group


will be retrieved.
FIND ALL RECORDS FOR WHICH
LAST NAME IS NOT GREATER THAN ANDREWS

Pattern Matching
Special Characters used to represent
values in search criteria

Wildcard

Place holders

Numeric
Character
Generic
Or

#
@
+
,

Pattern Matching (contd.)


LASTNAME IS LIKE SMITH*

Will retrieve records with values

SMITHSON
SMITHTON
SMITHSONIAN
SMITH

Pattern Matching (contd.)


DATE OF BIRTH IS LIKE 3911##

Will retrieve all persons born in November of


1939
like

DATE
DATE
DATE
DATE

OF
OF
OF
OF

BIRTH
BIRTH
BIRTH
BIRTH

=
=
=
=

391103
391107
3911234
391145

Pattern Matching (contd.)


LASTNAME IS LIKE SMITH(SON,TON)
Retrieves

SMITHSON
SMITHTON

but not

SMITHLON

Logic Control and Flow

FIND Statement

Using the IN Clause

FD: IN VEHICLES FIND ALL RECORDS FOR WHICH


MAKE = FORD
MODEL = MUSTANG
END FIND

Establishes a found set of records

FIND Statement

Uses Hashed Index located in Table C


of file for Equality Retrievals

Uses the Ordered (Table D) and


Numeric
Range (Table C) indexes for Range
Retrievals

Counting Records
FD: IN VEHICLES FD
MAKE = FORD
MODEL = MUSTANG
END FIND
CT: COUNT RECORDS IN FD
PRINT COUNT IN CT
IN VEHICLES FPC
END FIND

Find and Print Count


statement

The Count found by FPC statement cannot be


positioned in any column other than 1

More and End More


statement
BEGIN
GET.DRIVER: FIND AND PRINT COUNT
RECTYPE = DRIVER
STATE = FLORIDA
SEX = F
END FIND
END MORE
MORE
FOR EACH RECORD IN GET.DRIVER
PRINT FULLNAME AND DATE OF BIRTH
END FOR
END

More and End More


statement

Using the MORE command, you can


continue a request, adding further
statements as well as referring to the
results of statements in the original request.

Index Loops
Used for looping when a looping
variable is needed

Great for processing arrays

Also can be used for processing


multiply occurring fields

Index Loops (contd.)


BEGIN
%X IS FIXED
%NAMES IS STRING LEN 20 ARRAY(5)
%NAMES(1) = 'JOHN'
%NAMES(2) = 'SARAH'
.
%NAMES(5) = 'SUKUMAR'
FOR %X FROM 1 TO 5
PRINT %NAMES(%X)
END FOR
END

IF statement

The IF statement tests a condition


and then executes one or more
statements if the condition is true.

IF Statement
IF %A = 1 THEN
PRINT 'A IS ONE'
END IF

IF Statement (contd.)
IF %A EQ 1 THEN
PRINT 'A IS ONE'
ELSE
PRINT 'A IS NOT ONE'
END IF

IF Statement (contd.)
IF %A EQ 1 THEN
IF %B EQ 1 THEN
PRINT 'A IS ONE AND B IS ONE'
ELSE
PRINT 'A IS ONE AND B IS NOT ONE'
END IF
ELSE
PRINT 'A IS NOT ONE'
END IF

IF Statement (contd.)
IF %A = 1 THEN
PRINT 'A IS ONE'
ELSEIF %A = 3 THEN
PRINT 'A IS THREE'
ELSE
PRINT 'A IS INVALID'
END IF

JUMP TO Statement
B
...
...
JUMP TO END.PGM
...
END.PGM: END

END

LOOP END Statement


B
FD: IN VEHICLES FD MAKE = TAURUS
END FIND
ST: SORT RECORDS IN FD BY PRICE VALUE DESCENDING
FOR EACH RECORD IN ST
IF PRICE LT 15000 THEN
LOOP END
END IF
PRINT MAKE AND MODEL AND PRICE
END FOR
END

NOTE Statement
B
VLOOP : FD
END FIND
FRLOOP : FOR EACH RECORD IN VLOOP
MODEL: NOTE CAR.MODEL
MODEL.MATCH: FD IN MFILE204
CAR.MAKE = VALUE IN MODEL
END FIND
END FOR
END

Print Statement
WITH - pointer moved to next position
AND- pointer moved 2 positions to leave a
blank
Positioning:
AT Left Justifies
TO Right Justifies
PRINT NAME AT 15
PRINT SALARY TO 45

REPEAT Statement
REPEAT WHILE
REPEAT X TIMES
REPEAT FOREVER

REPEAT WHILE
REPEAT WHILE %X < 40
.
%X = %Y * %Z
.
END REPEAT

REPEAT X TIMES
%X = 1
REPEAT 31 TIMES
%X = %X * 2
END REPEAT
PRINT %X

REPEAT FOREVER
REPEAT FOREVER
.
READ SCREEN CUSTOMERS
IF %SCREEN:PFKEY = +3 THEN
LOOP END
END IF
.
END REPEAT

Record Loops

FOR EACH RECORD


statement

Refers to each record within a set of


records located by a FIND statement.
FIND.RECS:FINDALLRECORDSFORWHICH
MAKE=FORD
ENDFIND
PRINT.MODEL:FOREACHRECORDINFIND.RECS
PRINTYEARANDCOLORATCOLUMN15
ENDFOR

Retrievals against found


sets
FD1: IN VEHICLES FD
MAKE = FORD
END FIND
FD2: FD IN FD1
MODEL = MUSTANG
END FIND

Accessing Record Data

FOR EACH RECORD statement

Processes Found Set of records


Loop executes once for each record in found set
Begins with a FOR statement
Ends with an END FOR statement
Only way to access actual data in Table B record

Accessing Record Data


BEGIN
FD: IN VEHICLES FD
MAKE = FORD
END FIND
FOR EACH RECORD IN FD
PRINT MAKE AND MODEL
END FOR
END

Limiting Records to Process


BEGIN
FD: IN VEHICLES FD
MAKE = FORD
END FIND
FOR 5 RECORDS IN FD
PRINT MAKE AND MODEL
END FOR
END

Value Loops

FOR EACH VALUE


Statement
FRV: FOR EACH VALUE OF WEATHER
FD: IN CLAIMS FD WEATHER = VALUE IN FRV
END FIND
FR FD
PRINT VALUE IN FRV AND CLAIM TYPE
END FOR
END FOR

Note: For an ordered field the values will be processed


in
order. The values for an FRV field are not in sorted
order.

FOR EACH VALUE


Statement
FRV: FOR EACH VALUE OF WEATHER IN DESCENDING
ORDER
FD: IN CLAIMS FD WEATHER = VALUE IN FRV
END FIND
FR FD
PRINT VALUE IN FRV AND CLAIM TYPE
END FOR
END FOR

Note: For an FRV field this causes Model 204 to


internally
sort the values before processing.

FOR EACH VALUE


Statement
FRV: FOR EACH VALUE OF SALARY FROM 0 TO 100
FD: IN CLAIMS FD
SALARY = VALUE IN FRV
END FIND
FR FD
PRINT VALUE IN FRV AND NAME
END FOR
END FOR

intended to be used with character strings.

FOR EACH VALUE


Statement

The range is treated as a character string


comparison and would only use the values
1, 10, and 100.

Declare the SALARY field to be ORDERED


NUMERIC to get desired result.

FOR EACH VALUE


Statement
PREFIX: FOR EACH VALUE OF AGENT LIKE CAS*
PRINT VALUE IN PREFIX
END FOR

V2: FOR 10 VALUES OF AGENT IN ORDER FROM 100


PRINT VALUE IN V2
END FOR

FIND ALL VALUES


Statement
Eliminates re-execution of Find
portion of For Each value statement
when statement is within another loop

Does not have a END FIND block


statement as Find all values cannot
take multiple conditions

FIND ALL VALUES


Statement

BEGIN
EACH.COUNTY: FIND ALL VALUES OF COUNTY
EACH.CITY: FIND ALL VALUES OF CITY
EACH.STATE: FOR EACH VALUE OF STATE
FOR EACH VALUE IN EACH.COUNTY
FOR EACH VALUE IN EACH.CITY
PRINT COLOR AND MAKE AND MODEL
END FOR
END FOR
END

SORT VALUES IN Statement


BEGIN
FD.VAL: IN VEHICLES FIND ALL VALUES OF COLOR
END FIND
ST.VAL: SORT VALUES IN FD.VAL
FRV: FOR EACH VALUE IN ST.VAL
PRINT COLOR AND MAKE AND MODEL
END FOR
END

Ordering Output

Ordering Output
Four Methods in Decreasing Efficiency

Sorted File
ORDERED with In Order Clause
FOR EACH VALUE in Order Clause
SORT Statement

Ordering Output (contd.)


Sorted Files

SORTKEY = LASTNAME

BEGIN
FD: IN CLIENTS FD
CITY = PALM HARBOR
END FIND
FOR EACH RECORD IN ORDER
PRINT NAME AND ADDRESS
END FOR
END
Note: Ordering field must be file SORTKEY

Ordering Output (contd.)


In Order Clause in For Each Record Statement
Field must be Ordered index
BEGIN
FD: IN CLIENTS FD
CITY = PALM HARBOR
END FIND
FOR EACH RECORD IN ORDER BY ZIP CODE
PRINT NAME AND ADDRESS
END FOR
END

For Each Value Statement


For Each Value in Order statement
BEGIN
FRV: FOR EACH VALUE OF CITY IN ORDER
FD: IN CLIENTS FD
CITY = VALUE IN FRV
END FIND
FR FD
PRINT NAME AND CITY
END FOR
END FOR
END
Field must be FRV or Ordered

Sort Statement
Sort Statement
BEGIN
FD: IN VEHICLES FD MAKE = FORD
END FIND
ST: SORT RECORDS IN FD BY MODEL
FOR EACH RECORD IN ST
PRINT MAKE AND MODEL
END FOR
END
Note: Field must be visible

Sort Statement (contd.)


Sort Statement
BEGIN
FD: IN VEHICLES FD MAKE = FORD
END FIND
ST: SORT RECORDS IN FD BY MODEL AND
COLOR
FOR EACH RECORD IN ST
PRINT MAKE AND MODEL AND COLOR
END FOR
END

Sort Statement (contd.)


BEGIN
FD: IN CLIENTS FD DIVISION = SALES
END FIND
ST: SORT RECORDS IN FD BY SALARY VALUE
- NUMERICAL DESCENDING
FOR 5 RECORDS IN ST
PRINT NAME AND SALARY
END FOR
END

Lists

Model 204 Record Lists


Declaration Statement
DECLARE LIST FORDS IN FILE VEHICLES
DECLARE LIST CALIFORNIA IN FILE CLIENTS
Note: Only records from a single file can
be
placed on a list (except in File Group
context)

Model 204 Record Lists


Form a dynamic record number list
Records may be: Added to the list
Removed from the list
Combined with other lists
Note: A record number is never repeated
on a
list. Great for eliminating duplicate
processing.

PLACE Statement
PLACE RECORDS IN FD.FORDS ON LIST FORDS
PLACE RECORDS IN FD.CAL ON LIST CALIFORNIA
PLACE RECORDS ON LIST FORDS ON LIST CARS
PLACE RECORD ON LIST CARS

PLACE and REMOVE


Statement
BEGIN

DECLARE LIST FORDS IN FILE VEHICLES


FD.FORDS: IN VEHICLES FD
MAKE = FORD
END FIND
PLACE RECORDS IN FD.FORDS ON LIST FORDS
FOR EACH RECORD ON LIST FORDS
IF COLOR = RED THEN
REMOVE RECORD FROM LIST FORDS
END IF
END FOR
END
Note: The list called FORDS will be left with all MAKE =
FORD records except the records containing COLOR =
RED.

PLACE Statement (contd.)


BEGIN
DECLARE LIST RED.FORDS IN FILE VEHICLES
FD.FORDS: IN VEHICLES FD
MAKE = FORD
END FIND
FR FD.FORDS
IF COLOR = RED THEN
PLACE RECORD ON LIST RED.FORDS
END IF
END FOR
END

File Data Manipulation

File Maintenance
Update Types
1. Add a new record
2. Delete an existing record
3. Add a new fieldname = Value to a record
4. Delete an existing Fieldname = Value
5. Change the value of an existing Fieldname
= Value
Note: File must be opened with update privileges
for updates to be allowed.

Adding a New Record


BEGIN
IN VEHICLES STORE RECORD
MAKE = FORD
MODEL = MUSTANG
COLOR = RED
VIN = 132435465768
YEAR = 64
BODY = 2DR
END STORE
END
Note: Values may also be expressed as variables

Deleting an Existing Record


BEGIN
FD.PLYMOUTH: IN VEHICLES FD
MAKE = PLYMOUTH
END FIND
FR FD.PLYMOUTH
DELETE RECORD
END FOR
END

Changing the Value of a


Field
BEGIN
FD.RED: IN VEHICLES FD
COLOR = RED
END FIND
FR FD.RED
CHANGE COLOR TO 'GREEN'
END FOR
END

Adding a Field to a Record


BEGIN
FD.CLAIMS: IN CLAIMS96 FD
PAYMENT AMOUNT IS PRESENT
END FIND
FOR EACH RECORD IN
FD.CLAIMS
ADD PAID IND = 'Y'
END FOR
END FOR

Multiply Occurring Fields

Multiply Occurring Fields


A record in a Model 204 file may have
multiple Fieldname = Value pairs for the
same Fieldname.
NAME = GLEN
SPOUSE = CATHY
CHILD = CHRIS
CHILD = JOHN
CHILD = WILLIAM
Note: Number of occurrences may be
limited by Pre-allocation or At-Most-One
attributes.

FOR EACH OCCURRENCE


Statement
BEGIN
FD: IN CLIENTS FD STATE = FLORIDA
END FIND
FOR EACH RECORD IN FD
PRINT NAME AND SPOUSE
FEO: FOR EACH OCCURRENCE OF CHILD
PRINT OCCURRENCE IN FEO AND VALUE IN FEO
END FOR
END FOR
END

Output
1 GLEN

2 CATHY
3 CHRIS
Note: Occurrences are processed in the order
4 JOHN
in which they occur in the record.
5 BILL

Counting Occurrences
BEGIN
FD: IN CLIENTS FD
END FIND
FR FD
CT: COUNT OCCURENCES OF CHILD
PRINT CHILD (COUNT IN CT)
END FOR
END

Note: This routine will print out the last occurrence of


child in each record.

Updating Multiply Occurring


Fields
ADD Statement
Adds a new occurrence at end of record
DELETE Statement/DELETE EACH Statement
Deletes occurrence and moves others up
INSERT Statement
Inserts a new occurrence and move
others down

Files and Images

External Files and Images


Sequential (MVS) Files
Can be read and updated
VSAM Files
Can be read only
An image is a block of memory than is
defined
with a template that subdivides the memory
into separate and distinct items.

Image Declaration
IMAGE CLIENT
NAME
SPOUSE
CHILD1
CHILD2
CHILD3
SSN
DIVISION
END IMAGE

IS
IS
IS
IS
IS
IS

IS STRING LEN 20
STRING LEN 20
STRING LEN 20
STRING LEN 20
STRING LEN 20
STRING LEN 9
STRING LEN 7

Redefine Image
IMAGE POLICYHOLDER
P_RECTYPE
IS STRING LEN 1
P_ NAME IS STRING LEN 20
P_ POLICY.NO
IS STRING LEN 5
CITY
IS STRING LEN 30
IMAGE DRIVER
D_ RECTYPE
IS STRING LEN 1
D_ NAME IS STRING LEN 20
D_ POLICY.NO IS STRING LEN 5
DRIVER.ID
IS STRING LEN 10
VIN IS STRING LEN 20
END IMAGE

Redefine Image
IMAGE POLICYHOLDER
P_RECTYPE
IS
P_ NAME
IS
P_ POLICY.NO
IS
CITY
IS
IMAGE DRIVER AT P_
D_ POLICY.NO
DRIVER.ID
VIN
END IMAGE

STRING
STRING
STRING
STRING

LEN
LEN
LEN
LEN

1
20
10
30

POLICY.NO
IS STRING LEN 5
IS STRING LEN 10
IS STRING LEN 25

Item Types for Images

String
Binary
Packed
Zoned Decimal
Float
Exponential Format
Note: Conversions are done
automatically
when values are read into the image.

OPEN and CLOSE


Statements
//CLIENTS DD DSN =
M204.CLIENTS,DISP=SHR
BEGIN

OPEN EXTERNAL CLIENTS FOR INPUT

.
.

CLOSE EXTERNAL CLIENTS


END

READ and WRITE


Statements
BEGIN
IMAGE CLAIMS95
.
IMAGE CLAIMS96
.
END IMAGE
OPEN EXTERNAL CLAIMS95 FOR INPUT
OPEN EXTERNAL CLAIMS96 FOR OUTPUT
REPEAT FOREVER
READ IMAGE CLAIMS FROM CLAIMS95
IF $STATUS NE +0 THEN
LOOP END
END IF
WRITE IMAGE CLAIMS ON CLAIMS96
END REPEAT
END

Terminal Operations

Editor Commands

End ends edit session as saves


Save saves editor contents
Go saves editor contents and
executes the proc
Quit exits editor session without
saving
Note: Editor Commands are typed
only on the command line.

Line Commands

I
D
C
P
F
R
U

insert a new line


delete the line
copy a line (or block of lines)
preceding (copy placement)
following (copy placement)
set range
undelete (previously deleted lines)

Note: Line commands are typed in the


prefix
area.

Model 204 Parameters

User Resetable
LGTBL (Utable)
HDRCTL (Reset)
Non-Resetable
NORQS
CURFILE
VERSION

Section 4

Subroutines and Procedures

Summary

Procedure vs. Request

Temporary Procedures

Permanent Procedures

Procedure vs. Request


Procedure
OPEN VEHICLES
PSWD
Request
BEGIN
FD: IN VEHICLES FD
COLOR = RED
END FIND
FOR EACH RECORD IN FD
PRINT MAKE AND MODEL
END FOR
END
CLOSE VEHICLES
A Sample Routine

Temporary Procedures

Accessing and Editing


Deleting
Saving
Scope and Duration

Permanent Procedures

Location (Table D of Model 204 file)


Space Utilization (at least one page)
Accessing and Editing
Deleting
Saving
Sharing (Enqueing)
Include Command and Statements
Scope and Duration

CALL Statement
BEGIN
CALL CALCULATE

.
.
.

CALCULATE: SUBROUTINE

.
.

END SUBROUTINE
END

RETURN Statement
BEGIN

CALCULATE: SUBROUTINE

.
.

IF AVERAGE LT 5.7 THEN


RETURN
END IF

END SUBROUTINE
END

Simple Subroutines
CALC: SUBROUTINE
%AVERAGE.SALES = %MONTH.SALES / %DAYS
PRINT 'AVERAGE SALES -' AND %AVERAGE
END SUBROUTINE
The variables that are used in the subroutine are
shared with the main body of the program. Simple
subroutines are easier to code but care must be
taken to avoid modifying the value of variables that
may be used elsewhere in the request. Simple
subroutines are not easily transported.

Complex Subroutines
BEGIN
%MSALES
IS FIXED DP 2
%NUM.DAYS IS FIXED

...

For sharing subroutines


between different procedures

CALL CALC(%MSALES, %NUM.DAYS)

PRINT 'MONTHLY SALES -' AND %MSALES


PRINT 'NUMBER OF DAYS -' AND %NUM.DAYS

SUBROUTINE CALC (%MONTH.SALES IS FIXED DP 2, %DAYS IS FIXED)


%M.SALES IS FIXED DP 2, %AVERAGE.SALES IS FIXED DP 2
% MONTH.SALES = %MONTH.SALES + (%MONTH.SALES * .10)
%AVERAGE.SALES = %MONTH.SALES / %DAYS
PRINT 'AVERAGE SALES W/10% INCREASE-' AND %AVERAGE
END SUBROUTINE
END

ON Units

Special Coding structures

Model 204 passes control to an ON unit


when condition associated with that ON
unit arises.

Multiple ON units are allowed in the same


request.

Easily transportable between routines

On find conflict or record locking


conflict
BEGIN
ON FIND CONFLICT
PRINT 'YOU HAVE ENCOUNTERED A CONFLICT'
PRINT 'USER -' AND $RLCUSR
PRINT 'FILE -' AND $RLCFILE
%ANSWER = $READ ('TRY AGAIN?')
IF %ANSWER = 'YES' THEN
RETRY
ELSE
PRINT 'FIND RETRY CANCELED'
END IF
END ON
FD: IN VEHICLES FDR
MAKE = FORD
END FIND
END

ON ATTENTION Unit
In a Full Screen Environment this specifies
the action to take if the user presses the
<BREAK>, <ATTN>, <PAL1>, or enters
*CANCEL
ON ATTENTION
PRINT 'You have pressed the Attn Key'
STOP
END ON

User Language $Functions

User Language $Functions


Written in Assembler Code and linked into
Model 204

Already part of Model 204 User Language

User written $Functions can be created and


linked too.

Performs many functions that are difficult or


impossible to code in User Language.

User Input $Functions

$READ
Note: Makes code generic
BEGIN
%NAME = $READ('PLEASE ENTER YOUR NAME')
PRINT 'SEARCHING FOR' AND %NAME
FD: IN CLIENTS FD
NAME = %NAME
END FIND
FR FD
PRINT NAME AND CITY
END FOR
END

Date $Functions

$Date

PRINT $DATE

$Datechk

IF $DATECHK('DD MON, YYYY', 12 SEP, 1996)


THEN
PRINT 'DATE IS VALID'
END IF

------> 96-09-12

$Datecnv

%P.DATE = $DATECNV('YY-MM-DD', 'DD MON, YYYY',


$DATE)
PRINT %P.DATE ------>
12 SEP, 1996

$DATE Functions (Contd)

$DATECHG(YYMMDD,910901,5) will return


910906

$DATECHK(YYMMDD,911301) will return 0 False


$DTAEDIF(format1,date1,format2,date2) returns
the difference between 2 dates

String Manipulation
$Functions

$Index
%A = $INDEX('WASHINGTON GEORGE', )
PRINT %A -----> 11

$SUBSTR

%FIRST = $SUBSTR('WASHINGTON, GEORGE',


%A+2)

$LEN

%LENGTH = $LEN(%FIRST)
PRINT %LENGTH -----> 6

Section 6

Model 204 Full Screen Facility

Summary

Full Screen Usage

Action Keys

Screen Declaration

Screen
Manipulation

Screen Usage
Personnel Entry
Name: _________________ SSN: _____________
Address: _____________________________________
City: __________ State:___

Zip: _______ - _____

Division: _____________

PF1/Help PF3/Quit

PF12/Exit

Note: Usable portion of screen is 22 rows by 78 columns

Action Keys
User Language screens are IBM 3270 full
screen reads.

Screens are processed in whole when an


action key is pressed.

Action Keys are: <Enter>

<PFKeys>

<Attn>

<PA1>

Screen Declarations
BEGIN
SCREEN CLIENTS
TITLE 'Personnel Entry'
SKIP 1 LINE
PROMPT 'Name:' AT 5 BRIGHT INPUT NAME LEN 20 PAD WITH _ REQUIRED PROMPT 'SSN:' AT 45 INPUT SSN LEN 9 REQUIRED
SKIP 1 LINE
PROMPT 'Address:' AT 5 INPUT ADDRESS LEN 60 PAD WITH _
SKIP 1 LINE
PROMPT 'City:' AT 5 .
PROMPT PF1 AT 5 LEN 9 DEFAULT 'PF1/HELP'
END SCREEN
END

Screen Item Attributes

Colors For color terminals and PC's


Invisible Typed characters will not be seen
Protected
Cursor will not position in Input
area
Required
A value must be provided
Must Fill The Input area must be full
One Of Verify against list of values
Verify
Verify against a list of characters
Numeric Verify Numeric value

Default Statements
DEFAULT INPUT PAD '_'
DEFAULT PROMPT GREEN
BEGIN
SCREEN CLIENTS
DEFAULT INPUT PAD '_'
.
END SCREEN
END

Screen Manipulation
Statements

Prepare Resets all items to default values

Read
Displays screen for user input
(constitutes a terminal I/O point)

Reread Used to redisplay a screen after


validation failure

Modify
item

TagSets the tag on for a screen item


(indicating a failure in validation)

Modifies the attributes of a screen

Prepare Screen Statement


Syntax:
PREPARE SCREEN CLIENTS

The Prepare statement allows the


programmer to initialize the screen and
return all screen items to original default
values.
Note: Screen items with no specified
defaults
will return to nulls.

Read and Reread Screen


Statements
Syntax:
Read Screen Clients
Displays the screen on the terminal and
pauses execution of the program until an
action key
is pressed
This is a terminal I/O point; an important
consideration in a multi-user environment.

Modify Screen Attributes


Statement
Syntax:
MODIFY NAME RED BLINKING
MODIFY SALARY UNPROTECTED
The attributes of a screen item may
be dynamically altered to provide
additional functionality to a screen.

Addressing Screen Items in


Code
BEGIN
SCREEN CLIENTS
TITLE 'Personnel Entry'
SKIP 1 LINE
PROMPT 'Name:' AT 5 INPUT NAME LEN 20 REQUIRED
.
.
END SCREEN
READ SCREEN CLIENTS
FD: IN CLIENTS FD
NAME = %CLIENTS:NAME
END FIND
END

PFKey Handling
BEGIN
SCREEN CLIENTS
TITLE 'Personnel Entry'
.
PROMPT 'PF1/HELP'
END SCREEN
READ SCREEN CLIENTS
IF %CLIENTS:PFKEY EQ + 1 THEN
CALL HELP
END IF
.
.
END

Section 7
Model 204 Application Subsystem
Facility

APSY

Apsy Features

Precompilation of procedures

Self defined security scheme

Full screen management facility

Testing and debugging modes

Automatic driver facility

Subsystem Definition

What do we define to an APSY?


Files
Users
User Classes
Security Rules
Location of Routines
Subsystem Operational Parameters

Subsysmgmt Main Menu


SUBSYSMGMT
Subsystem Management Facility
VER 2 REL 2.0
__ Select Subsystem Activity
_________________
1. Add
2. Modify
3. Browse
4. Copy
5. Rename
6. Delete
7. Import
8. Export
9. Export Delete
Subsystem Name:
Copy/Rename TO:
Export Users ?: N
====>
1 = HELp
2 = FILeuse 3 = QUIt
4 = OPEration
5 = PROcedure
6 = SYSclass
7=
8=
9 = USErdef
10 =
11 = EXPortlist
12 =

Operational Parameters
Screen
SUBSYSMGMT
Operational Parameters
Browse Mode
Subsystem Name: MERCURYT
Enter Status: 2 ( 1. PUBLIC
2. SEMI-PUBLIC

3. PRIVATE )

Autostart:
N
Lock File/Groups:
N
Log user into M204:
N
Log user out of M204: N
Auto Commit:
N
Maximum Iterations: 10
Message Display Options
Disconnect:
Y
Informational: Y
Error: Y
1 = HELp 2 = FILeuse
3 = QUIt
7=
8=
9 = USErdef

4=
10 =

5=
11 = PROcedure

6 = SYSclass
12 = END

File Use Screen


SUBSYSMGMT

Subsystem File Use


Browse Mode
Subsystem Name: MERCURYT
File/Group
Group
Required
Name
Y/N
Y/N
Name
Procs: UHMERCOT
N NUMLK: Y
1: TPGMRPTC
N
Y
2: TACNMDRC
N
Y
3: TCALNDRC
N
Y
4: AQCBLSTC
N
Y
5: HMERCRQT
N
Y

1 = HELp
7 = BACKward
12 = END

2=
8 = FORward

Deferred
Ordered-index
Deferred Name

3 = QUIt
4 = OPEration
9 = USErdef 10 =

5 = PROcedure
6=
11 = SYSclass

Subsystem User Class


Screen
SUBSYSMGMT Subsystem Classes
Browse Mode
Subsystem Name: MERCURYT
Subsystem Class 2: ADMIN
Command Privileges.
Start: Y Stop: Y Test: Y Debug: Y
File/Group
------------------------- File Privileges -----------------Names
Prcldef Privdef Sellvl
Readlvl Updtlvl Addlvl
Procs: UHMERCOT
0
0120
0
0
0
1: TPGMRPTC
0
0440
0
0
0
0
2: TACNMDRC
0
0440
0
0
0
0
3: TCALNDRC
0
0440
0
0
0
0
4: AQCBLSTC
0
0440
0
0
0
0
5: HMERCRQT 0
24C1
0
0
0
0
1 = HELp
PRIvdef
7 = BACkward

2 = FILeuse

3 = QUIt

4 =OPEration

5 =PROcedure

8 = FORward 9 = USErdef 10 = PREvclss 11 = NEXtclss

6=
12 = END

User Definition Class


Selection
SUBSYSMGMT

User Definitions
BROWSE MODE

Subsystem Name: MERCURYT


Subsystem Classes
1 DEFAULT
2 ADMIN
ENTER SUBSYSTEM CLASS NUMBER:
====>

1 = HELp
SYSCLASS
7 = BACkward

2 = FILeuse

3 = QUIt

8 = FORward 9 =

4 =OPEration
10 =

5 =PROcedure
11 =

6=

12 = END

Subsystem Class Users


Screen
SUBSYSMGMT Subsystem Class Users
BROWSE MODE
Copy From
Sclass: Subsystem:
Sclass: ADMIN
Subsystem: MERCURYT
Account slots: 1-48
Number of Accounts:
> ACNSLM
>
> >
> CUSEXG
>
> >
> CUSHDA
>
> >
> CUSJCV
>
> >
> CUSMLM
>
> >
> CUSSMH
>
> >
> NTDWC
>
> >
> STARTUP
>
> >
1 = HELp
7 = BACkward

2=
8 = FORward

3 = QUIt
4 =DELusers
5 =PREview
6=
9=
10 =COPyusers 11 =CPReplace 12 = END

The End

You might also like