Convert Edit Code (QECCVTEC) API


  Required Parameter Group:

1 Edit mask Output Char(256)
2 Edit mask length Output Binary(4)
3 Receiver variable length Output Binary(4)
4 Zero balance fill character Output Char(1)
5 Edit code Input Char(1)
6 Fill or Floating currency indication Input Char(1)
7 Source variable precision Input Binary(4)
8 Source variable decimal positions Input Binary(4)
9 Error code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: No

The Convert Edit Code (QECCVTEC) API translates an edit code specification into an edit mask, which is a byte string used to format a numeric value into a readable character string.


Authorities and Locks

User-Defined Edit Code Authority
*USE
User-Defined Edit Code Library Authority
*EXECUTE

Required Parameter Group

Edit mask
OUTPUT; CHAR(256)

Returns the edit mask generated by this call. The actual length of the edit mask is returned in the edit mask length parameter. The area beyond the actual length of the edit mask is filled with hexadecimal zeros.

The value returned to this parameter should be passed to the Edit (QECEDT) API or the edit machine instruction.

Edit mask length
OUTPUT; BINARY(4)

The actual length of the edit mask.

The value returned in this parameter should be passed to the QECEDT API or used to substring the value returned in the edit mask in the edit machine instruction.

Receiver variable length
OUTPUT; BINARY(4)

Returns the length of the output that is produced by the returned edit mask when it is used.

The value returned in this parameter should be passed to the QECEDT API or used to substring the receiver variable in the edit machine instruction.

Zero balance fill character
OUTPUT; CHAR(1)

Indicates how to perform the edit so that zero balance suppression is done correctly for those edit codes that have zero balance suppression.

The value returned in this parameter should be passed to the QECEDT API or used to determine whether zero suppression requires special handling before issuing the edit machine instruction.

Edit code
INPUT; CHAR(1)

The edit code that is to be translated into an edit mask. The valid values are:

A-D
J-Q
W
Y-Z
1-9

For more information on edit codes, see the discussion of the EDTCDE keyword in the DDS Reference: Display Files.

Fill or floating currency indication
INPUT; CHAR(1)

Indicates how the output should be padded on the left. This parameter should be specified as follows:

" " Blank fill: All suppressed zeros are replaced with blanks.
"*" Asterisk fill: All suppressed zeros are replaced with asterisks.
Character Blank fill: The specified character is used as a floating currency symbol and placed to the left of the first nonsuppressed digit. Characters are X'41' to X'FE'.

Note: You can optionally specify asterisk fill or floating currency symbol with edit codes 1 through 4, A through D, and J through Q.

Source variable precision
INPUT; BINARY(4)

The precision of the numeric variable that is edited with the edit mask. Precision is the displayed length of a field, not including the decimal point. The valid ranges depend on the value specified for the edit code.

Edit Code Range
W 5-8
Y 3-8
All others 1-31

The precision of the numeric variable depends on its class:

Variable
Class
Precision
Packed The precision for which the variable was declared. For example, PACKED(8,4) has precision 8.
Zoned The precision for which the variable was declared. For example, ZONED(8,4) has precision 8.
Binary(2) 5
Binary(4) 10

Notes:

  1. Some high-level languages limit the maximum precision of packed and zoned numeric variables.
  2. Because the precision of the source variable is so important in creating the edit mask, an edit mask can only be used to edit variables of the exact precision.

Source variable decimal positions
INPUT; BINARY(4)

The number of digits that the source variable precision parameter has placed after the decimal point in the edited output. The value must be less than or equal to source variable precision, but greater than 0. The normal value depends on the class of the source variable precision parameter:

Variable
Class
Decimal
Position
Packed The number of decimal positions for which the variable was declared. For example, PACKED (8,4) has 4 decimal positions.
Zoned The number of decimal positions for which the variable was declared. For example, ZONED (8,4) has 4 decimal positions.
Binary(2) 0
Binary(4) 0

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error Code Parameter.


Error Messages

Message ID Error Message Text
CPF2620 E Field longer than integer or fraction mask.
CPF2639 E Edit mask too large.
CPF27B2 E Edit code not valid.
CPF27B3 E Fill/floating currency indication not valid.
CPF27B4 E Source variable precision not valid.
CPF27B5 E Source decimal position not valid.
CPF3C90 E Literal value cannot be changed.
CPF3CF1 E Error code parameter not valid.
CPF9801 E Object &2 in library &3 not found.
CPF9802 E Not authorized to object &2 in &3.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


API introduced: V2R2
Top | Edit Function APIs | APIs by category