TO: EVERYONE
FROM: JAMES BLAIR NAN495
DATE: 01/12/87
SUBJECT: MAKING UNIQUE FILES NAMES IN CLIPPER FOR NetWare 286

To the extenda.asm utility add: PUBLIC STATION just under public
isprinter.
then under isprinter endp add:

;----------------------------------------------------------------------
;STATION()
;SYNTAX: STATION()
;RETURN: Station nimber of user PC on NetWare 286

STATION PROC FAR

         MOV     AH,220    ;station function (my assembler wouldn't
                           ;work with DCh)
         INT     21h       ;get station number
         MOV     AH,0      ;set leading digits to zero

RET_STATION:
         PUSH    AX        ;put station where clipper can find it
         CALL    _RETNI    ;return station number
         POP     AX        ;restore the stack

         RET               ;all done

STATION ENDP               ;goodbye

;------------------------------------------
;below this are the three existing lines
;------------------------------------------

_PROG ENDS

         END

;EOF Extenda.asm-----------------------------------

There's a problem with the result as all the leading zeros are suppresed
plus the fact that 4 digits are returned instead of three.  We handle
this with a little extra code;

When your application starts:

public number
NUMBER=STR(STATION(),4,0)
IF SUBSTR(NUMBER,2,1)=" "
  IF SUBSTR(NUMBER,3,1)=" "
    NUMBER="00"+SUBSTR(NUMBER,4,1)
  ELSE
    NUMBER="0"+SUBSTR(NUMBER,3,2)
  ENDIF
ELSE
  NUMBER=SUBSTR(NUMBER,2,3)
ENDIF
NWFILE="TEMP"+NUMBER && the portion in quotes cannot exceed 5 characters
use nwfile
zap
use

The last three lines insure that you get rid of any left over garbage
from whatever cause, when you get to where you need this file just
enter;

use nwfile

You will have created a file called temp001 or temp002 or temp whatever
station you happen to be all the way to temp255.
