View previous topic :: View next topic
|
Author |
Message |
shankarm
Active User
Joined: 17 May 2010 Posts: 175 Location: India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
shankarm
Active User
Joined: 17 May 2010 Posts: 175 Location: India
|
|
|
|
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
|
|
Back to top |
|
|
shankarm
Active User
Joined: 17 May 2010 Posts: 175 Location: India
|
|
|
|
Code: |
FETCH LOADCRSR INTO
:WS-TBL-Dbr,
|
There is a typo in the above. |
|
Back to top |
|
|
shankarm
Active User
Joined: 17 May 2010 Posts: 175 Location: India
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Define "01 OUT-TBL-Dbr" as 9(09), without the sign and all will be forgiven. |
|
Back to top |
|
|
|