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

MOVE 9(5) value to S9(5)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Sat Mar 01, 2008 9:18 am
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
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

Moderator Emeritus


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

PostPosted: Sat Mar 01, 2008 10:29 pm
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
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

Moderator Emeritus


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

PostPosted: Sun Mar 02, 2008 7:05 am
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts How to move DB2 Installation HLQ DB2 4
No new posts How to move values from single dimens... COBOL Programming 1
No new posts Reading the CSV data in COBOL and mov... COBOL Programming 4
Search our Forums:

Back to Top