PCML data type values for languages and iSeries Web components

The values that you select for data types in the Web Interaction or Program Call wizards are Program Call Markup Language (PCML) values. PCML provides a uniform way to specify values or types regardless of the ILE or OPM language being used. For example, the definition for an integer in RPG is I and the definition in C++ is int. In PCML you specify an integer as int regardless of the language being used. The Web Interaction wizard writes the PCML code that interacts with your ILE and OPM objects.

In the Web Interaction or Program Call wizards you need to enter the PCML data type values that match your language data types. The tables below indicate the language data types and their corresponding PCML values. For example, to use a 5-digit integer as one of the parameters in your RPG program, you specify the data type as int, the length as 2, and the precision as 15 in the wizards.

Note that the meanings of length and precision are dependent on the data type in use. For example, for an integer, the length attribute refers to the number of bytes required to hold a value; for packed, length refers to the number of digits in the number. Similarly, for int, precision refers to the number of bits required for the number (this allows PCML to determine if it is a signed or an unsigned value). For packed, precision refers to the number of decimal places required.

When specifying the attributes for data types in iSeries Web components, you can choose numeric or character as the data types. For numeric data types, length refers to the number of digits and decimal refers to the number of decimal places. For example, a number such as 12345.67 would be length 7 and decimal 2. For character data types, length refers to the number of characters.  Float values in the iSeries Web components are data type character, with length of 14 or 23 to correspond to single and double precision, respectively.

Click on the links below to view the tables equating RPG, C/C++, and COBOL data types with PCML values.

Table 1. RPG data types and equivalent PCML values
Description of Data Type RPG Definition DB Data Type PCML Values in the Web Interaction wizard and the Program Call wizard PCML Values in iSeries Web components (Text Entry and Label attributes)
Character  (fixed length) A A

character
length  = number of bytes
(1 byte per character)

Character
Character (variable length) A (varying) VARLEN

Supported in the Program Call wizard.
Not supported in the Web Interaction wizard.

Not Supported
Indicator N

A
length 1

character
length = 1

Character

Binary 2 bytes (1-4)
Binary 4 bytes (5-9)

B B Not Supported Not Supported
Float 4 bytes (single precision) F F

float
length = 4 (bytes)

Character
length = 14 characters (4 bytes)
(e.g. 10E3)

Float 8 bytes (double precision) F

For 8 bytes use
FLTPCN(*DOUBLE)

float
length = 8 (bytes)

Character
length = 23 characters (8 bytes)
(e.g. 10E3)

Integer 1 byte = 3 digits I (use 0 decimals) None Not Supported Not Supported
Integer 2 bytes = 5 digits I (use 0 decimals) None

integer
length = 2 (bytes)
precision = 15 (bits)

Numeric
editcode/editword supported

Integer 4 bytes = 10 digits I (use 0 decimals) None

integer
length = 4 (bytes)
precision = 31 (bits)

Numeric
editcode/editword supported

Integer 8 bytes = 20 digits I (use 0 decimals) None

integer
length = 8 (bytes)
precision = 63 (bits)

Numeric
editcode/editword supported

Packed
number of digits
number of decimal places

P P

packed decimal
length = number of digits
precision = number of decimal places

Numeric
editcode/editword supported

Zoned decimal
number of digits
number of decimal places

S S

zoned decimal
length = number of digits
precision = number of decimal places

Numeric
editcode/editword supported

Unsigned 2 bytes = 5 digits

U
(use 0 decimals)

None

integer
length = 2 (bytes)
precision = 16 (bits)

Numeric
editcode/editword supported

Unsigned 4 bytes = 10 digits

U
(use 0 decimals)

None

integer
length = 4 (bytes)
precision = 32 (bits)

Numeric
editcode/editword supported

Unsigned 8 bytes = 20 digits

U
(use 0 decimals)

None Not Supported Not Supported
Date D L Not Supported Not Supported
Time T T Not Supported Not Supported
TimeStamp Z Z Not Supported Not Supported
Graphic (fixed) G G

