Running a DataBasic Program in a Proc

A DataBasic program can be used in a Proc.

Example

The following DataBasic program is called LISTIDS:

   OPEN 'BASIC/TEST' ELSE
     PRINT 'FILE MISSING'; STOP
   END
10 N = 0
20 READNEXT ID ELSE STOP
   PRINT ID 'L##################':
   N=N+1
   IF N >= 4 THEN PRINT; GOTO 10
   GOTO 20
   END

The following Proc, called LISTBT, contains the command to execute the program LISTIDS:

PQN
HSSELECT BASIC/TEST
STON
HRUN BASIC/TEST LISTIDS<
P

To execute this Proc (and the DataBasic program contained within it), simply type in the name of the Proc at the TCL prompt (assuming that LISTBT is contained in the account MD). For example:

:LISTBT

LISTBT sort selects the item-ids contained in the file BASIC/TEST and invokes the DataBasic program LISTIDS, which then lists the selected item-ids, four per line.