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



use Ali's example.  You should be able to do this?

If NewZipCode = getNextCANZip(%trim(OldZipCode))
 In_sequence=*on
Endif



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Lim Hock-Chai
Sent: Tuesday, October 19, 2004 2:22 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Trivia: How many lines of code are allowed in an RPG
Program?


haven't fully tested.  But this proc should be able to add the zip as you 
defined:

     P getNextCANZip   B
     D                 PI             6A
     D  piInput                       6A   varying value

      * constants
     D myNums          C                   const('0123456789')
     D myAlpha         C                   const('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

      * local variables
     D myIx            s              5  0
     D myPos           s              5  0
     D myNumAdd        s               N   inz(*on)
     D                 DS
     D  retValue                      6
     D  myOutput                      1A   dim(6) overlay(retValue)

     C                   eval      retValue = piInput

     C                   for       myIx = %len(piInput) downto 1
      *   find the current value
     C                   if        myNumAdd = *on
     C                   eval      myPos = %scan(myoutput(myIx) :myNums)
     C                   else
     C                   eval      myPos = %scan(myOutput(myIx) :myAlpha)
     C                   endif

     C                   select
      * invalid char passed
     C                   when      myPos = 0
     C                   return    *hival

      * overflow on numeric add
     C                   when      myNumAdd and myPos = 10
     C                   eval      myOutput(myIx) = '0'

      * overflow on alpha add
     C                   when      not myNumAdd and myPos = 26
     C                   eval      myOutput(myIx) = 'A'

     C                   other
     C                   if        myNumAdd
     C                   eval      myOutput(myIx) = %subst(myNums :myPos+1 :1)
     C                   else
     C                   eval      myOutput(myIx) = %subst(myAlpha :myPos+1 :1)
     C                   endif
     C                   leave
     C                   endsl
     C
     C                   eval      myNumAdd = not myNumAdd
     C                   endfor


     C                   RETURN    retValue
     P getNextCANZip   E


> ------------------------------
> 
> message: 5
> date: Tue, 19 Oct 2004 13:12:00 -0500
> from: fkany@xxxxxxxxxxxxxxxxxx
> subject: RE: Trivia: How many lines of code are allowed in an RPG
>       Program?
> 
> If someone else has a better way, be my guest, I'm
> open to ideas.

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.