I built a simple program try to print the command line parameters.
The code is below and I built an executable file (TEST.EXE).
int main(int argc, char *argv[])
{
int i;
printf("%s\n",argv[0]);
for (i = 1; i < argc; i++)
printf("argument %d: %s\n", i, argv[i]);
exit (EXIT_SUCCESS);
}
I try to run the TEST.EXE and print the parameters but fail.
The result of command RUN TEST.EXE test1 test2
:
%DCL-W-MAXPARM, too many parameters - reenter command with fewer parameters
What can I do to print "test1" and "test2"?
The RUN
command doesn't support any command line arguments. Define a foreign command and use that instead. From David Mathog's beginner FAQ:
How do I start a program?
Method 2: Use the
RUN
command:
$ run program_name
No command line arguments allowed
Method 3: Define a foreign command for it, then run it. In the following example where is a logical name equivalent to the location of the program.
$ new_command :== $where:program_name
$ new_command [command line arguments]
Defining a foreign command as per 'a3f' is the 'proper' way to do it albeit somewhat tedious and 2-stepped.
You may also want to try the MCR 'trick'. MCR being short for the Monitor Command Routine from the 40+ year old PDPD-11 Operating System RSX.
Now MCR defaults to look for program in SYS$SYSTEM, so you do have to specify the current location:
$ MCR dev:[dir]TEST this is a test.
There is also a 1-1/2 step approach using DCL$PATH. This works mostly like the Unix and Windows path, providing places to look for DCL scripts or programs if an unknown command is entered.
For example
$ DEFINE DCL$PATH SYS$DISK:[],SYS$LOGIN:,SYS$SYSTEM:
Now just type : TEST this.
Hein
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With