View previous topic :: View next topic |
Author |
Message |
kxsarn Beginner
Joined: 04 May 2003 Posts: 4 Topics: 3
|
Posted: Sun May 04, 2003 10:40 am Post subject: How does this work? |
|
|
I want to know how does this work ? Can any one throw some light?
I have a variable structure declaration like this.
01 var-str1.
05 var1 pic 9(4) comp.
05 var2 pic x(3).
05 var3 pic 9(3) comp-3.
01 var-temp pic x(7).
01 var-str2.
05 var4 pic 9(4) comp.
05 var5 pic x(3).
05 var6 pic 9(3) comp-3.
in Procedure division
move var-str1 to var-temp.
move var-temp to var-str2.
but var-str2 has correct values.
I was of the thought that , for comp-3 and comp fields , only the system bothers about allocating the number of bytes and while moving 9(3) comp-3 to a display variable then it has to be of the type s9(3).
But how the above code works?
Sara |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Sun May 04, 2003 3:03 pm Post subject: |
|
|
Hi Sara,
I'm not sure of what you mean by:
Quote: |
...only the system bothers about allocating the number of bytes
|
When you say:
Quote: |
while moving 9(3) comp-3 to a display variable then it has to be of the type s9(3)
|
do you mean "var-temp"?
Here's what I do know and it might answer all your ques.
All your moves are group moves. A feature of group moves is that NO data conversions are attempted, so its a GIGO scenerio. Whatever your sending field contained will appear in the receiving field, as is, regardless of how the sending/receiving elementary items are defined.
HTH, Jack. |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Mon May 05, 2003 12:19 am Post subject: |
|
|
What I understand is that moving data from one variable to another will never cause problem. Problem occurs when you try display/compute that data.
In this case problem will occur if you try to display var-temp, since it will contain non displayable data. Otherwise everything looks okay.
Diba. |
|
Back to top |
|
|
Glenn Beginner
Joined: 23 Mar 2003 Posts: 56 Topics: 3
|
Posted: Mon May 05, 2003 1:32 am Post subject: |
|
|
moves of group variables are considered to be X moves, so basically the group variables are defined by default to be X(whatever the size of the group). Nothing is wrong in this code since the size of each group is 7 bytes. |
|
Back to top |
|
|
kxsarn Beginner
Joined: 04 May 2003 Posts: 4 Topics: 3
|
Posted: Mon May 05, 2003 11:05 am Post subject: |
|
|
Thanks a lot for all your replies. I got it cleared.
Sara |
|
Back to top |
|
|
|
|