Rockwell Automation 2708-NBD VBASIC Language Development Kit User Manual

Page 58

Advertising
background image

A-B VBASIC and Visual BASIC

Appendix B

Differences Between

B–10

INSTR([start,]stringexpression1,stringexpression2)

Returns the character position of the first occurrence of a string in another
string. See VBDOS manual for detailed information.

i = INSTR(DataIn$, CHR$(13)) ‘Look for a carriage return
IF i > 0 THEN Rec$ = LEFT$(DataIn$, i–1)

INT(numeric–expression)

Returns the largest integer less than or equal to numeric–expression.
See VBDOS manual for detailed information.

IOCTL$([#]filenumber)

Remarks in the VBDOS manual limiting IOCTL use to device drivers are not
applicable to A-B VBASIC. See the A-B VBASIC Program Development
Guide
for details on IOCTL usage in special devices.

OPEN “BAR” FOR INPUT AS #1
DO

CLS
PRINT “SWIPE BADGE”
DO WHILE NOT EOF(1): LOOP

‘Wait for data...

SOUND 1400,2
DataInfo$ = IOCTL$(1)

‘Get data on barcode input

Delimiter = INSTR(DataInfo$, “/”)
DataType$ = LEFT$(DataInfo$, Delimiter – 1)‘What barcode symbology?
DataSrce$ = MID$(DataInfo$, Delimiter + 1)‘Slot, Wand, Laser?
IF DataType$ = “C39” AND DataSrce$ = “SLOT” THEN EXIT DO

LOOP

IOCTL[#]filenumber,string

See IOCTL$ statement. See the chapter on Special Devices for details about
specific devices.

OPEN “HOST” FOR OUTPUT AS #1
IOCTL #1, “33” ‘Change last 2 digits of record prefix sent to HOST to 33.

KILL “filespec”

Deletes file “filespec” from memory and releases that memory space for use
by future files. KILL “!” deletes all files (except the QUE) in the DH5
terminal. See also the limits page in the A-B VBASIC manual. “*.*”
wildcards are not used to avoid problems with deleting files on the PC. All
remarks in VBDOS manual are applicable to A-B VBASIC, except those
relating to directories. Like VBDOS, KILL is only valid on a CLOSEd file.
However A-B VBASIC will not issue an error message if this is attempted,
and the consequences can be dire! The QUE can be forcibly emptied by
issuing a KILL “QUE” statement explicitly.

Advertising