× 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: No %editc in V3R2!!!
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Wed, 27 Dec 2000 17:39:56 -0600 (CST)


Hi Dan... my comments are below...

On Wed, 27 Dec 2000 D.BALE@handleman.com wrote:

> %editc is in the V3R7 compiler but not V3R2?  I thought V3R2 & V3R7 were
> identical versions except for the CISC & RISC factor?  Apparently not!
> 
> Well, I need the %editc equivalent function for V3R2.  I know there are a pair
> of APIs that handle this, one to set up the edit mask and the other to pass
> the number and get back the edited value in alpha, but I've had no luck
> finding these.  Does anyone have working code using these APIs or, at least,
> can anyone point me to the proper reference?  (One problem I have is that I've
> got V3R2, but no manuals or softcopy for it.  I've got softcopy for v4r4, but
> the APIs are now described in IBM's woefully deficient InfoCenter "Search?
> What's Search?")
> 

Actually V3R2 is in parity with the RISC version V3R6 (more or less) when
you're talking about RPG.  The OS functions are in parity with V3R7, but
not RPG.  

Isn't it fun being stuck at V3R2?  I just love working around the missing
features in this release. :)

As you've no doubt heard from 10 other people by now, the softcopy library
is available on the internet.  The V3R2 book for the Edit API is here:
http://publib.boulder.ibm.com:80/cgi-bin/bookmgr/BOOKS/QBJAMH00/CCONTENTS

Here's a subprocedure that I use for editing numerics, since I'm also
stuck at V3R2.  It includes some examples of using it.   After adjusting
it to your tastes, I'd recommend seperating the prototype into a seperate
source member, then throwing the subprocedure into a service program.
For the sake of this example, however, its easier to just use one source
member.

Here it is:

     D EditC           PR            43A
     D   p_SrcVar                      *   value
     D   peEditCode                   1A   const
     D   peVarType                   10A   const
     D   peDigits                    10I 0 value
     D   peDecPos                    10I 0 value
     D   peFillChar                   1A   const options(*nopass)

     D Msg             S             50
     D MyString        S             43
     D MyVar           S             14P 2 inz(12889.05)

     c                   eval      MyString = EditC(%addr(MyVar): 'K':
     c                                '*PACKED': 14: 2: '$')

     c                   eval      Msg = 'You win '+ %trim(MyString) +'!'
     c                   dsply                   Msg

     c                   eval      *inlr = *on


     **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     **  EditC -- apply an edit code to a numeric variable.
     **
     **    required parameters:
     **         p_SrcVar   = pointer to the source (numeric) variable
     **         peEditCode = The edit code to apply (A-D,J-Q,Y-Z,1-9)
     **         peVarType  = type of variable '*PACKED' '*ZONED' '*BINARY'
     **         peDigits   = number of digits in variable.  1-31
     **         peDecPos   = number of decimal places
     **
     **    optional parameter:
     **         peFillChar = (optional) currency symbol or fill char.
     **                        Defaults to ' '.  ' ' = blank fill,
     **                        '*' = asterisk fill, other = currency symbol
     **
     **    return values:
     **         '*ERROR' if something didn't work.
     **         otherwise returns a string containing the edited number
     **+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     P EditC           B                   Export
     D EditC           PI            43A
     D   p_SrcVar                      *   value
     D   peEditCode                   1A   const
     D   peVarType                   10A   const
     D   peDigits                    10I 0 value
     D   peDecPos                    10I 0 value
     D   peFillChar                   1A   const options(*nopass)

     D dsEC            DS
     D  dsECBytesP             1      4B 0 INZ(256)
     D  dsECBytesA             5      8B 0 INZ(0)
     D  dsECMsgID              9     15
     D  dsECReserv            16     16
     D  dsECMsgDta            17    256

     D CvtEditCod      PR                  ExtPgm('QECCVTEC')
     D   EdtMsk                     256A
     D   EdtMskLen                   10I 0
     D   RcvVarLen                   10I 0
     D   ZeroFill                     1A
     D   EditCode                     1A   CONST
     D   FillChar                     1A   CONST
     D   Digits                      10I 0 CONST
     D   DecPos                      10I 0 CONST
     D   ErrorCode                32766A   options(*varsize)

     D EditNum         PR                  ExtPgm('QECEDT')
     D   RcvVar                   32766A   options(*varsize)
     D   RcvVarLen                   10I 0 CONST
     D   SrcVar                       1A
     D   SrcVarTyp                   10A   CONST
     D   SrcVarDig                   10I 0 CONST
     D   EdtMsk                     256A
     D   EdtMskLen                   10I 0 CONST
     D   ZeroFill                     1A   CONST
     D   ErrorCode                32766A   options(*varsize)

     D wwSrcVar        S              1A   based(p_SrcVar)
     D wwEditMask      S            256A
     D wwMaskLen       S             10I 0
     D wwVarLen        S             10I 0
     D wwZeroFill      S              1A
     D wwFillChar      S              1A
     D wwRetVal        S             43A

     C* was a fill char specified?
     c                   if        %parms > 5
     c                   eval      wwFillChar = peFillChar
     c                   else
     c                   eval      wwFillChar = *blanks
     c                   endif

     C* Get the edit mask for this variable:
     c                   callp     CvtEditCod(wwEditMask: wwMaskLen:
     c                                 wwVarLen: wwZeroFill: peEditCode:
     c                                 wwFillChar: peDigits: peDecPos: dsEC)
     c                   if        dsECBytesA > 0
     c                   return    '*ERROR'
     c                   endif

     c                   if         wwVarLen > 43
     c                   return     '*ERROR'
     c                   endif

     c                   eval       wwRetVal = *Blanks

     C* Apply the edit mask:
     c                   callp     EditNum(wwRetVal: wwVarLen: wwSrcVar:
     c                                peVarType: peDigits: wwEditMask:
     c                                wwMaskLen: wwZeroFill: dsEC)
     c                   if        dsECBytesA > 0
     c                   return    '*ERROR'
     c                   endif

     C* Return the result:
     c                   return    wwRetVal
     P                 E

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

Replies:

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.