Data Manipulation Verbs

MOVE Statement

The function of this verb is simply to transfer the data or duplicating the data from one storage location to another.

Format:

MOVE (data name TO (List of data names). Constant

Sending field =====>> Receiving field

Note:

Receiving field should have the greater length from the Sending field.

Examples:

MOVE A TO B. MOVE 975 TO C. MOVE 'LAHORE' TO ADRS. MOVE SPACES TO ABC, PQR, KLM. MOVE ZEROSES TO KLM.

CORRESPONDING Option in MOVE Statement CORR

Format:

MOVE CORR (Group item 1) TO (Group item 2)

Example:

01 PAY-REC. 02 GROSS PIC 9(4)V99. 02 NET PIC 9(4)V99. 02 TAXES PIC 999V99. 01 EDITED-REC. 02 GROSS PIC 9999.99. 02 TAXES PIC 999.99. 02 NET PIC 9999.99. PROCEDURE DIVISION. 786. MOVE CORR PAY-REC TO EDITED-REC.

Note:

Only the same data names of both records will be incorporated.
PROCEDURE DIVISION Page

INSPECT Statemant

When the individual character in a field is toexamine, test or replace such verb helps in COBOL. It has various formates according to the requirements.

Formats:

1. INSPECT (field name) REPLACING LEADING (literal) BY (lit.) e.g. INSPECT AMT REPLACING LEADING 'b' BY ZEROES. 2. INSPECT (field name) REPLACING ALL (Literal) BY (literal). e.g. INSPECPT AMT REPLACING ALL ZEROES BY SPACES. 3. INSPECT (field name) REPLACING FIRST (literal) BY (literal). e.g. INSPECT AMT REPLACING FIRST 0 BY '+'. 4. INSPCET (data name) TALLYING (data name 1) FOR ALL (Literal). e.g. INSPECT AMT TALLYING COUNT FOR ALL '$' 5. INSPECT (data name) TALLYING (data name 2) FOR CHARACTERS BEFORE (literal).

Note:

This counts the number of characters in a field (data name. e.g. INSPECT ADRS TALLYING COUNT FOR CHARACTERS BEFORE SPACE. INSPECT (data name) REPLACING ALL'/' BY '-' ALL 'a' BY 'A' .... This changes the data of data name - where /, A where a, and so on.

Important

PROCEDURE DIVISION Page

TRANSFORM, STRING and UNSTRING statements are in progress


PROCEDURE DIVISION Page