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
 

 

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: 7904
Location: Bellevue, IA

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: 7223

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: 2502
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: 2502
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 Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am


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