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
 

 

How to get same value from numeric field passed from alphanu

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 126
Location: UK

PostPosted: Thu Jul 19, 2007 3:29 pm    Post subject: How to get same value from numeric field passed from alphanu
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jul 19, 2007 7:30 pm    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Thu Jul 19, 2007 8:06 pm    Post subject:
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jul 19, 2007 8:16 pm    Post subject:
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    Post subject: Re: How to get same value from numeric field passed from alp
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    Post subject:
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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