× 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: Another RPG Suggestion
  • From: "Dan Bale" <dbale@xxxxxxxxxxx>
  • Date: Tue, 13 Jul 1999 17:24:32 -0400



Hans,

>>Regarding changing data type, I'd like to know more about
what you really want.  In particular, are you primarily
interested in defining a numeric field like say a zoned
decimal field and change the format to packed?  Or do you
need to define a character field like a numeric field?<<

As a matter of fact, just today I happened to come upon this situation where a
composite entry field defined as 9-character; the first 2 positions are
character data and the last 7 positions are a 7-digit number.  I need to TESTN
the 7-digit portion to make sure it's a valid numeric before I move it into a
numeric field.  So... I needed a character field that was the same length as the
numeric database field, but I didn't want to hard-code it.  I ended up defining
an oversized character field using VARYING and then setting the length of the
field...  (as follows):

      * Screen field StrIT# is a 9-character field (made up of a 2-character
      *   warehouse code and a 7-digit tag number
      * Database field Str35u is defined as a 2-character field
      * Database field Tag35u is defined as a 7-digit, 0-decimal packed field
      *
     d Tag35u_alpha    s             15a   Varying
     d Tag#_Length     s              3p 0
      *
     c                   Eval      %Len( Tag35u_alpha ) = %Len( Tag35u )
     c                   Eval      Tag35u_alpha = %subst( StrIT#
     c                                                  : %Len( Str35u ) + 1
     c                                                  : %Len( Tag35u )     )
     c                   TestN                   Tag35u_alpha         82

Of course, if you "bif" the TestN opcode and allow substrings, i.e.,

     c                   If        %TestN( %subst( StrIT#
     c                                           : %Len( Str35u ) + 1
     c                                           : %Len( Tag35u )     ))

That would solve my problem, too.    ;-)

- Dan Bale





* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  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.