• Keine Ergebnisse gefunden

TYPE DECIMAL FIXED 6,2

The repeating group QUARTER-TOTS contains a vector (MNTH) and a nonrepeating elementary data item (CUM-TOT), Both subordinate data items arc at the same level and must have the same level number.

Figure 2-21. OCCURS Clause Examples

| S / A C T U A L \

I.VIRTUAL ( ~ESULT OF data-base-procedure

Figure 2-22. RESULT Clause Format

A data item can be described with either the ACTUAL RESULT or the VIRTUAL RESULT clause. The data item d e s c r i b e d w i t h t h e R E S U LT c l a u s e c a n n o t b e a r e p e a t i n g d a t a i t e m ( v e c t o r o r r e p e a t i n g g r o u p ) . It cannot be subordinate to a repeating group data item.

The ACTUAL option specifies that the data item is physically included in the record, and that a value is always stored in the record. When a new record is stored in the data base, the data base procedure I s e x e c u t e d t o e s t a b l i s h a v a l u e f o r t h e d a t a item. Subsequently, the specified data base proce dure is executed to update the data item each time

t h e r e c o r d i s m o d i fi e d . I f t h e A C T U A L o p t i o n i s specified in the RESULT clause, the ENCODING clause c a n n o t b e i n c l u d e d i n t h e s a m e d a t a d e s c r i p t i o n e n t r y.

The VIRTUAL option specifies that the value of the d a t a i t e m i s e s t a b l i s h e d w h e n t h e d a t a i t e m i s r e q u e s t e d b y a n a p p l i c a t i o n s p r o g r a m . T h e d a t a i t e m i s n o t p h y s i c a l l y s t o r e d i n t h e r e c o r d ; t h e r e f o r e , t h e s i z e o f t h e d a t a i t e m s h o u l d n o t b e included when the maximum record length (MRL) is c a l c u l a t e d f o r t h e a r e a . T h e d a t a i t e m i s s t o r e d in the CDCS buffer when a user requests the record, and the buffer size must be large enough to include t h e d a t a i t e m . T h e s p e c i fi e d d a t a b a s e p r o c e d u r e is invoked when a user GET function (READ state m e n t ) i n c l u d e s t h e d a t a i t e m . W h e n t h e V I R T U A L option is used to describe a data item, the follow

i n g r e s t r i c t i o n s a p p l y :

Neither the ENCODING clause nor the DECODING clause can be used to describe the data item.

A CALL clause cannot be included in the data d e s c r i p t i o n e n t r y.

The data item cannot be referenced in an OCCURS data name TIMES clause.

F i g u r e 2 - 2 3 i l l u s t r a t e s t h e p r o c e s s i n g o f a d a t a item described with the VIRTUAL RESULT clause.

60485200 A 2-17

Virtual FIELDB

fi e l d a \ / fi e l d c

Data Base ABC HUK

. . . .

GET Function

w i f

CDCS Data

Base Procedure

\ \ \

FIELDA FIELDB FIELDC

User Work Area

ABC DEFG HUK

Figure 2-23. Virtual Data Item Processing

CHECK Clause

The CHECK clause imposes certain restrictions on t h e v a l u e o f t h e d a t a i t e m . O n e o r m o r e o f t h e f o l l o w i n g f u n c t i o n s c a n b e s p e c i fi e d f o r t h e d a t a item:

Inhibiting data conversion

Checking validity of the data item whenever a value is changed or added

Restricting the value of the data item

If the value of the data item does not satisfy the condition of the CHECK clause, an error is reported t o t h e u s e r. T h e f o r m a t o f t h e C H E C K c l a u s e i s shown in figure 2-24.

Each of the three options in the CHECK clause can b e s p e c i fi e d o n c e . M u l t i p l e o p t i o n s c a n a p p e a r i n

a n y o r d e r . P I C i s t h e l e g a l a b b r e v i a t i o n f o r PICTURE. The data item described with the CHECK c l a u s e m u s t a l s o b e d e s c r i b e d w i t h e i t h e r t h e PICTURE clause or the TYPE clause; however, the data item cannot be described as TYPE COMPLEX.

The PICTURE option specifies that data conversion between the schema and the subschema is not allowed f o r t h e d a t a i t e m . T h e c h a r a c t e r i s t i c s o f t h e d a t a item in the subschema must match the characteris tics of the data item in the schema.

The data base procedure option causes the specified procedure to be executed when a value for the data item is added or changed. The specified procedure p e r f o r m s v a l i d i t y c h e c k i n g o n t h e v a l u e . I f b o t h t h e d a t a b a s e p r o c e d u r e a n d VA L U E o p t i o n s a r e s p e c i fi e d , t h e VA L U E c h e c k i s p e r f o r m e d fi r s t ; t h e procedure is executed only if the value of the data i t e m i s v a l i d .

CHECK IS

/ PICTURE \

\ p i c /

PIC

data-base-procedure

VALUE CNOTD literal-1 [THRU literal-23 Cliteral-3 LTHRU literal-43:

Figure 2-24. CHECK Clause Format

/^sS«^\

/#^v

The VALUE option places a restriction on the actual are executed before validity checking occurs.

Literals specified in the VALUE option must corre item requires nonstandard conversion. The conver sion is performed by a data base procedure when the item described with the ENCODING/DECODING clause m u s t b e a n e l e m e n t a r y d a t a i t e m t h a t i s a l s o d e

scribed with either the TYPE clause or the PICTURE clause.

The ENCODING clause invokes the conversion proce dure when a STORE function (WRITE statement) adds a n e w v a l u e f o r t h e d a t a i t e m t o t h e d a t a b a s e , o r when a MODIFY function (REWRITE statement) alters an existing value. The value is converted from the subschema representation to the schema representa

t i o n . A d a t a i t e m d e s c r i b e d w i t h t h e E N C O D I N G clause cannot be described with either the ACTUAL RESULT or the VIRTUAL RESULT clause.

The DECODING clause invokes the conversion proce dure when a GET function (READ statement) requests

PICTURE or TYPE Clime

Numeric picture-specifications PICTURE "9999V999"

Examples of Literals for CHECK VALUE Pause

1234 41234.12 PICTURE "OT9.WT"

12.123b (rounaea on to 12.124) 123.34

-123

-•-123.555 (actual sign must be used)

PICTURE "PPP9999" .00012341 (decimal point and leading zeros must .0001 \ be specified)

PICTURE "899PPP"

( (trailin9 zeros mu$t ** specified with

«#..»#»«( no decimal point) 0010000)

Nonnumeric picture-specifications

PICTURE "X(5>9(5)" "ABCDE12345"l (nonnumeric literals must be

"A*X-$11111" j enclosed in quotation marks) PICTURE "A<10>" " A A A A "

"ABCD EFGH"

Floating point numeric type

TYPE FLOAT 281

99999.999 Fixed point numeric types

TYPE FIXED 5.7 .0012345)„____ f (decimal point and leading zeros 0 0 1 0 I m u s t ^ i p e c i fi e d '

TYPE FIXED 5.-2 1234500 k (trailing zeros must be specified with 500 ) no decimal point)

TYPE FIXED 14 55555.55 (rounded off to 55556)

-50000

any integer not greater than 14 digits in length TYPE FIXED 14.2 any numeric literal not greater than 14 digits in length TYPE FIXED 18 any integer not greater than 18 digits in length TYPE FIXED 18.4 any numeric literal not greater than 18 digits in length Nonnumeric type

TYPE CHARACTER 5 "AAAAA" (nonnumeric literals must be enclosed

"A-123" In quotation marks)

Figure 2-25. Examples of Valid Literals in the CHECK VALUE Clause

F O R l ^ ^ l ^ l f A LWAY S l C A L L d a t a - b a s e - p r o c e d u r

) D E C O D I N G / L J K

The BEFORE, ERROR, and AFTER options determine when the data base procedure is invoked.

BEFORE Figure 2-26. ENCODING/DECODING

Clause Format The procedure is invoked immediately before

record mapping occurs.

CALL data -base-procedure

BEFORE STORE

G E T M O D I F Y ON ERROR DURING

A F T E R

Figure 2-27. CALL Clause Format (Data Description Entry)

ERROR

The procedure is executed each time CDCS d e t e c t s a n d r e p o r t s a n e r r o r d u r i n g t h e

performance of the specified function.

AFTER

The procedure is executed immediately after record mapping occurs.

/ ^ ^ ^ s V

A t l e a s t o n e o f t h e s e o p t i o n s m u s t b e s p e c i fi e d ; e a c h o p t i o n c a n b e s p e c i fi e d o n c e i n t h e C A L L c l a u s e . I f t w o o r t h r e e o p t i o n s a r e i n c l u d e d i n the clause, the data base procedure is executed at e a c h d e s i g n a t e d t i m e . T h e o n l y e x c e p t i o n o c c u r s when the ERROR and AFTER options are specified and an error causes execution of the data base proce d u r e . I n t h i s s i t u a t i o n , t h e d a t a b a s e p r o c e d u r e s p e c i fi e d i n t h e A F T E R o p t i o n i s n o t e x e c u t e d . I n t h e f o l l o w i n g e x a m p l e , t h e d a t a b a s e p r o c e d u r e SLEDIT is executed before the STORE function is p e r f o r m e d , a n d w h e n e v e r C D C S d e t e c t s a n e r r o r during the performance of the STORE function.

CALL SLEDIT BEFORE ERROR STORE

T h e u s e r f u n c t i o n s p e c i fi e d i n t h e C A L L c l a u s e d e t e r m i n e s t h e t y p e o f d a t a m a n i p u l a t i o n t h a t causes the data base procedure to be executed at t h e d e s i g n a t e d t i m e . T h r e e f u n c t i o n s c a n b e s p e c i fi e d :

STORE

T h e p r o c e d u r e i s e x e c u t e d w h e n a u s e r f u n c t i o n ( W R I T E s t a t e m e n t ) s t o r e s a n e w value for the data item.

GET

T h e p r o c e d u r e i s e x e c u t e d w h e n a u s e r function (READ statement) places the data item in the user work area.

MODIFY

T h e p r o c e d u r e i s e x e c u t e d w h e n a u s e r f u n c t i o n ( R E W R I T E s t a t e m e n t ) c a u s e s t h e value of the data item to be changed.

Each option can be specified once in a CALL clause.

Separate CALL clauses for individual user functions can invoke the same or different data base proce d u r e s . I f n o u s e r f u n c t i o n i s s p e c i fi e d i n t h e CALL clause, the data base procedure is executed at t h e d e s i g n a t e d t i m e f o r e a c h o f t h e t h r e e u s e r

f u n c t i o n s .

Multiple data base procedures can be executed at a designated time. When more than one CALL clause for the same user function specifies the same time to invoke a procedure (before, during, or after the u s e r f u n c t i o n i s p e r f o r m e d ) , t h e p r o c e d u r e s a r e executed in the order the CALL clauses are stated i n t h e d a t a d e s c r i p t i o n e n t r y . I n t h e f o l l o w i n g example, the data base procedure GETCHK is exe cuted, and then the procedure GETVER is executed before the GET function is performed.

DATA CONTROL.

• C a r e a c o n t r o l e n t r y. > . . . Figure 2-28. Data Control Entry Format T h e d a t a c o n t r o l e n t r y s u p p l e m e n t s i n f o r m a t i o n i n F I L E c o n t r o l s t a t e m e n t s f o r t h e a r e a s i n t h e s c h e m a . I n f o r m a t i o n p r o v i d e d i n a F I L E c o n t r o l s t a t e m e n t d o e s n o t r e q u i r e c o r r e s p o n d i n g i n f o r m a t i o n i n t h e a r e a c o n t r o l e n t r y i n t h e d a t a c o n t r o l e n t r y . F o r m o r e i n f o r m a t i o n , r e f e r t o t h e F I L E C o n t r o l S t a t e m e n t s u b s e c t i o n , w h i c h a p p e a r s l a t e r i n t h i s s e c t i o n .