MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

move statement doubt

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
rakshith
Beginner


Joined: 26 Jul 2005
Posts: 32
Topics: 16
Location: bangalore

PostPosted: Thu Dec 15, 2005 9:45 am    Post subject: move statement doubt Reply with quote

hi all

I have two group items like,

1 01 A .

02 a1 OCCURS 3 TIMES PIC X(2).
02 a2 OCCURS 3 TIMES PIC 9(1)V9(2)
02 a3 OCCURS 3 TIMES PIC X(2).

2 02 B
02 b1 OCCURS 10 TIMES PIC X(2).
02 b2 OCCURS 10 TIMES PIC 9(1)V9(2).
02 b3 OCCURS 10 TIMES PIC X(2).

I have move A to B , A occurs 3 times and B occurs 10 times

I am using PERFORM statement to move all the variables from 1 by 1 until n times
move a1 to b1
.....
....

can any suggest value of n and why,

thanks in advance,

rakshith
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Dec 15, 2005 10:32 am    Post subject: Reply with quote

rakshith,

What exactly is your question?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Sat Dec 17, 2005 7:03 am    Post subject: Reply with quote

you can just move one by one, no perform necessary:

MOVE A1(1) TO B(1)
MOVE A1(2) TO B(2)
...

etc.

When you use a perform varying for this, you can do something like:

PERFORM VARYING TALLY FROM 1 BY 1 UNTIL TALLY > 3
MOVE A1(TALLY) TO B1(TALLY)
END-PERFORM

But now you are coding the same amount of lines of code. And the performance is less. So this is also not a good way.

If you create a group above the A1, you can transfer a1(1 to 3) in one move to b1 (1 to 3). For example:


01 A .
02 A1-GROUP.

03 a1 OCCURS 3 TIMES PIC X(2).
..

01 B.
02 B1-GROUP.
03 B1 OCCURS 10 TIMES PIC X(2).

IF you move A1-GROUP TO B1-GROEP (1:6), you transfer those 6 bytes in one move into the right place of B.

I guess youi do a study?

1 01 A.

is no COBOL.

01 A.

is.


Regards,

Crox
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Sat Dec 17, 2005 9:31 am    Post subject: Reply with quote

Quote:

you can just move one by one, no perform necessary:

MOVE A1(1) TO B(1)
MOVE A1(2) TO B(2)
...

etc.


Crox,

Why not a simple Move A to B?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Sat Dec 17, 2005 10:47 am    Post subject: Reply with quote

I am afraid you ignore the occurs and the field types. In A there are 3 occurs, in B 10. So expressing the bytes in memory by a string, you have the following situation:

Code:
01 A .
02 a1 OCCURS 3 TIMES PIC X(2).         
02 a2 OCCURS 3 TIMES PIC 9(1)V9(2)     
02 a3 OCCURS 3 TIMES PIC X(2).         
                                       
2 02 B                                 
02 b1 OCCURS 10 TIMES PIC X(2).         
02 b2 OCCURS 10 TIMES PIC 9(1)V9(2).   
02 b3 OCCURS 10 TIMES PIC X(2).         
                                                                       
in memory,
a1 represented by a,
a2 represented by b,
a3 represented by c,

b1 represented by a,
b2 represented by b,
b3 represented by c.
 
01 LEVEL A IN MEMORY looks like:
 
aaaaaabbbbbbbbbcccccc
 
 
01 LEVEL B in MEMORY looks like:
 
aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccc
 
 


A is 21 bytes long. B is 70 bytes long. Moving A to B means that the 21 bytes of A will be transferred to the first 21 bytes of B and the rest will be filled with spaces, which also does not fit with the picture of those fields. So that is probably not what is meant to do!



NB. COBOL is not like PL/I
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group