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



Thanks!  I don't have access to a 400 right now, can we get someone to test
this against the cvtefnd and Ms. Morris' routine?  I would expect that
Carsten's builtin program and Ms. Morris' program will be comparable, with
the cvtefnd a distant third.  "Comparable" does not mean "the same".  In
light of that guess, I would suggest that the test run duration be at least
3 digits of seconds - at least 100 seconds - then there will be more
significant digits in the answer.  Based on the kind of code that this is,
it seems to me that maximum optimization should be used.

I base my guess on the general cost to go up and down through the MI
interface.  This applies mostly to complex instructions and Ms. Morris'
routine doesn't have any of those (that I noticed) in her mainline loop.
There is some pointer arithmetic in her mainline and that should increase
the cost but by an insignificant amount.

Richard Jackson
mailto:richardjackson@richardjackson.net
www.richardjacksonltd.com
Voice: 1 (303) 808-8058
Fax:   1 (303) 663-4325

-----Original Message-----
From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On
Behalf Of Carsten Flensburg
Sent: Friday, August 18, 2000 7:56 AM
To: Richard Jackson; RPG400-L@midrange.com
Subject: Re: Character to Decimal



----- Original Message -----
From: "Richard Jackson" <richardjackson@richardjackson.net>
To: <RPG400-L@midrange.com>
Sent: 18. august 2000 07:59
Subject: RE: Character to Decimal


> I looked at both cvtefni and cvtefnd before sending my note.  I didn't
like
> the looks of either version so I didn't talk about them.
>
> The CVTEFN MI instruction has all the goodness of being implemented below
> the MI.  Can we write a routine in MI and make it bindable

Hi Richard,

Here's an RPG/IV version using the equivalent _CVTEFN builtin:

     ** Valid source string symbols:
     **   One sign symbol . :  - or +
     **   Decimal point . . :  .
     **   Comma . . . . . . :  ,
     **   Blank . . . . . . :  x'40
     **   Digit . . . . . . :  x'F0' - x'F9'
     **   Currency symbol as defined by mask
     **
     D T_SIGNED        c                   x'00'
     D T_FLOAT         c                   x'01'
     D T_ZONED         c                   x'02'
     D T_PACKED        c                   x'03'
     D T_UNSIGNED      c                   x'0A'
     **
     D Mask            Ds
     D  CurSym                        1a   Inz( '$' )
     D  ComSym                        1a   Inz( ',' )
     D  DecPntSym                     1a   Inz( '.' )
     **
     D DPA_Template_T  Ds
     D  SclTyp                        1a
     D  RcvLen                        5i 0
     D   DecPos                       3i 0 Overlay( RcvLen: 1 )
     D   TotDig                       3i 0 Overlay( RcvLen: 2 )
     D  Rsv                          10i 0 Inz
     **
     D CVTEFN          Pr                  ExtProc( '_CVTEFN' )
     D  RcvVar                         *   Value
     D  RcvAtr                             Const  Like( DPA_Template_T )
     D  Source                         *   Value
     D  SrcLen                       10u 0 Const
     D  SymMsk                             Const  Like( Mask )
     **
     D Source          s             25a   Inz( '-12,345,678.912' )
     D Packed          s             15p 4
     D Binary          s             10i 0
     **
     **-- Zoned & Packed:
     C                   Eval      SclTyp     = T_PACKED
     C                   Eval      DecPos     = %DecPos( Packed )
     C                   Eval      TotDig     = %Len( Packed )
     **
     C                   CallP     CVTEFN( %Addr( Packed )
     C                                   : DPA_Template_T
     C                                   : %Addr( Source )
     C                                   : %Len( %TrimR( Source ))
     C                                   : Mask
     C                                   )
     **-- Binary & Float:
     C                   Eval      SclTyp     = T_SIGNED
     C                   Eval      RcvLen     = %Size( Binary )
     **
     C                   CallP     CVTEFN( %Addr( Binary )
     C                                   : DPA_Template_T
     C                                   : %Addr( Source )
     C                                   : %Len( %TrimR( Source ))
     C                                   : Mask
     C                                   )
     **
     C                   Return
     **

I haven't made any performance tests though, maybe someone else will check
out the cpu-consumption of the various routines?!

Best regards,
Carsten Flensburg

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

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.