View previous topic :: View next topic
|
Author |
Message |
kumarramky
New User
Joined: 04 Aug 2006 Posts: 5
|
|
|
|
Hi there,
Can you please let me know how to pass VAR1 9(5) value to VAR2 S9(5).
My declaration is:
VAR1 PIC 9(5) VALUE 00001
VAR2 PIC S9(5) VALUE 0.
I HAVE MOVED VAR1 TO VAR2 after the move the value I am getting in VAR2 is 0000A. Please let me know how to handle this to get 00001.
Thanks. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
kumarramky wrote: |
Hi there,
Can you please let me know how to pass VAR1 9(5) value to VAR2 S9(5).
My declaration is:
VAR1 PIC 9(5) VALUE 00001
VAR2 PIC S9(5) VALUE 0.
I HAVE MOVED VAR1 TO VAR2 after the move the value I am getting in VAR2 is 0000A. Please let me know how to handle this to get 00001.
Thanks. |
You are getting just what you ask for 00001 with a sign! |
|
Back to top |
|
|
kumarramky
New User
Joined: 04 Aug 2006 Posts: 5
|
|
|
|
Thanks for the quick reply. After the move my module is checking for
IF VAR2 IS NUMERIC and it is failing here. That is the reason I am asking this.
Please let me know your comments.
Thanks |
|
Back to top |
|
|
vv
New User
Joined: 06 Jan 2008 Posts: 10 Location: bangalore
|
|
|
|
HI ,
I DONE THAT SAME PROG IN AND I AM GETTING CORRECT ANS AS 00001.JUST CHECK IT |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I DONE THAT SAME PROG IN AND I AM GETTING CORRECT ANS AS 00001.JUST CHECK IT |
This, i doubt. . . If the receiving field is specified as s(5), you should get a sign. . . This would not be 00001.
You don't need to SHOUT. . . .
Quote: |
After the move my module is checking for
IF VAR2 IS NUMERIC and it is failing here |
Please post the actual code for the move and the numeric test. |
|
Back to top |
|
|
kishorekyn
New User
Joined: 20 Feb 2008 Posts: 5 Location: Chennai
|
|
|
|
If the second variable is declared like
01 VAR2 PIC S9(5) SIGN LEADING SEPARATE.
Then you will get your display correct with a sign. In your case 'A' denotes number 1 that is popsitive. Hope this would be helpful. All the best. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello kishorekyn and welcome to the forums,
Quote: |
In your case 'A' denotes number 1 that is popsitive. |
Yes, i believe we all agree on that. The current question is why does a variable defined as s9(5), that contains a +1 (0000A), fail an IF NUMERIC test.
Once the code is posted we can (hopefully ) see more. |
|
Back to top |
|
|
kumarramky
New User
Joined: 04 Aug 2006 Posts: 5
|
|
|
|
Hello friends,
My mistake. Its working fine. As said above 0000A is numeric data with sign.
Thanks for all your help and time.
Thanks. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Not to worry - we all make mistakes.
Good to hear - thank you for posting all is well.
Quote: |
Thanks for all your help and time. |
You're welcome
d |
|
Back to top |
|
|
star_dhruv2000
New User
Joined: 03 Nov 2006 Posts: 87 Location: Plymouth, MN USA
|
|
|
|
Hi all,
Just FYI..
If
Code: |
SIGN LEADING/TRAILING |
is not specified then by default SIGN is stored in the last byte. Following can be used to convert them to their equivallent:
A:+1
B:+2
C:+3
D:+4
E:+5
F:+6
G:+7
H:+8
I:+9
J:-1
K:-2
L:-3
M:-4
N:-5
O:-6
P:-7
Q:-8
R:-9
{:+0
}:-0
For e.g. 104A = 1041+.
Although it seems this is not numeric data but it can very well participate in any numeric operation.
Thank you! |
|
Back to top |
|
|
earsha
New User
Joined: 16 Mar 2007 Posts: 17 Location: Pune
|
|
|
|
i have also checked the same.it is correct. |
|
Back to top |
|
|
|