UNPACK
Basic form
UNPACK f TO g.
Effect
Unpacks the packed field f and places it in the field
g with leading zeros. If g is too short, it is truncated on the left.
Example
DATA: P_FIELD(2) TYPE P VALUE 103,
C_FIELD(4) TYPE C.
UNPACK P_FIELD TO C_FIELD.
P_FIELD: P'103C' --> C_FIELD: C'0103'
Notes
-
If f is not type P,
it is converted to type P (see MOVE).
-
g should always be type C. Otherwise, unwanted side effects may occur.
-
The sign in the packed number is ignored.
Catchable Exceptions
CX_SY_ASSIGN_OUT_OF_RANGE
-
Cause:
Overflow during conversion (type P)
Runtime Error: BCD_FIELD_OVERFLOW (catchable)
CX_SY_CODEPAGE_CONVERTER_INIT
-
Cause: Source field cannot be interpreted as a number
Runtime Error: CONVT_NO_NUMBER (catchable)
CX_SY_CONVERSION_NO_NUMBER
-
Cause: Overflow during conversion (all types except type P)
Runtime Error: CONVT_OVERFLOW (catchable)
CX_SY_CONVERSION_OVERFLOW
-
Cause:
Overflow during conversion (type P)
Runtime Error: BCD_OVERFLOW (catchable)
Non-Catchable Exceptions
-
Cause: Source field (type P)
does not contain a valid BCD format
Runtime Error: BCD_BADDATA