McIDAS User's Guide
Version 2015.1

[Search Manual] [Table of Contents] [Go to Previous] [Go to Next]


RUN

Runs a McBASI program.


Formats

RUN p1 . . pn FILE= [keywords]
' filename p1 . . pn [keywords]
RUN "statement
' "statement


Parameters

p1 . . pn

positional parameters read by the INPUT statement

filename

name of the McBASI program to run; the extension defaults to .MCB

"statement

McBASI statement to run immediately; 256 characters maximum


Keywords

Clear=

YES

resets the values of the variables to zero or null before starting the program (default when running a program with the FILE keyword)

 

NO

variables retain the values from the previous RUN (default when running the statement immediately)

File=

name of the McBASI program to run; the extension defaults to .MCB; this keyword is required when using RUN, but is invalid when using the single quote format ( ' )

Var=

name of the LW file to store the variable values in after running a program; the file contents are used to initialize the variables unless CLEAR=YES is specified (default=BASICVV1)

 

SHARE

shares variables when one McBASI program runs another


Remarks

RUN will run a tiny BASIC language program prepared using an ASCII editor. The BASIC reserved words are: KEYIN, PRINT, INPUT, LET, GOTO, GOSUB, RETURN, SLEEP, STOP, IF, OPEN, CLOSE, REM, PLOT, PTABLE and POKE. (See Chapter 4, McBASI Interpreter, for more information.)

The arithmetic operators are: + – * / **

These are the available functions and pseudofunctions: CHR$, SIN, COS, TAN, ASIN, ACOS, ATAN, EXP, LOG, LN, ABS, BIN, BIN$, INDEX, LEN, VAL, STR$, MID$, TIME$, DATE$, DAY$, EOF$, TFILE$, TFILD$, TFILC$, TFILB$, TFILA$, MOD, NINT, INT, SQRT, PEEK, PEEK$, KSYS$, KSYS and TABLE$.


See Also

See Chapter 4, McBASI Interpreter, for more information on McBASI interpreter commands, functions and sample programs.


Examples

RUN "?SQRT (5.7)

This entry calculates and prints the value of the square root of 5.7. The question mark is a substitute for PRINT.

'MYPROG 27 #H

This entry runs the program MYPROG.MCB and passes the value 27 and the current time (the string #H) to the INPUT statements in the program.

RUN 27 #H FILE=MYPROG

This entry performs the same function as the previous one. Use this format for programs started from the system scheduler.

'MYPROG CLEAR=NO VAR=MYVARS.VAR

This entry runs the program MYPROG.MCB but recovers the values for all variables from the file MYVARS.VAR. The values are written back to this file when the program ends.

RUN VAR=MYVARS.VAR FILE=MYPROG

This entry runs the program MYPROG.MCB, initializes all variables to zero, and writes the values of the variables into the file MYVARS.VAR when the program ends.

RUN "PTABLE MID$(TIME$,1,2),"HR":KEYIN "TL HR

This entry sets the value of the string HR to the current hour, then lists the value of the string. It can be run once an hour from the scheduler (SKE command) to keep the string's value current for use in commands like PTLIST and PTDISP.

RUN "T=VAL(MID$(TIME$,1,2)):M=T+100:KEYIN"PTCOPY SFC/HOURLY LOCAL/MD.";M" SEL,'CO US;TIME ";T"' DEL,YES

This entry sets the value of T to the current hour and the value of M to the current hour plus 100. It then copies the data for TIME=T for the United States from the most recent point file in the dataset SFC/HOURLY to the dataset LOCAL/MD in the position number equal to the value of M.

For example, if the current time is 12:50 UTC, this entry copies the 12 UTC data for the United States to position 112 of dataset LOCAL/MD. If this entry is run hourly throughout the day, each hour's data is copied to the corresponding position between 100 and 123 in dataset LOCAL/MD.


[Search Manual] [Table of Contents] [Go to Previous] [Go to Next]