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

s9(9) comp variable to 9(9) without sign


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

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Wed Nov 13, 2013 10:11 pm
Reply with quote

Hello,

I am trying to move a s9(9) comp variable to 9(9).

I have an alphanumeric character at the end. I understand that it is the sign. but i just want to move the value without sign. is it possible in cobol?

or should i use a syncsort to convert?

Quote:


Example
+001000103 - s9(9) comp
00100010C - 9(9) equivalent of the above comp.

Expected value:
001000103



Please help.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 13, 2013 10:18 pm
Reply with quote

What you are wanting to do is a simple, normal MOVE statement in COBOL. If you are not getting the expected results in your code, you will need to post the variable definition for the source and target variables as well as the actual MOVE statement you are using.

Note that the hex representation for your given value of 1000103 would be X'000F42A7' as a COMP variable.
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: Wed Nov 13, 2013 10:19 pm
Reply with quote

Can you show the actual definitions and the procedure code. That should not be happening. A PIC 9(9) should have an "F" for the sign, so you should only see "numbers" in the final digit. So something is wrong.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 13, 2013 10:23 pm
Reply with quote

Move the fullword to a signed display-numeric field, which will include the "C" overpunch, then move the signed display-numeric field to an unsigned display-numeric field.

Having said this, why not move the fullword < directly > to an unsigned display-numeric field?
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Wed Nov 13, 2013 10:29 pm
Reply with quote

Code:

01  OUT-TBL-Dbr                     PIC S9(9)
01  WS-TBL-Dbr                     PIC S9(9) COMP


Above is the definition.
Data is fetched from cursor as below,
Code:

FETCH LOADCRSR INTO
:WS-TBL-DUNS,     
....


Code:

MOVE WS-TBL-dbr     TO  OUT-TBL-dbr


Output of out-tbl-duns below
Code:

00100010C
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Wed Nov 13, 2013 10:31 pm
Reply with quote

Code:

FETCH LOADCRSR INTO
:WS-TBL-Dbr,     


There is a typo in the above.
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Wed Nov 13, 2013 10:52 pm
Reply with quote

Extremely sorry for wasting your time. I was looking at the incorrect o/p file. a direct move from s9(9) comp to 9(9). solved the issue.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 13, 2013 10:54 pm
Reply with quote

Define "01 OUT-TBL-Dbr" as 9(09), without the sign and all will be forgiven. icon_wink.gif
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top