View previous topic :: View next topic
|
Author |
Message |
pradeep.veluvali
New User
Joined: 07 Mar 2005 Posts: 1
|
|
|
|
I have 2 variables
A PIC X (2).
B PIC X (2002).
I need to move the last 2 digits of variable ‘B’ in to the variable ‘A’.
How will you do it? |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Quote: |
Sorry, I got wrong. Please ignore the first post.
It should be
MOVE 'B(2001:2)' TO 'A'. |
Why are you using quotes?
KSK |
|
Back to top |
|
|
hemanth.nandas
Active User
Joined: 18 Aug 2007 Posts: 120 Location: India
|
|
|
|
HI Inamadugu,
Quote: |
MOVE 'B(2004:2)' TO 'A'.
Is there any another method to do this? |
Do you mean It? Read the post properly.
It will be
Code: |
MOVE B(2001:2) TO A. |
|
|
Back to top |
|
|
inamadugu Warnings : 1 New User
Joined: 23 Aug 2007 Posts: 18 Location: Delhi
|
|
|
|
Hi Hemanth,
I have already posted the answer what you have quoted. Please see the next post send by me. The first post was an accident.
Now another thing what KSK asked is why I used quotes?
KSK,
I used quotes because it is an alphanumeric item. If anything wrong please let me know. |
|
Back to top |
|
|
hemanth.nandas
Active User
Joined: 18 Aug 2007 Posts: 120 Location: India
|
|
|
|
Hi Inmadugu,
Quote: |
I used quotes because it is an alphanumeric item. If anything wrong please let me know |
Just I posted that clarify you about Move Syntax. Again you are asking a question.
Murali told you to check syntax of Move Verb, had you gone through it? I hope, No. And KSK asked to you "why are you using quotes".
Justify yourself, Where you are wrong? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Hemantha,
We use quotes for moving constant values (alpha or alphanumeric). But for the requirement you are moving from var to var. Moreover your destination (A) according to your post is a constant not a var (memory allocation).
Just let us know, if you need anymore info on this. And also go thru the manual one more time. |
|
Back to top |
|
|
hemanth.nandas
Active User
Joined: 18 Aug 2007 Posts: 120 Location: India
|
|
|
|
Hi Murali,
Quote: |
We use quotes for moving constant values (alpha or alphanumeric). But for the requirement you are moving from var to var. Moreover your destination (A) according to your post is a constant not a var (memory allocation). |
Thanks for your explanation, but as per var declared in this POST I moved the same to Var (A). I know syntax Rules of Move command, thats why, I replied for Inmadugu's Reply. I don't know how you understood this.
Thanks for good explanation. |
|
Back to top |
|
|
ravi.veda
New User
Joined: 30 Mar 2007 Posts: 7 Location: banglore
|
|
|
|
MOVE 'B(2004:2)' TO 'A'.
i think the above one is wrong,
MOVE B(2000:2) to A
bcz he want to move 2001,2002 to A.
RF = (starting position:total length)[/i]
Regards,
veda. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
ravi,
Quote: |
MOVE B(2000:2) to A
bcz he want to move 2001,2002 to A. |
Did you refer to the manuals? |
|
Back to top |
|
|
ravi.veda
New User
Joined: 30 Mar 2007 Posts: 7 Location: banglore
|
|
|
|
ravi.veda wrote: |
MOVE 'B(2004:2)' TO 'A'.
i think the above one is wrong,
MOVE B(2001:2) to A
bcz he want to move 2001,2002 to A.
RF = (starting position:total length)[/i]
Regards,
veda. |
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Ravi,
Please read all the posts on the topic before posting as this was already answered by hemanth.
Anyways you are correct this time.
There is one more way to move the last 2 digits.
Code:
Code: |
MOVE B(2001:) TO A. |
|
|
Back to top |
|
|
ravi.veda
New User
Joined: 30 Mar 2007 Posts: 7 Location: banglore
|
|
|
|
Hi Ayru,
sory for that.next time i will look all the posts. |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Inamadugu,
Quote: |
KSK,
I used quotes because it is an alphanumeric item. If anything wrong please let me know.
|
If u want to move a string, u can use quotes to move total string to another variable. But in this case u want to move value of sending field but not string and also u were using quotes for receiving field which was again wrong.
KSK |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Code: |
01 A PIC X(02).
01 B.
05 FILLER PIC X(2000).
05 B-OFFSET-2000-FOR-2 PIC X(02).
|
Code: |
MOVE B-OFFSET-2000-FOR-2
TO A.
|
|
|
Back to top |
|
|
|