|
The key to converting character to numeric in COBOL is the redefines
statement in Working storage.
05 WORK-PERCENT PIC X(9).
05 FILLER REDEFINES WORK-PERCENT.
10 FILLER PIC X(4).
10 WORK-PCT-AMT PIC 9(3)V9(2).
MOVE Character-value TO WORK-PERCENT.
MOVE WORK-PCT-AMT TO Numeric-field.
John A Arnold
(301) 354-2939
jarnold@xxxxxxxxxxxxx
-----Original Message-----
From: cobol400-l-bounces+jarnold=fedmedinc.com@xxxxxxxxxxxx
[mailto:cobol400-l-bounces+jarnold=fedmedinc.com@xxxxxxxxxxxx] On Behalf
Of cobol400-l-request@xxxxxxxxxxxx
Sent: Friday, December 23, 2005 1:01 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: COBOL400-L Digest, Vol 3, Issue 128
Send COBOL400-L mailing list submissions to
cobol400-l@xxxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/cobol400-l
or, via email, send a message with subject or body 'help' to
cobol400-l-request@xxxxxxxxxxxx
You can reach the person managing the list at
cobol400-l-owner@xxxxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of COBOL400-L digest..."
Today's Topics:
1. Field Conversion In cobol from character to numeric
(Shijith Chand)
----------------------------------------------------------------------
message: 1
date: Fri, 23 Dec 2005 19:14:21 +0530
from: "Shijith Chand" <shijith_c@xxxxxxxxxxx>
subject: [COBOL400-L] Field Conversion In cobol from character to
numeric
Dear all,
I think this doubt is very similar to that of shabbir .
I am a novice to COBOL/400 programming and I have a very
basic
doubt.
I am trying to pass a character variable as parameter to
a
COBOL
pgm
and in the procedure division I want to convert this
character to
a numeric
data type.
In RPG I remember we could do a MOVE A B without any
error
even if A is a character variable with length (say 4)
and B
is a
numeric
variable of attribute (4 ,0).
For eg. suppose A = '1234'
move A B -> in RPG would have resulted in B to
have a
value
1234.On the contrary the same operation would result in
a
dec
data
error in COBOL.Can anybody help me do this in COBOL.
Thanks in anticipation,
Regards,
shijith
_________________________________________________________________
Tried the new MSN Messenger? It's cool! Download now.
http://messenger.msn.com/Download/Default.aspx?mkt=en-in
------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.