• Keine Ergebnisse gefunden

The source program for a COBOL or Query Update s u b s c h e m a c o n t a i n s fi v e d i v i s i o n s : Ti t l e D i v i s i o n , A l i a s D i v i s i o n , R e a l m D i v i s i o n , R e c o r d D i v i s i o n , a n d R e l a t i o n D i v i s i o n . T h e f o l l o w i n g p a r a g r a p h s d e fi n e t h e f o r m a t s p e c i fi c a t i o n s f o r e a c h c l a u s e that can be used in the source program.

T he general f o r ma t o f a C OB OL or Qu ery U pdat e s u b s c h e m a I s s h o w n i n fi g u r e 3 - 9 . F o r t h e r u l e s governing the structure of the subschema, see the Subschema Structuring Conventions subsection.

TITLE DIVISION.

{ t i t l e d e s c r i p t i o n e n t r y > . TALIAS DIVISION.

L C a l i a s d e s c r i p t i o n e n t r y. ] . REALM DIVISION.

{ r e a l m d e s c r i p t i o n e n t r y } . RECORD DIVISION.

{ r e c o r d d e s c r i p t i o n e n t r y. } fRELATION DIVISION,

[ . { . r e l a t i o n d e s c r i p t i o n e n t r y

..]

.».„]

Figure 3-9. General Format, COBOL and Query Update Subschema

The subschema-name entered in this clause is the name used whenever the subschema is referenced after it has been compiled and stored in the sub s c h e m a l i b r a r y. T h e n a m e m u s t b e u n i q u e a m o n g subschemas associated with the designated schema.

The schema-name identifies the schema to which the s u b s c h e m a a p p l i e s . T h e s c h e m a m u s t e x i s t w i t h i n the system and be recognized by the CYBER Database Control System (CDCS). The schema describes the entire data base of which the subschema describes only a portion.

Other Clauses

Future software releases will provide other clauses t h a t c a n b e I n c l u d e d i n t h e t i t l e d e s c r i p t i o n e n t r y. O n l y o n e c l a u s e I s c u r r e n t l y a c c e p t a b l e I n

t h e Ti t l e D i v i s i o n .

ALIAS DIVISION

T h e A l i a s D i v i s i o n i s o p t i o n a l a n d , I f i n c l u d e d , m u s t i m m e d i a t e l y f o l l o w t h e T i t l e D i v i s i o n . T h i s d i v i s i o n p r o v i d e s t h e m e a n s t o a s s i g n n a m e s t h a t are to be used in the subschema in place of names d e fi n e d I n t h e s c h e m a . T h e f o r m a t o f t h e A l i a s D i v i s i o n i s a s f o l l o w s :

ALIAS DIVISION.

{ a l i a s d e s c r i p t i o n e n t r y. } . . .

60485200 B 3-11

T h e a l i a s d e s c r i p t i o n e n t r y i s a s t a t e m e n t t h a t specifies a name to be used in the subschema and in the application programs instead of a name used in t h e s c h e m a . E a c h a l i a s d e s c r i p t i o n e n t r y a s s i g n s o n e a l i a s . A s e p a r a t e e n t r y i s i n c l u d e d f o r e a c h name in the schema to be assigned an alias. One clause is used in an alias statement.

Assigning an alias in the subschema does not change the name in the schema; the alias is a substitute name that is used only in the subschema and in the a p p l i c a t i o n p r o g r a m s r e f e r e n c i n g t h a t p a r t i c u l a r subschema. When an alias has been assigned, the name in the schema cannot be used in the subschema or in the application programs.

A r e c o r d i n t h e s c h e m a i s a s s i g n e d a n a l i a s b y entering the RECORD option in the AD clause. The name entered as record-name-1 must be the name of a record defined in the schema. The name entered as record-name-2 then becomes the record name that is u s e d i n b o t h t h e s u b s c h e m a a n d t h e a p p l i c a t i o n programs referencing the subschema.

A data item in the schema is assigned an alias by e n t e r i n g t h e D ATA o p t i o n i n t h e A D c l a u s e . T h e name entered as data-name-1 must be the name of a d a t a i t e m i n t h e s c h e m a . T h e n a m e e n t e r e d a s data-name-2 then becomes the data name that is used in both the subschema and the application programs

