Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Regarding : Move Corresponding

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Wed Jan 12, 2011 5:13 pm    Post subject: Regarding : Move Corresponding
Reply with quote

Hi ,

about the Corresponding Move , does this move happens based on line number as well . For Example
I have 2 files having the same copybook layout

File 1 - cpybk1 (rec len 1200)
File 2 - cpybk2 ( rec len 1300)

I am doing a Corresponding move from file1-rec to file2-rec for a group item A , however in File 1
03 group A ( position starts at 10 )
05 C
05 D

In File 2 ,
same level starts at position 15 ,
03 group B ( position at 15)
05 C1
05 C2
Now When i use Move Corr file-rec1 to file-rec2 , what would be the result.

I wanted to understand the scenarios in which the move happens.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Jan 12, 2011 6:23 pm    Post subject:
Reply with quote

There is a link to manuals at the top of the page. You would be wise to click on it, find the COBOL Language Reference manual, and read it for awhile so you can answer questions like this yourself without asking a forum. The answer to your question is that nothing you have listed in your post would be moved. The reason is in the rules but I'll let you figure out which rule(s) apply:
Quote:
6.1.8.1 CORRESPONDING phrase



The CORRESPONDING (CORR) phrase causes ADD, SUBTRACT, and MOVE operations to be performed on elementary data items of the same name if the alphanumeric group item or national group item to which they belong is specified. A national group is processed as a group item when the CORRESPONDING phrase is used.

Both identifiers that follow the keyword CORRESPONDING must name group items. In this discussion, these identifiers are referred to as identifier-1 and identifier-2. identifier-1 references the sending group item. identifier-2 references the receiving group item.

Two subordinate data 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, and neither is described as an index data item. Neither identifier-1 nor identifier-2 can be reference-modified.

Neither identifier-1 nor identifier-2 is described with USAGE POINTER, USAGE FUNCTION-POINTER, USAGE PROCEDURE-POINTER, or USAGE OBJECT REFERENCE.

The subordinate items do not include a REDEFINES, RENAMES, OCCURS, USAGE INDEX, USAGE POINTER, USAGE PROCEDURE-POINTER, USAGE FUNCTION-POINTER, or USAGE OBJECT REFERENCE clause in their descriptions.
However, identifier-1 and identifier-2 themselves can contain or be subordinate to items that contain a REDEFINES or OCCURS clause in their descriptions.


The name of each subordinate data item that satisfies these conditions is unique after application of implicit qualifiers.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Wed Jan 12, 2011 6:34 pm    Post subject:
Reply with quote

So easy to test.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 12, 2011 9:25 pm    Post subject:
Reply with quote

Hello,

And after you are through testing, remove the "corresponding" from the code. . .

Many organizations will not permit code with a "move corresponding" to be promoted to production. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jan 13, 2011 1:05 pm    Post subject:
Reply with quote

MOVE CORR
is a lazy way to code and leads to errors
and as Dick has pointed out, many sites inhibit the use of this form of MOVE.

Moreover,
someone who writes like
Job1919 wrote:
For Example
I have 2 files having the same copybook layout

File 1 - cpybk1 (rec len 1200)
File 2 - cpybk2 ( rec len 1300)

??same copybook layout? cpybk1 and cpybk2, different record lengths?

who obviously does not proof what he/she writes,
is someone who should develop skills set to generate (via Edit Macro)
the appropriate MOVEs instead of relying on MOVE CORR.
Back to top
View user's profile Send private message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Mon Jan 17, 2011 10:58 am    Post subject:
Reply with quote

Here`s the reason for posting this .

I have a input file of different rec-len (1240) & the output file rec-len( 1300) . There is a corresponding move for a subordinate data items from file 1- file2 . The problem the output file contains Junk.

However the subordinate data item1 of file1<cpybk1> starts from pos 105 whereas the subordinate data items of file2 < cpybk2> starts from pos 150.
So after running the program , I get junk / bad data in to the output file. I am suspecting the culprit as corresponding move.
I might be wrong , so wanted to take experts opinion on this .

Thanks
job1919
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jan 17, 2011 11:24 am    Post subject:
Reply with quote

Hello,

A move corresponding will not generate "junk" values . . .

Either the junk value(s) exist in the input or the output did not receive the value(s) from the input - one of the reasons to not use a corresponding move.

Run a test moving all '9' to the output record before the move corresponding and see if the "junk" is replaced with 9's. If the 9's are in the output, the data was not moved from the input. If the junk is still in the output, the input has junk.
Back to top
View user's profile Send private message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Mon Jan 17, 2011 12:34 pm    Post subject:
Reply with quote

thanks for the suggestion dick ,

I ll test it now..

thanks
job1919
Back to top
View user's profile Send private message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Mon Jan 17, 2011 12:40 pm    Post subject:
Reply with quote

Yeah I got it now!! thanks moderators for the suggestions / help.

The rec len mismatch is the culprit. when i moved 9`s in to o/p file , and dia corresp move , upto position 104 it was fine but after that there is a mismatch in the items and hence bad data..

thanks all.

job1919
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jan 18, 2011 3:07 am    Post subject: Reply to: Regarding : Move Corr
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
Back to top
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Wed Feb 09, 2011 4:57 pm    Post subject: Reply to: Regarding : Move Corr
Reply with quote

On the mainframe there is a compile-option to punch the assembler code. Use this to see if the "move corr" behaves like expected. You do not have to be a system-programmer to figure it out.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Feb 09, 2011 8:10 pm    Post subject:
Reply with quote

Hello,

Why might one want to "punch" the assembler code? Surely a listing would be sufficient. . .

Keeping in mind that "move corresponding" is usually NOT the best choice. . .
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Feb 09, 2011 8:18 pm    Post subject:
Reply with quote

MOVE CORRESPONDING can have side effects many years down the road when someone changes the data structure for a new (or revised) requirement, and suddenly the program is not working correctly since some of the data is no longer being moved. As Dick said, you are almost always better off NOT using MOVE CORRESPONDING -- and many sites do not permit its use.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts Need information on COBOL MOVE CORRES... subratarec COBOL Programming 10 Tue Jun 28, 2016 10:38 pm
No new posts how to move view the remote file in o... mailtoashok CICS 2 Fri Feb 12, 2016 1:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us