Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
s9(9) comp variable to 9(9) without sign

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: s9(9) comp variable to 9(9) without sign
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: 8212
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 13, 2013 10:18 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Wed Nov 13, 2013 10:19 pm    Post subject: Reply to: s9(9) comp variable to 9(9) without sign
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 13, 2013 10:23 pm    Post subject: Reply to: s9(9) comp variable to 9(9) without sign
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    Post subject:
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    Post subject:
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    Post subject:
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 13, 2013 10:54 pm    Post subject: Reply to: s9(9) comp variable to 9(9) without sign
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    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 COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us