referencing the subschema.

The use of the AD clause in the Alias Division is i l l u s t r a t e d i n fi g u r e 3 - 1 2 .

AD Clause

The AD clause assigns an alias to a name defined in the schema. The alias becomes the name recognized by the subschema and by the COBOL or Query Update application programs that reference the subschema.

The AD clause eliminates the need to rewrite exist i n g a p p l i c a t i o n p r o g r a m s t h a t u s e n a m e s d i ff e r e n t from the names defined in the schema. The format of the AD clause is shown in figure 3-11.

( REALM realm-name-1 AD I RECORD record-name-1

DATA data-name-1 irealm-name-2 )

record-name-2 >

data-name-2 )

Other Clauses

O n l y t h e A D c l a u s e c a n b e i n c l u d e d i n a n a l i a s d e s c r i p t i o n e n t r y . N o a d d i t i o n a l c l a u s e s a r e

planned for the Alias Division.

REALM DIVISION

T h e R e a l m D i v i s i o n m u s t b e i n c l u d e d i n t h e D D L s o u r c e p r o g r a m . I f t h e A l i a s D i v i s i o n i s i n c l u d e d , t h e R e a l m D i v i s i o n i m m e d i a t e l y f o l l o w s i t ; o t h e r wise, the Realm Division follows the Title Division.

The schema areas that are to be made available to the subschema as realms are specified in the Realm D i v i s i o n . T h e f o r m a t o f t h e R e a l m D i v i s i o n i s a s

f o l l o w s : Figure 3-11. AD Clause Format

An alias can be assigned to a realm, a record, or a data item. A specific name in the schema can have o n l y o n e a l i a s i n t h e s u b s c h e m a . E a c h r e a l m - , r e c o r d - , o r d a t a - n a m e - 1 m u s t b e a u n i q u e r e a l m , record, or data name; however, data-name-1 can be qualified to make it unique. The same alias cannot b e u s e d f o r m o r e t h a n o n e r e a l m - , r e c o r d - , o r data-name-2 entry. Data-name-2 can be qualified to make the name unique.

When a realm is assigned an alias, the REALM option is entered in the AD clause. The name entered as realm-name-1 must be defined in the schema as an area. The name entered as realm-name-2 is then the name used in the subschema and in the application programs to reference that area in the schema.

REALM DIVISION.

{ r e a l m d e s c r i p t i o n e n t r y } .

The realm description entry is a statement consist ing of one clause that identifies the schema areas to be used as realms in the subschema. One state ment can specify as many realms as needed for the

subschema.

RD Clause

The RD clause identifies the specific schema areas that are to be used in the subschema and in the COBOL or Query Update application programs refer e n c i n g t h e s u b s c h e m a . A n a r e a i n t h e s c h e m a i s equivalent to a realm in the subschema. A realm is e q u i v a l e n t t o a fi l e i n t h e a p p l i c a t i o n p r o g r a m . The format of the RD clause is shown in figure 3-13.

Schema AREA NAME IS SALES.

RECORO NAME IS SALES-REC 0 1 C U S T O M E R - I D . . . 0 1 I N V O I C E - N U M . . . 01 AMOUNT-DUE

Subschema A L I A S D I V I S I O N .

AO REALM SALES BECOMES SALES-FILE.

AO RECORD SALES-REC BECOMES SALES.

AD DATA CUSTOMER-ID BECOMES CUST-NO.

AD DATA INVOICE-NUM BECOMES INV-NO.

AD DATA AMOUNT-DUE BECOMES AMT-DUE.

Figure 3-12. Assigning Aliases

^ \

0!^*\

( a l l

RD } •

1 realm--name-1 [realm--name

-2] ..j

Figure 3-13. RD Clause Format

R e a l m s f o r t h e s u b s c h e m a a r e s e l e c t e d f r o m t h e areas in the schema. One or more realms are speci fied by entering the realm names in the RD clause.

I f a n a l i a s w a s a s s i g n e d t o a r e a l m i n t h e A l i a s Division, the alias is used in the RD clause. When all areas in the schema are to be made available to the subschema, the word ALL can be used in the RD clause. Unless ALL is specified, only those realms n a m e d i n t h e R D c l a u s e a r e a v a i l a b l e t o t h e s u b s c h e m a a n d t o t h e p r o g r a m s r e f e r e n c i n g t h e subschema.

