|
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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.