Add parameter

Use the Add Parameter page in the Program Call wizard to define a parameter required by the program object or service program object that you want to call. The maximum number of parameters for a service program is 7. Select the Advanced check box to show the advanced attributes for a parameter. You can find more information about each field in the IBM Toolbox for Java information under PCML data tag.

Option Description
Parameter name The name of the parameter. Must be a valid Java variable name.
Data type The type of data being used for the parameter:
character:
Returned as a java.lang.String. The default value for data type is character. This data type takes one byte for each character.
UCS-2/graphics
Returned as a java.lang.String. This data type takes two bytes for each character.
integer:
Returned as a java.lang.Long.
packed decimal:
Returned as a java.math.BigDecimal.
zoned decimal:
Returned as a java.math.BigDecimal.
floating point:
Returned as a java.lang.Float if a length of 4 is specified; otherwise returned as a java.lang.Double for a length of 8.
byte:
Returned as an array of byte values (byte[]). The data is not converted.
structure:
The data type as a structure if the parameter is a structure.
structure name:
The name of the structure. To specify a parameter with the structure data type, define the structure first by clicking Add Structure. If the structure is defined, and you used the structure data type, a list of structure names is shown in the Structure name field.
Length The length that the parameter requires. See Values for length and precision. You can enter a numeric or select a value from the drop-down list. Values in the list are data elements of type int that are referenced by your program.
Precision The number of bytes of precision for some numeric data types. See Values for length and precision.
Count The size of the array. If Count is left blank, the parameter is not defined as an array, although it may be defined as an element of a structure that is defined as an array.
Usage The usage of the parameter (character and numeric types are converted):
input:
Input to the host program.
output:
Output from the host program. Character and numeric types are converted.
input & output:
Both input and output. This is the default value.
inherit:
Usage is inherited from the parent element. If the structure has no parent, usage becomes input & output.
Initial value An initial value for the parameter, if it is not explicitly set by the application program when the usage of the parameter is input or input & output. See the init attribute in PCML data tag.
Output size The number of bytes to reserve for output data for the parameter. This field should be left blank for fixed size output parameters. See the outputsize attribute in PCML data tag.
Trim

Trimming of white space from character data:

right:
Trim trailing white spaces. This is the default.
left:
Trim preceding white spaces.
both:
Trim both preceding and trailing white spaces.
none:
Do not trim white spaces.
Bidi string type The bidirectional string type for parameter with data type character. See the bidistringtype attribute in PCML data tag.
Min. version The lowest version of iSeries on which this element exists. See the minvrm attribute in PCML data tag.
Max. version The highest version of iSeries on which this element exists. See the maxvrm attribute in PCML data tag.
Offset The offset to the element within an output parameter. See the offset attribute in PCML data tag.
Offset from The base location from which the offset attribute is relative. See the offsetfrom attribute in PCML data tag.
CCSID The host Coded Character Set ID for the character data type parameter. If this field is left blank, the default CCSID of the host environment is used. See the ccsid attribute in PCML data tag.
Passed by How the parameter is passed. (Only for service program call parameters)
reference:.
The parameter is passed by reference. When the program is called, the program is passed a pointer to the parameter value.
value:
The parameter is passed by an integer value. This value is allowed with the integer data type and a length of 4.

Click Specify to add parameters from a physical or logical data file, which has file type PF-DTA, LF, PF38-DTA or LF38. See Specify database reference field.

If your parameter was created in the Specify Database Reference Field window, you can update or list properties:

Click Synchronize to include the changes that were made to the data file after the parameter was created.

Click Show to list the data properties of the field in the data file when the parameter was created.

Specify database reference field

Allows you to add parameters from field definitions of a data file.

  1. If you have not defined a connection to your iSeries server, expand New Connection to define a connection; otherwise, expand the connection that you want to browse for database fields.
  2. If you want to browse a database from your logon profile library list, expand *LIBL; otherwise, expand Your libraries to create a new library filter string.
  3. Expand the library that you want to browse.
  4. Expand the file and the record.
  5. You can select a record and click Add to add all the fields in the record as parameters, or you can select one or more fields to add as parameters.
  6. Click Close to close the dialog. The parameters created for you are shown in the tree view.

Values for length and precision

The length and precision attributes have different values for each data type. The following table lists each data type with a description of the possible values for length and precision.

character The number of characters for this parameter. Not applicable
UCS-2/graphics The number of characters for this parameter. Not applicable
integer The number of bytes for this parameter Indicates the number of bits of precision and whether the integer is signed or unsigned.
2 bytes Use precision 15 for a signed 2-byte integer (default).

Use precision 16 for an unsigned 2-byte integer

4 bytes Use precision 31 for a signed 4-byte integer.

Use precision 32 for an unsigned 4-byte integer.

8 bytes Use precision 63 for a signed 8-byte integer.
packed decimal or zoned decimal The number of digits of data for this parameter. The number of decimal digits for the parameter. This number must be greater than or equal to zero and less than or equal to the total number of digits specified in the length field.
floating point The number of bytes for this parameter: 2, 4, or 8. Not applicable
byte The number of bytes of data for this parameter. Not applicable
structure Not allowed Not applicable

The following table shows the corresponding length and precision for integer declaration in an RPG program:

3 byte 1 Not applicable
5 integer 2 15 for signed, 16 for unsigned
10 integer 4 31 for signed, 32 for unsigned
20 integer 8 63 for signed

The following table shows the corresponding length and precision for integer declaration in a COBOL program:

PIC 9(1) to PIC 9(4) integer 2 15
PIC 9(5) to PIC 9(9) integer 4 31
PIC 9(10) to PIC 9(18) integer 8 63
Related tasks
Calling an iSeries program from your Java application
Related reference
PCML data type values for languages and Web components
Data type conversion from database reference