MOVE is the workhorse data transfer statement in Easytrieve JOB, PROGRAM, and SCREEN logic. Where assignment evaluates expressions, MOVE copies bytes from a sending area to a receiving area—often without type conversion in Format 1, making it ideal for record buffer setup, partial field overlays, and variable-length strings. Format 2 initializes fields with NULL, SPACE, ZEROS, HIGH-VALUES, or LOW-VALUES across multiple targets in one line. SQL nullable fields respond differently to NULL versus SPACE moves. Beginners arriving from COBOL MOVE find similar idioms but must learn Easytrieve length override syntax and FILL padding. This page teaches both formats, send and receive file semantics, RECORD-LENGTH defaults, contrast with operators/move tutorial focus on TO copy, and production patterns for output record construction before WRITE or PUT.
123MOVE send-field-name TO receive-field-name MOVE send-record-name TO receive-record-name [receive-length-field] MOVE send-file-name TO receive-file-name FILL '*'
Send parameter identifies file, record, field, or literal source. Receive parameter identifies destination. Data moves left to right unconverted as alphanumeric. Default send length for file or record is RECORD-LENGTH system field current value.
| Parameter | Role |
|---|---|
| send-file-name / send-record-name | Move entire current record from file |
| send-field-name / send-literal | Move field or constant value |
| send-length-field / send-length-literal | Override bytes moved from send side |
| receive-length-field / receive-length-literal | Override bytes stored on receive side |
| FILL fill-character | Pad right when receive longer than send |
When send area is longer than receive, excess bytes truncate on the right. When receive is longer, default padding is spaces unless FILL specifies another one- or two-byte character. Non-numeric FILL values use quotes. Numeric FILL digits are zoned decimal. Asterisk fill example from Language Reference pads ASTERISK-LINE to all stars for banner output.
1234DEFINE ASTERISK-LINE W 10 A VALUE '==========' PROGRAM NAME MYPROG MOVE ZEROS TO COUNTER-1 COUNTER-2 MOVE '*' TO ASTERISK-LINE FILL '*'
12MOVE {NULL|SPACE|SPACES|ZERO|ZEROS|ZEROES|HIGH-VALUES|LOW-VALUES} TO receive-field-name ...
Format 2 sets one or more receive fields to constant pattern sized to each field defined length. ZEROS to packed field stores packed zero. SPACES to alphanumeric fills blanks. HIGH-VALUES and LOW-VALUES provide mainframe sentinel patterns for interchange and end-of-table markers.
12345FILE PERSNL SQL (PERSONNEL) SQL INCLUDE (EMP#) FROM PERSONNEL LOCATION * NULLABLE MOVE ZEROS TO CTR1 CTR2 MOVE SPACES TO PLINE MOVE NULL TO EMP#
Broadcom example clears counters and line buffer then sets nullable EMP# to SQL NULL. MOVE SPACES or ZEROS to nullable field establishes NOT NULL with blank or zero content. Choose intentionally when exporting to downstream systems that distinguish null from empty.
Use MOVE when copying without calculation: MOVE CUST-NAME TO OUT-NAME. Use assignment for expressions: TOTAL = BASE + BONUS. MOVE Format 1 avoids numeric conversion surprises when overlaying raw record bytes. Assignment applies field type rules during store. Both appear in PROC and JOB logic; shop style guides often standardize zeroing counters with MOVE ZEROS TO for readability matching COBOL heritage.
123456BUILD-OUT. PROC MOVE SPACES TO OUT-REC MOVE IN-KEY TO OUT-KEY MOVE IN-NAME TO OUT-NAME OUT-AMT = IN-AMT * RATE END-PROC
Clear output record then overlay fields. Calculated amount uses assignment because multiplication required. Entire-record MOVE IN-REC TO SAVE-REC snapshots input when field-by-field copy is unnecessary before destructive updates.
When send-file-name is IDMS file, all records in the file move per Language Reference note. Database record availability must exist before MOVE—same rules as other I/O statements referencing current data. SQL table rows follow FILE SQL semantics for nullable includes.
Language Reference highlights MOVE for variable length data strings using length field overrides. Send-length and receive-length let you move portion of record without redefining every subfield in Library—useful for message text and delimited payload extraction paired with PARSE in later statements.
Related MOVE LIKE statement copies field structure patterns per release—see Language Reference when duplicating group layouts between records. Distinct from Format 1 byte transfer; MOVE LIKE targets structural correspondence documented in Programming section.
MOVE is copying from one notebook page to another. Format 1 copies what is written—maybe a whole page or one word. If the new page is bigger, you fill empty space with blanks or stars you choose. Format 2 is stamping every box with the same pattern—all zeros, all spaces, or empty meaning null for special database boxes. Assignment is doing math then writing the answer; MOVE just copies without math.
1. MOVE SPACES TO PLINE:
2. Format 1 MOVE transfers data:
3. FILL on MOVE pads:
4. MOVE NULL TO nullable SQL field:
5. MOVE versus TOTAL = A + B: