REPOSITORY paragraph for defining a class
Use the REPOSITORY
paragraph
to declare
to the compiler that the specified words are class-names when you
use them within a class definition, and to optionally relate the class-names
to the corresponding external class-names (the class-names as they
are known outside the compilation unit).
Environment Division. Required
Configuration Section. Required
Repository. Required
Class Base is "java.lang.Object" Required
Class Account is "Account". Optional
The REPOSITORY
paragraph entries
indicate that the external class-names of the classes referred to
as Base and Account within the class definition are java.lang.Object
and Account, respectively.
REPOSITORY
paragraph,
you must code an entry for each class-name that you explicitly reference
in the class definition. For example: - Base
- A superclass from which the class that you are defining inherits
- The classes that you reference in methods within the class definition
In
a REPOSITORY
paragraph entry, you
must specify the external class-name if the name contains non-COBOL
characters. You must also specify the external class-name for any
referenced class that is part of a Java package.
For such a class, specify the external class-name as the fully qualified
name of the package, followed by period (.
), followed
by the simple name of the Java class.
For example, the Object class is part of the java.lang package, so
specify its external name as java.lang.Object as shown above.
An external class-name that you specify in
the REPOSITORY
paragraph must be an alphanumeric
literal that conforms to the rules of formation for a fully qualified Java class-name.
If you do not include the external class-name
in a REPOSITORY
paragraph entry, the external class-name
is formed from the class-name in the following manner:
- The class-name is converted to uppercase.
- Each hyphen is changed to zero.
- The first character, if a digit, is changed:
- 1-9 are changed to A-I.
- 0 is changed to J.
- Underscores are not changed.
In the example above, class Account is known externally as Account (in mixed case) because the external name is spelled using mixed case.
You can optionally include in the REPOSITORY
paragraph
an entry for the class that you are defining (Account in this example).
You must include an entry for the class that you are defining if the
external class-name contains non-COBOL characters, or to specify a
fully package-qualified class-name if the class is to be part of a Java package.
Example: external class-names and Java packages
REPOSITORY paragraph (Enterprise COBOL for z/OS® Language Reference)
The Java Language Specification (Identifiers)
The Java Language Specification (Packages)