IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Moving a signed variable to numeric variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vijay Subramaniyan

New User


Joined: 06 Jul 2011
Posts: 14
Location: india

PostPosted: Sat Jul 23, 2011 5:01 pm
Reply with quote

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

Senior Member


Joined: 31 Oct 2006
Posts: 1050
Location: Richmond, Virginia

PostPosted: Sat Jul 23, 2011 5:08 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jul 23, 2011 5:39 pm
Reply with quote

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.

Code:
MOVE X TO Y


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

Global Moderator


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

PostPosted: Sat Jul 23, 2011 5:45 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jul 23, 2011 6:05 pm
Reply with quote

No worries, dbz. Mine was less complete.

Maybe he just wants a REDEFINES anyway?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat Jul 23, 2011 6:39 pm
Reply with quote

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

Senior Member


Joined: 31 Oct 2006
Posts: 1050
Location: Richmond, Virginia

PostPosted: Sun Jul 24, 2011 6:26 pm
Reply with quote

As usual, we talk amongst ourselves.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Mon Jul 25, 2011 1:35 am
Reply with quote

but at lest we understand each other icon_cool.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Mon Jul 25, 2011 1:56 am
Reply with quote

Usually. . . . icon_wink.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 25, 2011 4:59 pm
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Mon Jul 25, 2011 6:46 pm
Reply with quote

Bill Woodger wrote:
93.758% of the time, to two decimal places

Now, are we going to use COBOL rounding rules for that computation? icon_biggrin.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 25, 2011 6:54 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 25, 2011 6:55 pm
Reply with quote

Since you are still there Vijay, why don't you pop back and let us know how this is going?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts REXX/CMS How to place command console... CLIST & REXX 4
No new posts CA7 count with DATE variable CA Products 0
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
Search our Forums:

Back to Top