Program Arguments and Entry Points

Some programs accept additional information when they are started.

This information is supplied as arguments.

The documentation for a program should tell you whether it accepts arguments and what they mean.

Running a program with arguments

Place arguments after the program name:

> RUN PROGRAM argument1 argument2

Arguments are passed to the program in the order given.

For example, a program might accept a name:

> RUN GREET Emma

or an option:

> RUN GAME hard

Exactly what an argument means depends on the program receiving it.

RUN can provide up to eight arguments.

Arguments with queued programs

QUEUE and NEXT accept arguments in the same way:

> QUEUE PROGRAM argument1 argument2
> NEXT PROGRAM argument1 argument2

The arguments are kept with the program while it waits in the execution queue and are provided when the program eventually starts.

QUEUE and NEXT can each provide up to eight arguments.

See The Execution Queue for more information about queued programs.

Accessing arguments from NCL

Inside an NCL program, arguments are available as numbered constants.

The first argument is #0, followed by #1, and so on.

For example:

> RUN PROGRAM first second third

provides:

Constant Value
#0 "first"
#1 "second"
#2 "third"

RUN, QUEUE, and NEXT can provide up to eight arguments, available as #0 through #7.

See System & Program Control for the complete NCL reference.

Starting at another entry point

RUNA starts a program at a specific label or line number instead of its normal entry point.

RUNA <program> <entry> [arguments...]

For example:

> RUNA THEME $green

or:

> RUNA PROGRAM 42

Include the $ when specifying a label.

RUNA can also provide up to seven program arguments. The entry point itself is not passed to the program.

Arguments are available as #0 through #6.

RUNA is primarily useful when developing, debugging, or deliberately starting a program at an alternate entry point.

See System & Program Control for complete details.