Other Clauses

Future software releases will provide other clauses t h a t c a n b e i n c l u d e d i n t h e r e a l m d e s c r i p t i o n e n t r y. O n l y o n e c l a u s e i s c u r r e n t l y a c c e p t a b l e i n the Realm Division.

RECORD DIVISION, COBOL SUBSCHEMA

The Record Division immediately follows the Realm D i v i s i o n . I t s p e c i fi e s t h e r e c o r d t y p e t o b e m a d e a v a i l a b l e t o a C O B O L a p p l i c a t i o n p r o g r a m a n d d e s c r i b e s t h e f o r m a t o f t h e d a t a i n e a c h r e c o r d t y p e . T h e f o r m a t o f t h e R e c o r d D i v i s i o n i s a s f o l l o w s :

RECORD DIVISION.

{ r e c o r d d e s c r i p t i o n e n t r y. } . . .

The Record Division is similar to the File Section in the Data Division of a COBOL program. When a COBOL program specifies a subschema, the record d e s c r i p ti o n e n tr i e s i n th e s u b s c h e m a R e c o r d D i v i s i o n r e p l a c e t h e fi l e d e s c r i p t i o n e n t r i e s n o r m a l l y written in the COBOL program.

T h e r e c o r d s w i t h i n t h e r e a l m s s p e c i fi e d i n t h e R e a l m D i v i s i o n a r e d e s c r i b e d i n t h e R e c o r d D i v i

s i o n . O n l y t h o s e r e c o r d s t h a t a r e t o b e u s e d b y t h e C O B O L p r o g r a m s a r e i n c l u d e d . T h e r e c o r d d e s c r i p t i o n e n t r y c o n s i s t s o f a s e r i e s o f s t a t e m e n t s ( d a t a d e s c r i p t i o n e n t r i e s ) t h a t d e s c r i b e t h e data as it is used by the COBOL programs.

T h e fi r s t d a t a d e s c r i p t i o n e n t r y m u s t b e l e v e l n u m b e r 0 1 , t h e r e c o r d n a m e e n t r y. S u b s e q u e n t entries begin with level numbers 02 through 49 for group and elementary data items, level number 66 for renaming a data item, and level number 88 for d e fi n i n g v a l u e s t o b e a s s o c i a t e d w i t h a c o n d i t i o n . The formats for data description entries are shown in figure 3-14.

JUSTIFIED Clause

The JUSTIFIED clause specifies nonstandard posi t i o n i n g o f d a t a w i t h i n a r e c e i v i n g fi e l d . T h e format of the JUSTIFIED clause is shown in figure 3-15.

0 1 r e c o r d - n a m e Format 1

level-number data-name [JUSTIFIED clause]

