OpenTP1 Version 7 Programming Guide

[Contents][Index][Back][Next]

1.3.1 Coding

Use the C, C++ or COBOL language when coding OpenTP1 UAPs. Not only OpenTP1 facilities, but also standard OS facilities and structured query language (SQL) can be used for OpenTP1 UAPs. For details of the coding rules, see the applicable OpenTP1 Programming Reference manual. For details on the SQL coding rules, see the appropriate reference manual.

Organization of this subsection
(1) Coding in C or C++
(2) Coding in COBOL
(3) Note

(1) Coding in C or C++

(a) When using C

Code the UAP in either the ANSI C format or the pre-ANSI K&R format (Classic C). To use an OpenTP1 facility from the UAP, call the corresponding OpenTP1 library function.

(b) When using C++

Code the UAP in the ANSI C format according to the C++ specification. To use an OpenTP1 facility from the UAP, call the corresponding OpenTP1 library function. Note that linking the UAP coded in C++ causes the OpenTP1 library function to be linked and operated as a C function because the header file (dcxxx.h) specifies that OpenTP1 library functions should be linked to elements written in C.

(c) How to use OpenTP1 functions

As in the case of OS-provided standard functions, when calling functions, set their arguments.

Whether a function has been normally executed can be determined from the return value from the function. Some functions give return values, whereas others do not.

The figure below shows UAP coding in C.

Figure 1-20 Outline of UAP coding in C

[Figure]

(2) Coding in COBOL

COBOL/2# or COBOL85 is available for UAP coding in the COBOL language. To use OpenTP1 facilities from the UAP, use COBOL-UAP creation programs corresponding to OpenTP1 library functions. The COBOL-UAP creation program is called by the CALL statement in COBOL and transfers control from UAP processing to the OpenTP1 library.

The results of CALL statement execution can be identified by the numeric value returned (status code). Some COBOL-UAP creation programs do not return status codes.

The figure below shows UAP coding in COBOL.

Figure 1-21 Outline of UAP coding in COBOL

[Figure]

#
In Base samples, the DATA DIVISION template can be used for each COBOL-UAP creation program. For details on the DATA DIVISION template, see 8.8 COBOL language templates.

(3) Note