Previous Topic: UsageNext Topic: More Information


Examples

Minimum RECORD statement for an uncompressed record

The following example supplies the minimum RECORD statement required for an uncompressed record to be a valid schema component:

add record name is employee
    location mode is calc using emp-id
        duplicates are not allowed
    within area emp-demo-region.
    02  emp-id pic xxxx.

Minimum RECORD statement for a fixed-length compressed record

The following example supplies the minimum RECORD statement required for a fixed-length, compressed record to be a valid schema component:

add record name is job
    location mode is calc using job-id
        duplicates are not allowed
    within area org-demo-region
    procedure name idmscomp is used for compression
    procedure name idmsdcom is used for decompression
    02  job-id pic xxxx.

The above example specifies procedures to call to compress and decompress the JOB record. By default, the schema compiler supplies a minimum root length and fragment length for the record. Note that you can also compress and decompress a record by using CA IDMS Presspack.

Specifying a record synonym

The following example specifies a synonym for a record named DENTAL-CLAIM to be used by an Assembler program (for which record names must not be longer than eight characters):

add record name is dental-claim
    location mode is via coverage-claims set
    within ins-demo-region area
    record synonym name for assembler is dntlclm.

Specifying an area percentage offset

Logical area, EMP-DEMO-REGION, has been defined to physical areas within the PROD and TEST segments. PROD.EMP-DEMO-REGION contains 1000 pages, numbered 1 through 1000, with an additional 500 pages (1001 through 1500) reserved for extending the physical area. TEST.EMP-DEMO-REGION contains 100 pages, numbered 1501 through 1600.

Record EMPLOYEE is defined to EMP-DEMO-REGION as follows:

add record name is employee
  within area emp-demo-region
  offset 25 percent for 75 percent.

Using the percentage offset specified for the EMPLOYEE record, the runtime system calculates the low and high pages for the record in the initial page range of PROD.EMP-DEMO-REGION:

For TEST.EMP-DEMO-REGION, the first and last usable page is:

When you extend PROD.EMP-DEMO-REGION by 500 pages (page 1 through 1500) using the percentage offsets specified for the EMPLOYEE record, the runtime system calculates the record's low and high pages in the extended page range:

CA IDMS/DB will store occurrences of the EMPLOYEE record on pages numbered 251 through 1375 in the PROD.EMP-DEMO-REGION area. If the record's location mode is CALC, the record will continue to target to its initial page range of 251 through 1000 and overflow, if necessary, into the extended pages 1001 through 1375.

Specifying a relative page offset for an area

In the following example, physical area ORG-DEMO-REGION in segment PROD contains 240 pages, numbered from 2001 through 2240. The schema description of the DEPARTMENT record is:

add record name is department
    within area org-demo-region
        offset 2 pages for 238 pages.

Using the offset specified for the DEPARTMENT record, the runtime system calculates the low and high pages for the record as:

CA IDMS/DB will store occurrences of the DEPARTMENT record on pages numbered 2003 through 2240 in the PROD.ORG-DEMO-REGION area.

Modifying a record by adding new routines

In the next example, schema record EMPREC is modified by adding two routines to handle errors that occur when a record is obtained or stored. The code must respecify the PROCEDURE name clauses for the standard compression and decompression routines because of the new CALL clauses.

modify record name is emprec
  procedure name is idmscomp is used for compression
  procedure name is idmsdcom is used for decompression
  call errrtn on error during store
  call errget on error during get.