Format 8: SET for length of dynamic-length elementary items

When this format of the SET statement is executed, the length of the dynamic-length elementary item in the receiver is set to the value of the sending item.

Format 8: SET for length of dynamic-length elementary items

Read syntax diagramSkip visual syntax diagramSETLENGTH OFidentifier-1TO identifier-2integer-1
  • identifier-1 must be a dynamic-length elementary item.
  • identifier-2 must be an elementary numeric integer item.
  • integer-1 must be an integer greater than or equal to zero.
If identifier-2 is less than zero then the length of identifier-1 is set to zero.

If identifier-2 or integer-1 is less than the current length of identifier-1, then the length of identifier-1 is set to the specified value and identifier-1 is truncated on the right.

If identifier-2 or integer-1 is longer than the current length of identifier-1, then the length of identifier-1 is set to the specified value, no padding occurs, and the newly available character positions on the right are not initialized.