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

How to get same value from numeric field passed from alphanu


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

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Thu Jul 19, 2007 3:29 pm
Reply with quote

Hello ,

I want to pass value of maximum 5 bytes to alphanumric field and map it to Numeric field 9(5) . And the output of the Numeric field passed to Alphanumric field of x(5).

INitial value should not be changed .Given is the example.

02 WS-XYZ PIC X(5).
02 WS-ABC PIC 9(5).

MOVE ' 0CDE' TO WS-XYZ.
MOVE WS-XYZ TO WS-ABC.
MOVE WS-ABC TO WS-XYZ.

AND THE VALUE OF WS-XYZ COMING AS 0CD5. Is there any way we can get the same output without introducing new variable.
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: Thu Jul 19, 2007 7:30 pm
Reply with quote

Hello,

Why would you want to put non-numeric values in a numeric field?

If we understand what the requirement really is, we may be able to offer suggestions.

Even if you find a way to force incompatible values into a field, you will have many problems using that mis-match later. . .
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jul 19, 2007 8:06 pm
Reply with quote

Because of the lack of the sign on the numeric field, COBOL is forcing the sign for the last digit to "F" - E is x'c5' and 5 is x'f5'.....
You might change the numeric field to s9(5) and see what happens.....
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: Thu Jul 19, 2007 8:16 pm
Reply with quote

Hello,

If you make the change to s9(5) and get what you want, please try
Code:
MOVE ' 0CDX' TO WS-XYZ
and post back the result.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Jul 20, 2007 12:07 am
Reply with quote

Hi,

I don't know why you want to do this, but try substituting:

MOVE WS-XYZ TO WS-ABC(1:)

for your 2nd move.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Jul 20, 2007 12:17 am
Reply with quote

Deleted
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts DB2 Event passed to the Application P... DB2 1
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top