Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Arguments and event values of Java methods

Structures are used to transfer arguments and result values between the COBOL program and JCI functions which call Java methods or edit Java data fields. These must contain all the necessary information. The structures are defined in the COPY elements JCI-METHODARGS and JCI-METHODRES (see sections "JCI-METHODARGS - Function arguments" and "JCI-METHODRES - Function result"). In this chapter they are referred to as MethodArg or MethodRes.

If nothing else is defined in the function descriptions, the following prerequisites apply for calling functions which reference an argument of the type MethodArg or MethodRes:

  • Arguments

    Before the function is called, the CallArgNum field must contain the number of arguments to be transferred.

    For each argument, an element of the CallArg table must be supplied with values in the structure.

    In the ArgType field, the condition name ARG-... which corresponds to the COBOL data type must be set.The address of a Cobvar or CobNvar structure must be specified for strings. If trailing spaces are to be ignored, IGNORE-TRAILING-SPACES must also be set. Other arguments must be transferred directly into the structure.

  • Result values

    For result values, the condition name which corresponds to the COBOL data type RES-... must be set in the ResType field, or RES-VOID if no return value is expected. If a string is expected as the return value, the address of a Cobvar or CobNvar structure must be specified with a maximum length for the data area in the ResValAddr field. If the length <=0, the result value is not transferred.

    After returning from the function, a Cobvar or CobNvar structure referenced as a return value contains the number of transferred characters (maximum entry value) in the length field, and the transferred characters in the data area. For other data types, the return value is transferred directly into the structure.

If an exceptional situation occurred during the conversion of a floating point data field or string object, the ResErrCode field contains the corresponding error code after returning from the function. This can be inquired by means of the condition variable RES-ERR-<condition> (see sections "Characters and strings" and "Floating point numbers"). If an argument was incorrect (RETURN-CODE RET-ERR-EARGUMENT), the ResErrIndex field contains the number of the argument.

The table below provides an overview of the definitions and the corresponding COBOL and Java types. For COBOL types whose name begins with 'JCI-', a type definition exists in the COPY element JCI-TYPEDEF. A '*' in the last column specifies that automatic conversion of the argument or result value will take place in the JCI functions.

Java type

COBOL type
or TYPEDEF

Variable
ResVal ...,
ArgVal ...

Condition name
RES- ..., ARG- ...


String

Structure CobVar
Structure CobNVar

Addr

ANUM-STRING
NAT-STRING

*

byte

JCI-byte

Byte

BYTE


char

PIC X

Achar

ANUM-CHAR

*

char

PIC N

Nchar

NAT-CHAR


boolean

JCI-boolean

Boolean

BOOLEAN


short

JCI-short

Short

SHORT


int

JCI-int

Int

INT


long

JCI-long

Long

LONG


float

USAGE COMP-1

Float

FLOAT

*

double

USAGE COMP-2

Double

DOUBLE

*

Java object (also string object)

JCI-object

Object

OBJECT