|
In order of preference.
1) Use RPGLE. Try CVTRPGSRC.
2) Failing that (for some stupid reason) then call the API's that others
have recommended.
3) If you really have a fear of learning anything new and don't want to
use RPGLE or API's then use internally defined output and input specs, with
an edit code, and write it out to a disk file and read the record back in.
Used to use this technique all the time on the S/36 with direct files.
Input is character, output is numeric.
Rob Berendt
==================
Remember the Cole!
"Jason Waugh"
<jwaugh@collectco To: RPG400-L@midrange.com
rp.com> cc:
Sent by: Subject: Beginner needs help
w/ decimal field to text field
owner-rpg400-l@mi
drange.com
10/19/00 10:06 AM
Please respond to
RPG400-L
I have a decimal field... 9 digits, 2 decimals. I need to move it into a
character field of 14 characters, complete with negative sign and decimal.
I need it to be left justified and padded with blanks. Examples:
9.32 (00000000932) should become '9.32 '
-456.34 should become '-456.34 '
I saw a discussion about this recently, but the solutions given were to use
the edit code functions available in ILE and I am using RPG/400.
I'm pulling data from a database (externally described) and trying to
create a tab delimited ASCII file out of it for one of our clients. After
I have managed to obtain this value, I will be concatenating a horizontal
tab to the end of it (hence I need 14 characters - an extra one for the tab
in case the number happens to be 11 digits, and negative, occupying 13
characters). I will then be concatentating this 14 character string to the
rest of a string I've already built up, which will then finally be written
as a line in a text file.
(this is something that will be created often, *ideally* not by me, so
using PC tools to make the resulting file tab delimited is not an option)
Any help is appreciated.
Thanks,
Jason Waugh
Systems Development
COLLECTCORP, INC.
(416)935-2883
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
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.