[OCCURS clause!

[PICTURE clausel [REDEFINES clause]

[SYNCHRONIZED clause]

[USAGE clausel.

Format 2

66 data-name RENAMES clause-Format 3

88 condition-name VALUE clause.

Figure 3-14. Formats of Data Description Entries, COBOL Subschema

( j u s t i fi e d

j JUST

RIGHT

Figure 3-15. JUSTIFIED Clause Format, COBOL Subschema

This clause can be specified only for nonnumeric elementary data items. JUST is the legal abbrevi ation for JUSTIFIED.

The JUSTIFIED clause overrides the normal position ing of data when the size of the receiving field does not equal the number of characters in the data item. When the receiving field contains fewer character positions than the data item, positioning occurs as follows:

In normal positioning, the data item is aligned at the leftmost character position and trun cated at the right.

If the JUSTIFIED clause is specified, the data item is aligned at the rightmost character position and truncated at the left.

When the receiving field contains more character positions than the data item, positioning occurs as follows:

In normal positioning, the data item is aligned at the leftmost character position and blank

filled at the right.

60485200 A 3-13

If the JUSTIFIED clause is specified, the data i t e m i s a l i g n e d a t t h e r i g h t m o s t c h a r a c t e r p o s i t i o n a n d b l a n k fi l l e d a t t h e l e f t .

F i g u r e 3 - 1 6 i l l u s t r a t e s c h a r a c t e r p o s i t i o n i n g . OCCURS Clause

The OCCURS clause is used to indicate a repeated d a t a i t e m w h e r e a l l o c c u r r e n c e s o f t h e d a t a i t e m a r e i d e n t i c a l i n e v e r y r e s p e c t e x c e p t v a l u e . T h e d a t a i t e m c a n b e a n e l e m e n t a r y i t e m o r a g r o u p

item. The format of the OCCURS clause is shown in figure 3-17.

NOTE

Refer to appendix F for recommendations on the use of repeating groups.

The KEY and INDEXED options are not used by CDCS;

the options can be included in an OCCURS clause for use by the COBOL application program. The OCCURS clause must not be specified in a data description entry that has level number 66 or 88.

P i c t u r e J u s t i fi e d 9 ( 5 ) R i g h t X(5)

X(5) X{2)

Right

X ( 2 ) R i g h t

Data Item

|1 | 2|3 |

| A | B | c |

| a| b 1 c 1

| A | B | c |

| a | b | c |

Receiving Field

A B C A A A

A B B C

Illegal; item is numeric.

Left-justified normally.

Right-justified; blanks filled in.

Left-justified normally; right character truncated.

Right-justified; left character truncated.

Figure 3-16. Character Positioning

Format 1

OCCURS intecer-2 TIMES

[j ASCENDING \

I 1 DESCENDING f KEY IS data-name-2 [data- name -3] .

..]...

[INDEXED BY index-name-1 [index-name-2] . .

•]

Format 2

OCCURS inteaer-1 TO inteqer-2 TIMES DEPENDING ON data-name-1

f» ASCENDING )

|t DESCENDING )

KEY IS data-name-2 [data--name -3] .

■■]•■■

[INDEXED BY index--name--1 {index-name -2] . .

Figure 3-17. OCCURS Clause Format, COBOL Subschema

A d a t a d e s c r i p t i o n e n t r y w i t h f o r m a t 1 o f t h e OCCURS clause can be subordinate to another entry with either format of the OCCURS clause. An entry w i t h f o r m a t 2 c a n n o t b e s u b o r d i n a t e t o a n e n t r y w i t h t h e O C C U R S c l a u s e . U p t o t h r e e l e v e l s o f nested data items can be specified with the OCCURS c l a u s e . W h e n r e p e a t i n g g r o u p s a n d v e c t o r s a r e nested, the vector is considered to be a repeating group and is included in the level count.

Integer-1 and integer-2 must be positive numbers.

I n f o r m a t 2 , i n t e g e r - 2 m u s t b e g r e a t e r t h a n i n t e g e r - 1 . T h e v a l u e o f i n t e g e r - 1 c a n b e z e r o ; integer-2 must never be zero.

An elementary data item described with the OCCURS clause must also be described with the PICTURE or USAGE clause. A group data item cannot be described with both the OCCURS clause and the PICTURE clause.

When an item occurs a fixed number of times, format 1 is used and integer-2 specifies the exact number o f o c c u r r e n c e s . W h e n a n i t e m o c c u r s a v a r i a b l e number of times, format 2 is used and the number of o c c u r r e n c e s f o r e a c h r e c o r d i s d e t e r m i n e d a s f o l l o w s :

I n t e g e r - 1 r e p r e s e n t s t h e m i n i m u m n u m b e r o f occurrences.

I n t e g e r - 2 r e p r e s e n t s t h e m a x i m u m n u m b e r o f occurrences.

D a t a - n a m e - 1 r e f e r e n c e s a d a t a i t e m w h o s e current value represents the number of occurr e n c e s . T h e v a l u e o f d a t a - n a m e - 1 m u s t b e a p o s i t i v e v a l u e w i t h i n t h e r a n g e o f i n t e g e r - 1 through integer-2.

In format 2, data-name-1 names an elementary item that is unique or can be made unique by qualifica t i o n . I t c a n n o t b e s u b s c r i p t e d a n d i t s h o u l d n o t be described as C0MPUTATI0NAL-2. The size of the d a t a i t e m c a n n o t e x c e e d s i x c h a r a c t e r s . T h e e l e mentary data item must precede the group data item t h a t r e f e r e n c e s i t .

A data item that occurs a variable number of times m u s t b e t h e l a s t i t e m i n a r e c o r d d e s c r i p t i o n e n t r y. T h e d a t a d e s c r i p t i o n e n t r y t h a t c o n t a i n s the OCCURS clause can only be followed by subordi nate entries.

If the OCCURS clause is used with a group data item, any data-name belonging to the group must be referenced by subscripting or indexing whenever it is used as an operand, unless the data-name is the o b j e c t o f a R E D E F I N E S c l a u s e . O t h e r c l a u s e s s p e c i fi e d w i t h t h e O C C U R S c l a u s e a p p l y t o e a c h occurrence of the data item.

The data-names in the KEY option can be qualified.

D ata-name-2 refere nces ei ther the entry containing t h e O C C U R S c l a u s e o r a s u b o r d i n a t e e n t r y i n a r e p e a t i n g g r o u p i t e m . D a t a - n a m e - 3 a n d a n y a d d i t i o n a l d a t a - n a m e s s p e c i f y e n t r i e s s u b o r d i n a t e t o the group item that contains the OCCURS clause.

I f d a t a - n a m e - 2 d o e s n o t r e f e r e n c e t h e e n t r y c o n taining the OCCURS clause, the following conditions apply to the key data-names:

All items identified by the data-names must be s u b o r d i n a t e t o t h e g r o u p i t e m c o n t a i n i n g t h e OCCURS clause.

N one o f the k ey da ta- na me s c an r ef erence an item that contains an OCCURS clause.

No item between the entry containing the KEY o p t i o n a n d t h e e n t r i e s i d e n t i fi e d b y t h e k e y data-names can be described with an OCCURS clause.

INDEXED BY Option

The INDEXED BY option is used when the entry con taining the OCCURS clause or an item subordinate to i t i s r e f e r e n c e d b y i n d e x i n g . T h i s o p t i o n i s included only for use by the COBOL program; it is not used by CDCS.

T h e i n d e x - n a m e s p e c i fi e d i n t h i s o p t i o n i s n o t described anywhere else in the Record Division. It is not data and cannot be associated with any data h i e r a r c h y. T h e f o r m a t a n d a l l o c a t i o n o f t h e i n d e x -name are hardware dependent. The index--name must be unique; it cannot be qualified.

PICTURE Clause

The PICTURE clause describes the general character i s t i c s o f a n e l e m e n t a r y d a t a i t e m i n t e r m s o f i t s s i z e a n d c l a s s . T h e l o c a t i o n o f a n o p e r a t i o n a l sign or an assumed decimal point can also be indi c a t e d i n t h e c l a u s e . T h e f o r m a t o f t h e P I C T U R E clause is shown in figure 3-18.

( PICTURE )

| p i c |

IS picture-specification

Figure 3-18. PICTURE Clause Format, COBOL Subschema

T h i s c l a u s e c a n b e s p e c i fi e d o n l y f o r e l e m e n t a r y d a t a i t e m s . I t c a n n o t b e u s e d w i t h a l e v e l 6 6 , l e v e l 8 8 , o r i n d e x d a t a i t e m . P I C i s t h e l e g a l abbreviation for PICTURE.

ASCENDING/DESCENDING KEY Option

W h e n r e p e a t e d d a t a i t e m s a r e s e q u e n c e d , t h e ASCENDING KEY or DESCENDING KEY option specifies the order according to the values of data-name-2, d a t a - n a m e - 3 , e t c . T h i s o p t i o n c a n b e i n c l u d e d i n the OCCURS clause for use by the COBOL program; it is not used by CDCS.

The class of a data item is determined by the type o f c h a r a c t e r s i n t h e p i c t u r e - s p e c i fi c a t i o n . T h e c h a r a c t e r s 9 , S , V, a n d P a r e u s e d t o d e s c r i b e n u m e r i c d a t a i t e m s . A n a l p h a b e t i c d a t a i t e m i s d e s c r i b e d b y t h e c h a r a c t e r A . T h e p i c t u r e -s p e c i fi c a t i o n f o r a n a l p h a n u m e r i c d a t a i t e m contains the character X or any combination of the characters X, 9, and A.

60485200 A 3-15

The size of a data item is determined by the number

The picture-specification can contain a maximum of 3 0 c h a r a c t e r s , i n c l u d i n g p a r e n t h e s e s ; h o w e v e r, a clause, the specifications must be compatible. For example, COMP usage must have a numeric picture point alignment. The combined number of positions indicated by the characters 9 and P cannot exceed 30 characters.

P T h e c h a r a c t e r P i n t h e p i c t u r e - s p e c i fi c a t i o n indicates an assumed decimal scaling posi t i o n . I t i s u s e d t o s p e c i f y a n a s s u m e d

yf5H^»y

Picture-Specification

999 99V999 S99V99 PPP9999 SPPP9999 S999PPP

Data Value

123 12345 +1234 .0001234 -.0001234 -123000.

Display Code Stored

1 2 3

1 2 3 4 5

4

1 2 3 +

4

I

0 0 0

0 0 0

0 0 0

Figure 3-21. Numeric Data Items Alphanumeric Data Items

T h e p i c t u r e - s p e c i fi c a t i o n t o d e s c r i b e a n a l p h a numeric data item contains either a combination of t h e c h a r a c t e r s 9 , A , a n d X o r o n l y t h e c h a r a c t e r X. The size of the data item cannot exceed 32767 c h a r a c t e r s .

The function of the characters 9 and A is the same a s f o r n u m e r i c a n d a l p h a b e t i c d a t a i t e m s ; t h e function of the character X is as follows:

X E a c h X i n t h e p i c t u r e - s p e c i fi c a t i o n r e p r e sents a character position that can contain any character in the DDL character set.

Some typical alphanumeric data items are shown in figure 3-22.

REDEFINES Clause

The REDEFINES clause allows data to be described in a n a l t e r n a t e f o r m a t . T h e r e d e fi n e d d a t a i t e m i s given a new name; since it is still the same data value, it occupies the same physical area in memory.

The REDEFINES clause is not used by CDCS; it can be included in the subschema for use by the COBOL application program. The format of the REDEFINES clause is shown in figure 3-23.

level-number data-name-1 REDEFINES data-name-2

Figure 3-23. REDEFINES Clause Format, COBOL Subschema

NOTE

Refer to appendix F for recommendations on the use of the REDEFINES clause.

T h i s c l a u s e c a n b e s p e c i fi e d f o r b o t h e l e m e n t a r y a n d n o n r e p e a t i n g g r o u p d a t a i t e m s . T h e l e v e l number and size of data-name-1 and data-name-2 must be identical. The REDEFINES clause cannot be used with a level 01, level 66, or level 88 data item.

Th e dat a de s cr i pt i on ent ry fo r dat a- name-2 cannot c o n t a i n a n O C C U R S c l a u s e . D a t a - n a m e - 2 c a n b e s u b o r d i n a t e t o a n e n t r y c o n t a i n i n g a n O C C U R S c l a u s e , b u t d a t a - n a m e - 2 c a n n o t b e s u b s c r i p t e d o r i n d e x e d t o r e f e r e n c e a s p e c i fi c o c c u r r e n c e o f t h e d a t a i t e m . D a t a - n a m e - 1 c a n b e d e s c r i b e d a s a repeating data item as long as the total number of c h a r a c t e r p o s i t i o n s i s e q u a l t o t h e n u m b e r o f characters in data-name-2.

Pictu re-Spec i f icat i on XXXXXXXX or X(8) XXXXXXXX or X(8) AAAA999

A(4}9(3)

Data Value

ABCD-***

123.4567 ABCD 123 ABCD 123

Display Code Stored

A B C D

- * »

1 2 3 4 5 6

A B C D 1 2 3 A B C D 1 2 3

Figure 3-22. Alphanumeric Data Items

60485200 A 3-17

Data-name-2 must not be qualified even if it is not unique; data-name-2 can only refer to the previous entry with the same level number. If the REDEFINES c l a u s e i s u s e d f o r a n e l e m e n t a r y d a t a i t e m , n o e n t r i e s c a n b e s p e c i fi e d b e t w e e n t h e e n t r y r e f e r enced by data-name-2 and the entry containing the REDEFINES clause. If a group data item is being r e d e fi n e d , o n l y s u b o r d i n a t e e n t r i e s c a n b e s p e c i

fie d b e t ween the e n tr y re fe r enc ed by d ata-n ame-2 and the entry containing the REDEFINES clause.

M u l t i p l e r e d e fi n i t i o n s o f t h e s a m e d a t a i t e m a r e allowed; data-name-2 in each entry must reference t h e e n t r y t h a t o r i g i n a l l y d e fi n e d t h e d a t a i t e m . Within the Procedure Division of the COBOL applica

t i o n p r o g r a m , t h e o r i g i n a l d a t a - n a m e a n d t h e redefined data-names can be used to reference the data item.

) SYNCHRONIZED )

