View previous topic :: View next topic
|
Author |
Message |
fredrick andrews
New User
Joined: 10 Jun 2010 Posts: 52 Location: chennai
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
fredrick andrews
New User
Joined: 10 Jun 2010 Posts: 52 Location: chennai
|
|
|
|
Thanks a ton Bill... |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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... |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
|