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

Can we move a 01 level record another level record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
fredrick andrews

New User


Joined: 10 Jun 2010
Posts: 52
Location: chennai

PostPosted: Tue Jun 12, 2012 12:59 am
Reply with quote

Hi Experts,

Can we move a 01 level record another level record.
Something like the below one ..


I have one record structure like this:

Code:
01  ROOT-RECORD.                                               
 02  X-RECORD-KEY.                                               
    05  X-MAS.                                                   
        10  X-PFXA                        PIC X(4).       
        10  X-PFXB                        PIC X(4).       
  .....
  .....
  .....
 
 
02  X-NEXT-RECORD.                                     
   05  X-NEXT-SECTION.                             
       10  X-KEY                            PIC X(36)
   05  X-THE-SECTION.                             
       10  X-THE-NUMBER.                               
           15  X-PFXA                       PIC X(4).
  .....
  .....
  .....
  .....
 
 
02  X-MAIN-RECORD.                                 
 03  X-MAIN-DATA.                                       
   05  X-MAIN-INFO.                                       
       10  FILLER                             PIC X(18). 
       10  X-MAIN-DATE                 COMP-3 PIC 9(7).   
       10  FILLER                             PIC X(14). 



******

This is the second record structure.

Code:
01  T-MAIN-RECORD.                                     
  03  T-MAIN-DATA.                                       
    05  T-MAIN-INFO.                                         
        10  FILLER                         PIC X(18).   
        10  T-MAIN-DATE                COMP-3 PIC 9(7).   
        10  FILLER                            PIC X(14).




Now, In my program , Can I use something like:

Code:
MOVE    T-MAIN-RECORD      TO      X-MAIN-RECORD





Thanks in advance.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jun 12, 2012 1:04 am
Reply with quote

Yep. No problem at all.

If the subordinate items match up you can always do it with no problem.

If the subordinate items don't match, you can still do the MOVE, but you'll get problems with the data.

Your items all match up, so MOVE away.
Back to top
View user's profile Send private message
fredrick andrews

New User


Joined: 10 Jun 2010
Posts: 52
Location: chennai

PostPosted: Tue Jun 12, 2012 1:35 am
Reply with quote

Thanks a ton Bill...
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Jun 12, 2012 12:33 pm
Reply with quote

PS.: Bill is knowledgable and saved you time but why not just experiment for such things.

Suggest you also search on MOVE CORRESPONDING and spend some time with it.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jun 12, 2012 1:05 pm
Reply with quote

Ah. I have an aversion to MOVE CORRESPONDING :-)

In this case, it looks like one item has been defined to be used in the program but not necessarily not wanting the other data called FILLER, which the CORRESPONDING would ignore. I think it is needed (the stuff in the FILLER) otherwise it would simply be a case of MOVEing the item itself, no need to wonder about the group MOVE.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Jun 12, 2012 1:27 pm
Reply with quote

Bill Woodger wrote:
Ah. I have an aversion to MOVE CORRESPONDING :-)
Why should you and me only deal with the pain, why not share it with OP as well... icon_biggrin.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jun 12, 2012 8:22 pm
Reply with quote

Not sure yet if it is important, but...
when you say:
fredrick andrews wrote:
Can we move a 01 level record another level record.
Something like the below one ..
I have one record structure like this:
Do you mean these variables are declared in the FILE SECTION, or are they in the WORKING-STORAGE SECTION ?
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts How to load to DB2 with column level ... DB2 6
Search our Forums:

Back to Top