Better yet, go from 9999 to 999A, and from 999Z (or whatever) to 99A0,
which will increment normally. Then you won't have any problems until
after ZZZZ, when you can expand to a bigger-still base!
Still need to write the INCRement routine? Here's a quick & dirty one
that works ONLY vs a variable "MYCOUNTER" with a known length of 4, but
it works (note it must live in a file called INCR36, since it's
recursive):
1) put this in a file called INCR36...
PARM POSITIONTOINCR=4
SETVAR CURRVALUE STR ( MYCOUNTER , POSITIONTOINCR , 1 )
IF "!CURRVALUE" = "Z"
SETVAR MYCOUNTER STR ( MYCOUNTER , 1 , POSITIONTOINCR - 1 ) + "0"
SETVAR POSITIONTOINCR POSITIONTOINCR - 1
INCR36 POSITIONTOINCR
ELSE
SETVAR MYDIGITS "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
SETVAR NEXTPOINTER POS ( STR ( MYCOUNTER , MYDIGITS , 1 ) + 1
SETVAR NEXTVALUE STR ( MYDIGITS , NEXTPOINTER , 1 )
SETVAR MYCOUNTER STR ( MYCOUNTER , 1 , POSITIONTOINCR - 1 ) + NEXTVALUE
&
+ STR ( MYCOUNTER , POSITIONTOINCR + 1 , 4 )
ENDIF
2) and do this...
:SETVAR MYCOUNTER "9999"
:while mycounter < "99ZZ" DO
: INCR36
: SHOWVAR MYCOUNTER
:ENDWHILE
K Tracy Pierce
Systems Programmer
Golden Gate Bridge, Hwy & Trnsp Dist
San Francisco, CA 94129-0601
|