View previous topic :: View next topic
|
Author |
Message |
Vijay Subramaniyan
New User
Joined: 06 Jul 2011 Posts: 14 Location: india
|
|
|
|
hI all,
I want to move a variable X with PIC 9V9(4) to a variable Y with PIC 9(5).
When I tried , it didnt get moved . .Kindly provide a solution how I can achieve this .
X PIC 9V9(4) VALUE ZERO.
Y PIC 9(5) VALUE ZEROES. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
1. Your subject says "signed variable," yet neither are.
2. They are also both numeric.
3. Review other postings to see what info you must provide:
a. the initial and final values of each variable (decimal and hex)
b. the MOVE statement
c. what your intent is, since your PIC's are incompatible
Also, you must show your code (data and procedure) as-is using the code tag so we know what you really tried, now just what you thought you tried or wanted to try. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Vijay Subramaniyan wrote: |
hI all,
I want to move a variable X with PIC 9V9(4) to a variable Y with PIC 9(5).
When I tried , it didnt get moved . .Kindly provide a solution how I can achieve this .
X PIC 9V9(4) VALUE ZERO.
Y PIC 9(5) VALUE ZEROES. |
Vijay, it does work.
Of course, if you have any value less than one in X, it will look like it doesn't work, because there is no room in Y for the decimal part and the integer part is zero, so Y will end up with a new value, zero, same as the original, zero.
We need to know what you are trying to do. Please answer Ph... Phil's questions if you are still unclear. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. if you actually coded a MOVE X TO Y in your program, then indeed X was moved to Y.
2. the only values of X that will 'appear to be moved' to Y are those greater than 0.9999,
since Y can only will contain values in the integer range of > 1 and < 100000.
But X can only contain integer values in the range of =>1 and <10
or: 1, 2, 3, 4, 5, 6, 7, 8, 9.
e.g. if X contains 0.9999
MOVE X TO Y
will result in Y = 00000.
My apologies to Bill for my post. Saw his after I posted mine (took a while to edit and perfect my thesis).
but i decided to leave mine anyway,
as it seems the TS has made no attempt to understand the implication of PIC clauses. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
No worries, dbz. Mine was less complete.
Maybe he just wants a REDEFINES anyway? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
I suspect it will help if TS will explain what DID happen (yes, it did get moved, though most likely NOT with the result intended) and what was the desired outcome. . . .
I.E - when it works, what value should be in Y? |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
As usual, we talk amongst ourselves. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
but at lest we understand each other |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Usually. . . . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
At least when we don't, it doesn't take five back-forward posts to clarify.
Also little things like "I don't understand", "sorry, I got that wrong", "my fault", etc, not using "terminology" just because it sounds cool, all those little things, about good communication, help. When we have a problem, we acknowledge it is a problem, not something that just "happened" and we were in the same room at the time. We don't try to imagine what the problem is, and then get the facts to fit the picture. 93.758% of the time, to two decimal places, it is just a simple error from some sort of code, usually that we have written, or from the data.
Rats. I could go on, but no-one is reading by now... |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Bill Woodger wrote: |
93.758% of the time, to two decimal places |
Now, are we going to use COBOL rounding rules for that computation? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
That was the example of the "simple mistake".
I could imagine all sorts of weird things to explain such an event, overlapping memory, new version of the compiler, someone with a magnet standing too close to the CPU etc, but when it comes down to reality, and when I start from the "correct" end, I very soon see the mistake of thinking I am using two places, when in fact I've defined it with three.
A lot of the time with this type of problem, just the act of telling someone else what you think is going on will show one the answer without any further hassle.
"Ah, dang, I see it. Thanks for you help" - and all you did is sit there and look inscrutable. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Since you are still there Vijay, why don't you pop back and let us know how this is going? |
|
Back to top |
|
|
|