The Single Stub Generation function provides the option to generate single stub subprograms (interface objects) online by using a stub generation window where you either type in the parameter definitions required or read them in from an existing subprogram.
This section covers the following topics:
This section provides instructions for generating single stub subprograms (interface objects) by using the Single Stub Generation function.
To generate a single stub subprogram
In the SYSRPC - Remote Procedure Call window, from the Tools menu, choose Single Stub Generation.
Or:
In the SYSRPC - Remote Procedure Call window,
press CTRL+F8.
The Input for Stub Generation dialog box appears.
In the Name text box, enter the name of the stub subprogram to be generated.
The name of the stub subprogram must be identical to the name of the
remote CALLNAT
program.
If required, in the Library text box, enter the name of the library into which you want to generate the stub subprogram. The text box is preset to the name of the current library.
DBID, FNR is a non-modifiable text box that
displays the database ID (DBID), the file number (FNR) and the type of Natural
file (FNAT
= system, FUSER
= user) for the specified
library.
From the Compression drop-down list box, select compression type 0, 1 or 2 (default is 1); see Using Compression described in Operating a Natural RPC Environment in the Natural Remote Procedure Call (RPC) documentation.
Choose OK.
If the name entered in the Name text box corresponds to the name of an object that already exists in the specified library, a window appears with an appropriate message:
Choose Yes if you want to modify existing
parameter definitions. If the specified name is identical to a cataloged object
of the type subprogram, the Stub Generation window appears
where the parameters definitions of the respective subprogram are contained in
a table. If the specified name is identical to a stub subprogram for which also
a source object exists, all field attributes (see also
Specifying
Parameters) from a previous stub generation are retained.
Otherwise, all field attributes are set to M
(modifiable).
Or:
Choose No if you want to create
new parameter definitions. The Stub Generation window
appears with empty table cells.
Note that you can still keep old definitions, even after you have entered new values if you abort execution by choosing Cancel.
If the name entered in the Name box does not correspond to the name of an object contained in the specified library, an empty Stub Generation window appears.
In the Stub Generation window, add or modify the parameters to be used in the stub subprogram: Enter a value or select it from a drop-down list box as described in Specifying Parameters.
Choose OK to generate the stub subprogram and to exit the Stub Generation window.
A window appears which confirms that the stub subprogram is generated into the specified library. In addition, the window indicates the size the stub subprogram requires for sending data from the client to the server or vice versa. The size includes internal RPC information used for the stub subprogram. The indication of the size helps you configure the middleware layer used; for example, the Broker attribute file when EntireX Broker is used.
The following message appears in the window when you generate a stub subprogram from the example subprogram TESTS5 (see Example 1 below):
Stub TESTS5 is generated in library TEST It requires: Send length: 2249 bytes Receive length: 2221 bytes
If dynamic parameters, X-arrays or X-group arrays are used, this message only indicates the minimum length requirements. The actual length requirements can only be determined during program execution and may be different from call to call.
If the Send length
or the Receive
length
exceeds the Entire Net-Work limit of 32000 bytes, a window
appears with a corresponding warning:
Choose Y (Yes) to continue, or N (No) to cancel the generation.
If you choose Y (Yes), this setting is kept for the entire SYSRPC session, that is, you can continue generating stub subprograms without receiving further warnings.
If the total data (without internal RPC information) sent or received exceeds the limit of 1073739357 bytes (which is 1 GB minus 2467 bytes of internal RPC information), SYSRPC stops processing and issues a corresponding error message. This error message displays the subtotal of the data in bytes that could be transferred at the field up to which the subtotal was calculated. The corresponding field is then marked. In this case, reduce the amount of data and then continue generating the stub subprogram.
If the stub subprogram was generated in the Natural system library SYSRPC, you must move the stub subprogram to the application library or steplib using the Natural transfer utility SYSMAIN or the Object Handler. Note that you may have to recatalog the source of the stub subprogram in the target environment.
In the table cells provided in the Stub Generation window, you can enter the parameter definitions that are used in the stub subprogram (interface object). You can specify a maximum of 5000 parameters. Unless indicated in the table below, input in the boxes is mandatory.
Field | Description |
---|---|
Level |
The level of the field. A level can be a number in the range from See also Defining Groups and Example 2 for an example of a group definition. |
Attribute |
The attribute of the parameter:
Parameters assigned a level number of If a stub subprogram has been generated from a subprogram, the attribute is If a stub subprogram has been generated from another stub subprogram, the attribute values specified for the original stub subprogram are retained. The generated stub subprogram contains a comment that indicates the
attribute specified for the parameter: |
Type |
A Natural data format such as For a description of Natural data formats, see Format and Length of User-Defined Variables and Special Formats in the section User-Defined Variables in the Programming Guide. |
Length |
The length of the parameter or This field does not apply to the following Natural data formats:
The Natural data format |
Precision |
Only applies to Natural data formats The precision of the parameter, that is, the number of digits after the decimal point. |
Dimension ½/3 | Only applies to arrays. Optional.
The first, second and third dimension of the parameter. An X-array or an X-group array is specified by entering an asterisk (*) for a dimension. See also Defining X-Arrays and X-Group Arrays. |
The section below contains information on:
You only need to define a group structure for a client Natural object that calls a non-Natural object located on an EntireX RPC server. The group structure must correspond to the IDL definition in EntireX. A group structure is not required for a client Natural object that calls a subprogram located on a Natural RPC server.
Group arrays and X-group arrays passed from a client Natural object to a stub subprogram must be contiguous. Therefore, we strongly recommend that you always pass a complete array to the stub subprogram by using asterisk (*) notation for all dimensions. We also strongly recommend that you use identical data definitions in the client Natural program, the stub subprogram and the server program.
Warning: Any group definitions in a subprogram will be ignored when a stub subprogram is generated from this subprogram. In this case, you must define the group again on the Stub Generation screen and adapt the dimension of the group elements accordingly. (Dimensions defined within a group are propagated to the parameter definitions at a lower level.) If you generate a stub subprogram from another stub subprogram that contains a group, the group definitions will be retained. |
See also Example 2 for an example of a group definition.
If any dimension of a parameter is extensible, all other dimensions of the parameter are also extensible. If you define extensible and fixed dimensions for a parameter in a subprogram, the stub generation function issues a warning and automatically changes the fixed dimension to an extensible dimension as demonstrated in Example 3. In a group structure, you can define either an extensible or a fixed dimension for each level. There is no automatic change of a fixed dimension to an extensible dimension between levels.
Natural RPC only supports extensible upper bounds. All X-arrays and
X-group arrays in the generated DEFINE DATA PARAMETER
area of the
stub subprogram are therefore defined as (1:*)
.
Warning: If you generate a stub subprogram from a subprogram that contains an X-array or X-group array with an extensible lower bound, the extensible lower bound will be converted to an extensible upper bound. |
For an example of a group with an extensible dimension, see Example 3.
This section provides examples of Natural subprograms and the stub subprograms (interface objects) generated from them.
The parameter definitions indicated below are extracted from example subprograms, which are supplied in the Natural system library SYSRPC.
The following DEFINE DATA PARAMETER
area (example
subprogram TESTS5) shows four modifiable parameters and the corresponding
parameter definitions in the Stub
Generation window:
DEFINE DATA PARAMETER 01 #IDENTIFIER (A10) 01 #N-OF-ID (I4) 01 #FREQ (P5.2) 01 #A100 (A100/5,4)
Stub Generation | ||||||||
---|---|---|---|---|---|---|---|---|
Level | Attribute | Type | Length | Precision | Dimension 1 | Dimension 2 | Dimension 3 | |
1 | 01 | M | A | 10 | ||||
2 | 01 | M | I | 4 | ||||
3 | 01 | M | P | 5 | 2 | |||
4 | 01 | M | A | 100 | 5 | 4 |
The following DEFINE DATA PARAMETER
area (example
subprogram TESTS6) shows a nested group structure and the corresponding
parameter definitions in the Stub
Generation window:
DEFINE DATA PARAMETER 01 GROUP-1(10) 02 A (A20) 02 B (A20) 02 GROUP-2(20) 03 C (A10/5) 03 D (A10) 01 LINE (A) DYNAMIC
Stub Generation | ||||||||
---|---|---|---|---|---|---|---|---|
Level | Attribute | Type | Length | Precision | Dimension 1 | Dimension 2 | Dimension 3 | |
1 | 01 | M | G | 10 | ||||
2 | 02 | M | A | 20 | ||||
3 | 02 | M | A | 20 | ||||
4 | 02 | M | G | 20 | ||||
5 | 03 | M | A | 10 | 5 | |||
6 | 03 | M | A | 10 | ||||
7 | 01 | M | A | DYNAMIC |
The following DEFINE DATA PARAMETER
area (example
subprogram TESTS7) shows a nested group structure with extensible dimensions
and the corresponding parameter definitions in the
Stub Generation window.
DEFINE DATA PARAMETER 01 GROUP-1(10) 02 A (A20) 02 B (A20) 02 GROUP-2(0:*) 03 C (A10/5) 03 D (A10) 01 LINE (A) DYNAMIC
Stub Generation | ||||||||
---|---|---|---|---|---|---|---|---|
Level | Attribute | Type | Length | Precision | Dimension 1 | Dimension 2 | Dimension 3 | |
1 | 01 | M | G | 10 | ||||
2 | 02 | M | A | 20 | ||||
3 | 02 | M | A | 20 | ||||
4 | 02 | M | G | * | ||||
5 | 03 | M | A | 10 | 5 | |||
6 | 03 | M | A | 10 | ||||
7 | 01 | M | A | DYNAMIC |