The MOVE statement transfers data, in accordance with the rules of editing, to one or more data areas.
Format 2:Move Corresponding
literal-1 or the data item referenced by identifier-1 represents the sending area; identifier-2 (. . .) represents the receiving area (or areas).
An index data item must not appear as an operand of a MOVE statement.
The data designated by literal-1 or identifier-1 is moved to the data item referenced by each identifier-2 in the order in which it is specified.The rules referring to identifier-2 also apply to the other receiving areas. Any length evaluation or subscripting associated with identifier-2 is evaluated immediately before the data is moved to the respective data item.Any length evaluation or subscripting associated with identifier-1is evaluated only once, immediately before data is moved to the first of the receiving operands.The result of the statementMOVE a (b) TO b, c (b)
is equivalent to:MOVE a (b) TO temp
Any move in which the receiving operand is an elementary item and the sending operand is either a literal or an elementary item is an elementary move.Every elementary item belongs to one of the following categories:numeric, alphabetic, alphanumeric, numeric edited or alphanumeric edited.These categories are described in the PICTURE clause. Numeric literals belong to the category numeric, and nonnumeric literals belong to the category alphanumeric.The figurative constant ZERO, when moved to a numeric or numeric edited item, belongs to the category numeric; in all other cases, it belongs to the category alphanumeric. The figurative constant SPACE belongs to the category alphabetic.All other figurative constants belong to the category alphanumeric.
The following rules apply to an elementary move between these categories:
Any necessary conversion of data from one form of internal representation to another takes place during legal elementary moves, along with any de-editing implied by the sending data item or editing specified for the receiving data item:
When an unsigned numeric item is the receiving item, the absolute value of the sending item is moved and no operational sign is generated for the receiving item.
When the sending operand is described as being alphanumeric, data is moved as if the sending operand were described as an unsigned numeric integer.
When a numeric edited data item is the sending item, conversion is implied to establish the unedited numeric value of the operand, which may be signed; then the unedited numeric value is moved to the receiving field.The implied conversion deletes all characters other than the decimal digits 0, 1, . . . 9, sets the operational sign negative if a minus sign is present in the sending item or positive otherwise, and sets the scale according to the rightmost decimal point present in the sending item or to the scale of the sending data item otherwise.The representation of the decimal point used in this conversion is a period unless the DECIMAL POINT IS COMMA clause is specified in the source program, in which case a comma is used.In this conversion, any decimal digit 0 that matches an inserted character 0 in the sending item is excluded from the resulting unedited numeric value.
If the size of the sending item is greater than the size of the receiving item, the excess characters are truncated on the right after the receiving item is filled.
Any move that is not an elementary move is treated exactly as if it were an alphanumeric to alphanumeric elementary move, except that there is no conversion of data from one form of internal representation to another.In such a move, the receiving area is filled without regard for the individual elementary or group items contained within either the sending or receiving area, except as noted in the OCCURS clause.When a group item is moved to an elementary item described with the JUSTIFIED RIGHT clause, right justification occurs. When a sending and receiving item share a part of their storage areas, the result of the execution of such a statement is undefined.
Table summarizes the legality of the various types of MOVE statements.
Types of MOVE Statements and Their Legality
When the CORRESPONDING phrase is specified, all identifiers must refer to group items.When a MOVE statement with a CORRESPONDING phrase specifies more than one receiving group item (identifier-2), the effect is the same as if multiple MOVE statements with CORRESPONDING phrases had been written, one for each of the receiving group items (identifier-2), and each having the same sending group item (identifier-1).
For the MOVE statement with the CORRESPONDING phrase:
For each individual MOVE statement with a CORRESPONDING phrase, subordinate data item pairs are selected, one from the sending group item and one from the receiving group item.Then for each such selected pair, data movement occurs from the data item that is subordinate to the sending group item to the data item that is subordinate to the receiving group item.The data movement that occurs is the same as if individual MOVE statements had been written for each of the selected pairs.
The rules that govern the selection of eligible subordinate data item pairs are as follows:
When multiple receiving group identifiers (id entifier-2, . . .) are listed, all corresponding items in the first identifier-2 are moved prior to moving corresponding items in the second and any subsequent receiving group identifiers.
CORRESPONDING and CORR are synonymous.
MOVE Statement Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.