Previous Topic: MOVE (Format I)

Next Topic: ON-DB-ERROR

MOVE (Format II)

The purpose of the format II MOVE statement is to allow data with different lengths to transfer between fields of a database record/element or an internal work area, with justifying and/or padding capability.

MOVE Statement (format II)

   *DM  MOVE     {field-name | work-area | literal}
   *DM               OFFSET xxxxx LENGTH nnnnn
   *DM       TO  {field-name | work-area}  OFFSET xxxxx LENGTH nnnnn
   *DM         [JUSTIFY {RIGHT | LEFT}
   *DM          PAD  {ZEROES | SPACES | literal}].
Parameters:
field

name Name of a database record field.

work

area Name of a DATAMACS-WORK-AREA field.

literal

Any alphanumeric, numeric, hexadecimal data.

OFFSET

Points to a location within the field, relative to 0, where the move should begin.

LENGTH

Actual length of the data to be moved.

JUSTIFY

If the receiving field is longer than the sending field, specify where the data should be placed. If not specified, then LEFT will be assumed.

PAD

Specifies what type of data to use to fill the unmoved portion of the receiving field, when the receiving field is longer than the sending field.

Programming Notes:

The database records from different tables are held in memory in their own work area. When transferring a field from one database table record to another, it is not necessary to move it to a work area first.