character
length = number of bytes
(2 bytes per character)

Not Supported
Graphic (variable)

G
(varying)

G
VARLEN

Not Supported Not Supported
Pointer * None Not Supported Not Supported
Procedure Pointer

*
(ProcPTR)

None Not Supported Not Supported
Data structure containing subfields DS None structure Not Supported
Table 2. C/C++ data types and equivalent PCML values
C++ Data Type PCML Data Type Structure definition Length Precision Count

char[n]
char*

char
char

-

n
n

- -
char char - 1 - -
wchar_t[n] char - n - -

_Packed struct
{short i,
char[n]}

struct

<struct>
<data name="i" type="int" length="2"/>
<data name="text" type="char" length="n"/>
</struct>

- - -
short int int - 2 15 -
unsigned short int int - 2 16 -
int int - 4 31 -
unsigned int int - 4 32 -
long int int - 4 31 -
unsigned long int int - 4 32 -
long long int - 8 63 -
struct {unsigned int: n}x Not Supported - - - -
float float - 4 - -
double float - 8 - -
long double float  - 8 - -
enum Not Supported - - - -
_Decimal T<n,p> packed - n p -
union.element Not Supported - - - -
dataType[n] type - - -

n
(count = size of array)

struct or class struct - - - -
pointer to function Not Supported - - - -
pointer Not Supported - - - -
Table 3. COBOL data types and equivalent PCML values
COBOL Data Type COBOL Format PCML Data Type Length Precision Count
Character X(n) character n - -
  A(n) character n - -
  X(n) OCCURS DEPENDING ON m structure - - m
  A(n) OCCURS DEPENDING ON m structure - - m
Numeric 9(n) DISPLAY zoned decimal n 0 -
  S9(n-p) V9(p) DISPLAY zoned decimal n p -
 

9(n-p) V9(p)
PACKED-DECIMAL

See Note 3
packed decimal n p -
 

S9(n-p) V9(p)
PACKED-DECIMAL

See Note 3
packed decimal n p -
 

9(4) BINARY

See Notes 1, 2
integer 2 16 -
 

S9(4) BINARY

See Notes 1, 2
integer 2 15 -
 

9(9) BINARY

See Notes 1, 2
integer 4 32 -
 

S9(9) BINARY

See Notes 1, 2
integer 4 31 -
 

9(18) BINARY

See Notes 1, 2
integer 8 63 -
 

S9(18) BINARY

See Notes 1, 2
Not Supported - - -
  9(31) BINARY Not Supported - - -
  S9(31) BINARY Not Supported - - -
  USAGE COMP-1 float 4 - -
  USAGE COMP-2 float 8 - -
UCS2

N(n)

See Note 4
UCS-2/graphics n - -
 

N(n) OCCURS DEPENDING ON m

See Note 4
structure - - m
Graphic G(n) UCS-2/graphics n - -
  G(n) OCCURS DEPENDING ON m structure - - m
Index USAGE INDEX integer 4 31 -
Boolean 1 Not Supported - - -
Date FORMAT DATE Not Supported - - -
Time FORMAT TIME Not Supported - - -
Timestamp FORMAT TIMESTAMP Not Supported - - -
Pointer USAGE POINTER Not Supported - - -
Procedure Pointer PROCEDURE - POINTER Not Supported - - -
Notes:
  1. To reduce truncation, specify NOSTDTRUNC on the PROCESS statement. NOSTDTRUNC should always be specified when passing BINARY data items.
  2. BINARY, COMP-4, and COMPUTATIONAL-4 are equivalent and map to the same PCML.
  3. PACKED-DECIMAL, COMP-3, COMPUTATIONAL-3, COMP, and COMPUTATIONAL are equivalent and map to the same PCML unless COMPASBIN PROCESS option is specified. See PROCESS Statement Options for more information.
  4. PIC N is a National (UCS2) item if USAGE NATIONAL is specified or if USAGE is not specified and the NATIONAL compiler option is specified, otherwise USAGE DISPLAY-1(DBCS) is implied.