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
 

 

MOVE 9(5) value to S9(5)

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

New User


Joined: 04 Aug 2006
Posts: 5

PostPosted: Sat Mar 01, 2008 5:20 am    Post subject: MOVE 9(5) value to S9(5)
Reply with quote

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

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Mar 01, 2008 6:05 am    Post subject: Re: MOVE 9(5) value to S9(5)
Reply with quote

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

New User


Joined: 04 Aug 2006
Posts: 5

PostPosted: Sat Mar 01, 2008 6:19 am    Post subject:
Reply with quote

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

New User


Joined: 06 Jan 2008
Posts: 10
Location: bangalore

PostPosted: Sat Mar 01, 2008 6:53 am    Post subject: HI THIS IS VENKATESH
Reply with quote

HI ,

I DONE THAT SAME PROG IN AND I AM GETTING CORRECT ANS AS 00001.JUST CHECK IT
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 Mar 01, 2008 9:18 am    Post subject:
Reply with quote

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. . . . icon_cry.gif

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

New User


Joined: 20 Feb 2008
Posts: 5
Location: Chennai

PostPosted: Sat Mar 01, 2008 3:44 pm    Post subject: Reply to: MOVE 9(5) value to S9(5)
Reply with quote

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

Site Director


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

PostPosted: Sat Mar 01, 2008 10:29 pm    Post subject:
Reply with quote

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 icon_smile.gif ) see more.
Back to top
View user's profile Send private message
kumarramky

New User


Joined: 04 Aug 2006
Posts: 5

PostPosted: Sun Mar 02, 2008 6:14 am    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Sun Mar 02, 2008 7:05 am    Post subject: Reply to: MOVE 9(5) value to S9(5)
Reply with quote

Hello,

Quote:
My mistake.
Not to worry - we all make mistakes.

Quote:
Its working fine.
Good to hear - thank you for posting all is well.

Quote:
Thanks for all your help and time.
You're welcome icon_smile.gif

d
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Mon Mar 03, 2008 4:41 pm    Post subject:
Reply with quote

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! icon_smile.gif
Back to top
View user's profile Send private message
earsha

New User


Joined: 16 Mar 2007
Posts: 17
Location: Pune

PostPosted: Tue Mar 04, 2008 3:59 pm    Post subject:
Reply with quote

i have also checked the same.it is correct.
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 DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm


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