Category : Files from Magazines
Archive   : V12N05.ZIP
Filename : NXTKEY.PRG

 
Output of file : NXTKEY.PRG contained in archive : V12N05.ZIP
*********************************************************************
* FUNCTION NxtKeyCod Clipper 5
* Increments a key code of serial number that is made up of
* letters and numerals.
*
* - The characters used in the code are from 0 - 9 and then A - Z
* in ascending order.
* - The previous key code passed to this procedure should have the
* maximum length allowed so that the system can check whether
* the next key code will exceed the limit.
* If so, it returns all "*".
* - Spaces are treated as "0". Trailing spaces are significant and
* replaced by "0", while leading spaces will remain unchanged
*********************************************************************
FUNCTION NxtKeyCod( ckeycode )
LOCAL cchrbank, nkeylen, nct, cwkchr, nwkchrseq
cchrbank = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
nkeylen = LEN( ckeycode)
ckeycode = SUBSTR( TRIM( ckeycode ) + ;
REPLICATE( "0", nkeylen), 1, nkeylen)
FOR nct = 1 TO nkeylen
cwkchr = SUBSTR( ckeycode, -1 *nct, 1 )
cwkchr = IIF( cwkchr = " ", "0", cwkchr )
nwkchrseq = AT( cwkchr, cchrbank )
nwkchrseq = nwkchrseq + 1
nwkchrseq = IIF( nwkchrseq > LEN( cchrbank), 1, nwkchrseq )
cwkchr = SUBSTR( cchrbank, nwkchrseq, 1 )
ckeycode = SUBSTR( ckeycode, 1, nkeylen - nct) + cwkchr +;
SUBSTR( ckeycode, nkeylen -nct +2)
IF nwkchrseq != 1
EXIT
ELSEIF nct = nkeylen
ckeycode = REPLICATE( "*", nkeylen )
ENDIF
NEXT
RETURN ckeycode


  3 Responses to “Category : Files from Magazines
Archive   : V12N05.ZIP
Filename : NXTKEY.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/