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 a signed variable to numeric variable

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

New User


Joined: 06 Jul 2011
Posts: 15
Location: india

PostPosted: Sat Jul 23, 2011 5:01 pm    Post subject: Moving a signed variable to numeric variable
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

Active Member


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

PostPosted: Sat Jul 23, 2011 5:08 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Sat Jul 23, 2011 5:39 pm    Post subject: Re: Moving a signed variable to numeric variable
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Sat Jul 23, 2011 6:05 pm    Post subject: Reply to: Moving a signed variable to numeric variable
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

Site Director


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

PostPosted: Sat Jul 23, 2011 6:39 pm    Post subject:
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

Active Member


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

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

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Mon Jul 25, 2011 1:35 am    Post subject: Reply to: Moving a signed variable to numeric variable
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

Site Director


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

PostPosted: Mon Jul 25, 2011 1:56 am    Post subject: Reply to: Moving a signed variable to numeric variable
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Jul 25, 2011 4:59 pm    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Mon Jul 25, 2011 6:46 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Jul 25, 2011 6:54 pm    Post subject: Reply to: Moving a signed variable to numeric variable
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Jul 25, 2011 6:55 pm    Post subject:
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    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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


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