PACK

PACK Syntax Diagram

Effect

Places the character field f in packed format in the field g. Reverse of the UNPACK statement.

Example

DATA C_FIELD(4) TYPE C VALUE '0103', 
	 P_FIELD(2) TYPE P. 
PACK C_FIELD TO P_FIELD. 

C_FIELD: C'0103' --> P_FIELD: P'103C'

Note

Catchable runtime error

BCD_FIELD_OVERFLOW: Overflow while converting (type P with specified length.

BCD_OVERFLOW: Overflow while converting (type P).

CONVT_NO_NUMBER: Source field cannot be interpreted as a number.

CONVT_OVERFLOW: Overflow while converting (all types except type P).

Non-catchable runtime error

BCD_BADDATA: Source field (type P) does not contain a correct BCD format.