| S Y N C j

LEFT RIGHT L - 1

Figure 3-25. SYNCHRONIZED Clause Format, COBOL Subschema

SYNCHRONIZED LEFT places the leftmost character of t h e d a t a i t e m i n t h e l e f t m o s t p o s i t i o n o f t h e fi r s t word allocated to the data item. Subsequent char a c t e r s a r e p l a c e d i n s u c c e s s i v e p o s i t i o n s t o t h e right. If more than one word is needed, consecu

t i v e w o r d s a r e a l l o c a t e d f r o m l e f t t o r i g h t . T h e unused portion of the last word is not available.

The use of the REDEFINES clause is illustrated in figure 3-24.

SYNCHRONIZED Clause

The SYNCHRONIZED clause causes an elementary data item to start or end on a word boundary within the computer memory. The format of the SYNCHRONIZED

clause is shown in figure 3-25.

This clause can only be used in a data description e n t r y f o r a n e l e m e n t a r y d a t a i t e m . S Y N 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 S Y N C H R O N I Z E D . I f n e i t h e r LEFT nor RIGHT is specified, LEFT is assumed and a warning diagnostic is issued.

Data items are normally packed without regard for machine words. The SYNCHRONIZED clause causes the data item to be allocated as many whole computer words as needed to contain the item. No other data i t e m c a n o c c u p y a n y o f t h e c h a r a c t e r p o s i t i o n s between the leftmost and rightmost word boundaries o f t h e w o r d s a l l o c a t e d t o t h e d a t a i t e m . I f t h e data item does not use all the character positions between the boundaries, the unused character posi

