× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Beginner needs help w/ decimal field to text field
  • From: booth@xxxxxxxxxxxx
  • Date: Thu, 19 Oct 2000 17:56:37 GMT

RPG??  The last time I used this was in 1994.  It works by creating a 
special file and outputting the numeric field with an edit code and then 
reading it back.  The field length is 70 because that is the size I used 
for Sys/36 subfiles, but change the length to 14 and it'll work just fine. 
 You need to make this program, and you need to copy the commented lines 
into your program.


      * :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
      * : Program property of, and copyrighted by:                   : 
      * :------------------------------------------------------------: 
      * : Purpose of program: This program is used as the exit pro-  : 
      * : gram to a SPECIAL file.  It does nothing but return the    : 
      * : variables; editing is done by the RPG logic.               : 
      * :                                                            : 
      * : Date:  Programmer Action:                                  : 
      * : 5/ 9/94 Booth M.  Program written.                         : 
      * :                                                            : 
      * :............................................................: 
      * STATEMENTS TO USE IN PROGRAM NEEDING DISPLAY LAY-OUT. 
      * (MAY NEED *IN__ TO CONDITION OUTPUT, IF NEEDED MORE THAN ONCE.) 
     F*DTFILE UF  F     256            SPECIAL       OCEDIT 
     I*DTFILE NS 
      *  WORK FILE ONLY FOR LN ARRAY 
     I*                                       1  70 DATA70 
     C*                    EXCPTOCEDIT 
     C*                    READ EDTFILE                  50 
     O*DTFILE E                OCEDIT 
     O*                        DATA70    70 
      * :............................................................: 
     IERRDS       DS 
     I                                        1   50ERROR 
     C           *ENTRY    PLIST 
     C* Option -> O=Open, C=close, R=read, W=write, D=delete, U-update 
     C                     PARM           OPTION  1 
     C* Status -> 0=normal, 1=EOF, 2=error 
     C                     PARM           STATUS  1 
     C* ERRDS  -> 5 digit error code 
     C                     PARM           ERRDS 
     C* FIELD  ->(must equal record length demanded by SPECIAL file.) 
     C                     PARM           FIELD 256 
     C* ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  .. 
     C                     Z-ADD*ZEROS    ERROR 
     C                     MOVE '0'       STATUS 
     C           OPTION    IFEQ 'C' 
     C                     SETON                     LR 
 ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+..
     C                     ENDIF 
     C                     RETRN 
     C* ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  .. 
_______________________
Booth Martin
Booth@MartinVT.com
http://www.MartinVT.com
_______________________




"Jason Waugh" <jwaugh@collectcorp.com>
Sent by: owner-rpg400-l@midrange.com
10/19/2000 11:06 AM
Please respond to RPG400-L

 
        To:     RPG400-L@midrange.com
        cc: 
        Subject:        Beginner needs help w/ decimal field to text field

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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.