• Aucun résultat trouvé

DATA CONVERSION FROM VMS COBOL

Dans le document OIL User Reference Manual AA-M581 (Page 155-158)

VMS DATA CONVERSION

CHAPTER 9 VMS DATA CONVERSION

9.1 DATA CONVERSION FROM VMS COBOL

The information included in this section assumes:

-You are writing a COBOL program

-You plan to use the program on a VMS system

To store an FFD, pass a record or perform an error check, you must represent several data items in your program. Users generally allocate space for foreign fields and records in WORKING-STORAGE.

9.1.1 Including the Interface Support Files

On VMS systems, there are two different classes of Interface Support files for each supported language. The first class of files includes native VMS-type names for each of the various codes for VMS COBOL and VMS FORTRAN. The second class includes files with TOPS-IO/TOPS-20 COBOL compatible names for VMS COBOL, and files which include ANSI Standard names for the interface to VMS FORTRAN. The Interface Support files for VMS are provided as a text library called DIL.TLB.

This library includes the support files for both VMS COBOL and VMS FORTRAN.

Native VMS COBOL

You can use the COBOL COPY verb to retrieve information from DIL.TLB at compilation time. There are three library elements for Native VMS COBOL in DIL.TLB. The elements are DIL$COBOL, DIT$COBOL, and DIX$COBOL.

The library element DIL$COBOL defines general codes and names applicable to the Data Conversion Routines, the Task-to-Task Routines and the Remote File Access Routines. The general success status code (SS-NORMAL) is defined in element DIL$COBOL. Severity codes and system codes are defined in element DIL$COBOL. To define these names in your program, include the following statement in your WORKING-STORAGE section after an Ol-level declaration:

COpy DIL$COBOL OF "SYS$LIBRARY:DIL.TLB".

VMS DATA CONVERSION

The library element DIX$COBOL defines codes specific to the Data Conversion Routines. These codes include the DIX status codes which are standard VMS condition values. Also included are data type names for each supported data type. To define these names in your program, include the following statement in your WORKING-STORAGE section after an Ol-level declaration as described above for the DIL$COBOL element:

COPY DIX$COBOL OF "SYS$LIBRARY:DIL.TLB".

For programs which use the Data Conversion Routines with native VMS TOPS-IO/TOPS-20 compatible COBOL in DIL.TLB. The DIL$COBOL_20, DIT$COBOL_20, and DIX$COBOL_20.

from DIL.TLB elements for elements are The library element DIL$COBOL 20 defines general codes and names applicable to the Data Conversion Routines, the Task-to-Task Routines and the Remote File Access Routines. The general success status code (SS-NORMAL)is defined in element DIL$COBOL 20. Severity codes and system codes are defined in element DIL$COBOL-20. To define these names in your program, include the following statement in your WORKING-STORAGE section after an Ol-level declaration:

COPY DIL$COBOL 20 OF "SYS$LIBRARY:DIL.TLB".

In the following example, the DIL$COBOL_20 element of the library is retrieved and included in your program:

01 Interface-files.

COPY DIL$COBOL 20 OF "SYS$LIBRARY:DIL.TLB".

The library element DIX$COBOL 20 defines codes specific to the data conversion routines. The codes include the DIX status codes in the compatible COBOL format which provides only the condition identification portion of the status code. Also included are data type names for each supported data type. To define these names in your program, include the following statement in your WORKING-STORAGE section after an Ol-level declaration as shown above for the DIL$COBOL 20 element:

COPY DIX$COBOL 20 OF "SYS$LIBRARY:DIL.TLB".

For programs which use the compatible names, you must DIX$COBOL 20 library elements.

data conversion routines with

include both the DIL$COBOL 20 the and

VMS DATA CONVERSION 9.1.2 Storing an FFD

The FFD occupies three full longwords of VMS memory. To store an FFD you must define a data item with the following format:

01 your-ffd.

03 your-ffd-tbl PIC S9(9) USAGE COMPUTATIONAL OCCURS 3.

When you call the DIX$MAK DES DET routine to build the FFD, use your-ffd-tbl as the FFD- to be returned. To pass the FFD to the routine, pass your-ffd-tbl with the subscript 1: your-ffd-tbl (1).

9.1.3 Passing a Record to the DIX$MAK_DES_DET Routine

To pass a record to the DIX$MAK DES DET routine, you must know how the record (containing the field- that you want to convert) would be declared on its native system. You must then represent the record in your program on the local system. The record can be represented as any word-aligned group level data item. To pass the record to DIX$MAK DES DET, specify this group item as the record name ("rec") in the call to-DIX$MAK_DES_DET.

To figure the size of the record, count the number of bits on its native system: make the record name on the foreign system at least that large. In the following example, the VAX/VMS record "rec"

contains 640 bits of information.

01 rec PIC S9(9) USAGE COMPUTATIONAL OCCURS 20 TIMES.

To pass "rec" to the DIX$MAK_DES_DET routine simply include it in your call to the routine.

CALL "DIX$MAK DES DET" USING ffd (1), rec, sysor, bysiz, byoff, bioff, type,-lngth, scale GIVING stat.

9.1.4 Checking for Errors

A call to the Data Conversion Routines from VMS COBOL looks like the following example:

CALL "DIX$MAK DES DET" USING ffd (1), rec, sysor, bysiz, byoff, bioff, type,-lngth, scale GIVING stat.

"Stat", used above, is a standard VMS condition value and should be defined as:

01 stat PIC S9(9) USAGE COMPUTATIONAL.

The routine performs the error check and places the resultant status value into the data item stat. The following example shows a simple error check:

CALL "DIX$MAK DES DET" USING ffd (1), rec, sysor, bysiz, byoff,

VMS DATA CONVERSION

On VMS systems, the LIB$MATCH COND function is available to compare two status codes and determine if they refer to the same condition.

See the most recent version of the VAX-II Run-Time Library Reference Manual for further information.

Using LIB$MATCH COND, you can compare "stat" to the DIX status values defined in the DIL Interface Support files to identify which error occurred.

NOTE

If you are using the TOPS-lO/TOPS-20 Compatible COBOL Interface Support files, you cannot use LIB$MATCH COND to compare the status codes. Use the error checking procedure described in the TOPS-lO/TOPS-20 COBOL section of this manual.

Dans le document OIL User Reference Manual AA-M581 (Page 155-158)

Documents relatifs