tions are included in:

The size of any group item to which the elemen tary item belongs

The character positions redefined when the data item is referenced in a REDEFINES clause

SYNCHRONIZED RIGHT places the rightmost character o f t h e d a t a i t e m i n t h e r i g h t m o s t p o s i t i o n o f t h e l a s t w o r d a l l o c a t e d t o t h e d a t a i t e m . P r e c e d i n g c h a r a c t e r s a r e p l a c e d i n s u c c e s s i v e p o s i t i o n s t o the left. If more than one word is needed, conse cutive words are allocated to the left. The unused

portion of the first word is not available.

When a COBOL application program references a data item that has been described with the SYNCHRONIZED clause, the original size of the data item is used i n d e t e r m i n i n g a n y a c t i o n t h a t d e p e n d s o n s i z e . T h e o r i g i n a l s i z e o f t h e d a t a i t e m i s t h e s i z e

indicated in the PICTURE clause.

The operational sign in a data item that is synch r o n i z e d a p p e a r s i n i t s n o r m a l p o s i t i o n . T h e L E F T or RIGHT option has no effect on the positioning of the operational sign.

W h e n a n e n t r y i s d e s c r i b e d w i t h b o t h t h e SYNCHRONIZED clause and the OCCURS clause, each o c c u r r e n c e o f t h e d a t a i t e m i s s y n c h r o n i z e d . T h i s a l s o a p p l i e s t o a s y n c h r o n i z e d i t e m t h a t i s s u b ordinate to an entry containing the OCCURS clause.

USAGE Clause

The USAGE clause specifies the internal representa tion of a data item in terms of the primary use of the data item. The format of the USAGE clause is shown in figure 3-26.

Schema Subschema

Example 1

0 1 S T O C K - N U M P I C T U R E * X < 6 ) * .

Example 2

0 3 0 3

S T O C K - N U M P I C T U R E X ( 6 ) . STOCK-ID REDEFINES STOCK-NUM.

0 5 T Y P E - I D P I C T U R E X X . 0 5 C O L O R P I C T U R E X < 4 > .

02 CHARGE-NUM PICTURE v*X(10)#. 02 CHARGE-ID REDEFINES CHARGE-NUM