IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

MOVE CORRESPONDING verb


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Hema Madhavi
Warnings : 2

New User


Joined: 24 Dec 2005
Posts: 3
Location: Hyderabad

PostPosted: Tue Jan 31, 2006 12:26 pm
Reply with quote

Hi all,

Pls let me know if this will work perfectly.

01 A
05 B
05 C
05 D

01 E
05 F

01 G
05 H

01 I
05 I

A,E,G,I are copy books
A is made by combining E,G,I (B,C,D)

B and F have the same structure
C and H have the same structure
D and I have the same structure


Now can i give
Move corresponding F to B
Move corresponding H to C
Move corresponding I to D

will it not give any complication errors.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Feb 01, 2006 2:05 am
Reply with quote

Hi Hema Madhavi,

I believe you have missed the principals of move corresponding. First here is the content from the IBM COBOL manual for the CORRESPONDING phrase.


Quote:
The CORRESPONDING (CORR) phrase allows ADD, SUBTRACT, and MOVE operations
to be performed on elementary data items of the same name if the group
items to which they belong are specified.


Both identifiers following the keyword CORRESPONDING must name group
items. In this discussion, these identifiers are referred to as
identifier-1 and identifier-2.


A pair of data items (subordinate items), one from identifier-1 and one
from identifier-2, correspond if the following conditions are true:


° In an ADD or SUBTRACT statement, both of the data items are elementary
numeric data items. Other data items are ignored.


° In a MOVE statement, at least one of the data items is an elementary
item, and the move is permitted by the move rules.


° The two subordinate items have the same name and the same qualifiers
up to but not including identifier-1 and identifier-2.


° The subordinate items are not identified by the keyword FILLER.


° Neither identifier-1 nor identifier-2 is described as a level 66, 77,
or 88 item, nor is either described as a USAGE IS INDEX item. Neither
identifier-1 nor identifier-2 can be reference-modified.


° The subordinate items do not include a REDEFINES, RENAMES, OCCURS, or
USAGE IS INDEX clause in their descriptions.


However, identifier-1 and identifier-2 themselves can contain or be
subordinate to items containing a REDEFINES or OCCURS clause in their
descriptions.


x ° Neither identifier-1 nor identifier-2 nor the two subordinate items
x are described as USAGE IS POINTER items.


x ° Identifier-1 and/or identifier-2 can be subordinate to a FILLER item.


For example, if two data hierarchies are defined as follows:


| 05 ITEM-1 OCCURS 6 TIMES INDEXED BY X.
10 ITEM-A PIC S9(3).
10 ITEM-B PIC +99.9.
10 ITEM-C PIC X(4).
10 ITEM-D REDEFINES ITEM-C PIC 9(4).
10 ITEM-E USAGE COMP-1.
10 ITEM-F USAGE INDEX.
05 ITEM-2.
10 ITEM-A PIC 99.
10 ITEM-B PIC +9V9.
10 ITEM-C PIC A(4).
10 ITEM-D PIC 9(4).
10 ITEM-E PIC 9(9) USAGE COMP.
10 ITEM-F USAGE INDEX.


Then, if ADD CORR ITEM-2 TO ITEM-1(X) is specified, ITEM-A and ITEM-A(X),
ITEM-B and ITEM-B(X), and ITEM-E and ITEM-E(X) are considered to be
corresponding and are added together. ITEM-C and ITEM-C(X) are not
included because they are not numeric. ITEM-D and ITEM-D(X) are not
included because ITEM-D(X) includes a REDEFINES clause in its data
description. ITEM-F and ITEM-F(X) are not included because they are
defined as USAGE IS INDEX. Note that ITEM-1 is valid as either
identifier-1 or identifier-2.


If any of the individual operations in the ADD CORRESPONDING statement
produces a size error condition, imperative-statement-1 in the ON SIZE
ERROR phrase is not executed until all of the individual additions are
completed.


In the MOVE CORRESPONDING you specify two group items as in the example below. The elemental items within the group item are ?CORRESPONDING?, basically, if the names are the same. Check the documentation for the exact CORRESPONDING rules.


Code:

    01  GROUP-A.
        05  A
        05  B
        05  D
        05  E

    01  GROUP-B.
        05  A
        05  B
        05  C
        05  E

    MOVE CORRESPONDING GROUP-A TO GROUP-B.

        Is equivalent to:

    MOVE A OF GROUP-A    TO A OF GROUP-B.
    MOVE B OF GROUP-A    TO B OF GROUP-B.
    MOVE E OF GROUP-A    TO E OF GROUP-B.



In the example above, when you do the MOVE CORRESPONDING GROUP-A to GROUP-B, nothing will be moved to D of GROUP-A because there is no ?CORRESPONDING? name in GROUP-B, and C of GROUP-B will not be moved because there is no ?CORRESPONDING? name in GROUP-A.

Does this help? If not please come back.

Dave[/quote]
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts How to move DB2 Installation HLQ DB2 4
No new posts How to move values from single dimens... COBOL Programming 1
This topic is locked: you cannot edit posts or make replies. regarding COBOL WRITE verb (VB File H... COBOL Programming 9
Search our Forums:

Back to Top