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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm


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