Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Moving partial values from one variable to another

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pradeep.veluvali

New User


Joined: 07 Mar 2005
Posts: 1

PostPosted: Tue Oct 16, 2007 11:06 am    Post subject: Moving partial values from one variable to another
Reply with quote

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
View user's profile Send private message

ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Tue Oct 16, 2007 1:35 pm    Post subject: Reply to: RESULT OF STATMENT Move a, b to c, d
Reply with quote

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
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: Chennai

PostPosted: Tue Oct 16, 2007 2:19 pm    Post subject:
Reply with quote

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
View user's profile Send private message
inamadugu
Warnings : 1

New User


Joined: 23 Aug 2007
Posts: 18
Location: Delhi

PostPosted: Tue Oct 16, 2007 2:57 pm    Post subject: Reply to: RESULT OF STATMENT Move a, b to c, d
Reply with quote

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
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: Chennai

PostPosted: Tue Oct 16, 2007 3:08 pm    Post subject:
Reply with quote

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
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Oct 16, 2007 3:13 pm    Post subject:
Reply with quote

Hemantha,

Quote:
Justify yourself

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
View user's profile Send private message
hemanth.nandas

Active User


Joined: 18 Aug 2007
Posts: 120
Location: Chennai

PostPosted: Tue Oct 16, 2007 3:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ravi.veda

New User


Joined: 30 Mar 2007
Posts: 7
Location: banglore

PostPosted: Tue Oct 16, 2007 5:51 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 16, 2007 5:58 pm    Post subject: Reply to: RESULT OF STATMENT Move a, b to c, d
Reply with quote

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
View user's profile Send private message
ravi.veda

New User


Joined: 30 Mar 2007
Posts: 7
Location: banglore

PostPosted: Tue Oct 16, 2007 5:58 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 16, 2007 6:01 pm    Post subject: Reply to: RESULT OF STATMENT Move a, b to c, d
Reply with quote

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
View user's profile Send private message
ravi.veda

New User


Joined: 30 Mar 2007
Posts: 7
Location: banglore

PostPosted: Tue Oct 16, 2007 8:06 pm    Post subject:
Reply with quote

Hi Ayru,
sory for that.next time i will look all the posts.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Wed Oct 17, 2007 11:45 am    Post subject:
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Oct 17, 2007 5:16 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us