Command-line arguments

z/OS® XL C/C++ treats arguments that you enter on the command line differently in different environments. The following lists how argv and argc are handled.

The maximum allowable length of a command-line argument for z/OS Language Environment® is 64K.

Under z/OS batch

argc
Returns the number of strings in the argument line
argv[0]
Returns the program name in uppercase
argv[1 to n]
Returns the arguments as you enter them

Under IBM® IMS™

argc
Returns 1
argv[0]
Is a null pointer

Under IBM CICS®

argc
Returns 1
argv[0]
Returns the transaction ID

Under TSO command

argc
Returns the number of strings in the argument line
argv[0]
Returns the program name in uppercase
argv[1 to n]
Arguments entered in uppercase are returned in lowercase. Arguments entered in mixed or lowercase are returned as entered.

Under TSO call

Without the ASIS option:
argc
Returns the number of strings in the argument line
argv
Returns the program name and arguments in lowercase
With the ASIS option:
argc
Returns the number of strings in the argument line
argv[0]
Returns the program name in uppercase
argv[1 to n]
Arguments entered in uppercase are returned in lowercase. Arguments entered in mixed or lowercase are returned as entered.

Under z/OS UNIX System Services shell

argc
Returns the number of strings in the argument line
argv[0]
Returns the program name as you enter it
argv[1 to n]
Returns the arguments exactly as you enter them

The only delimiter for the arguments that are passed to main() is white space. z/OS XL C/C++ uses commas passed to main() by JCL as arguments and not as delimiters.

The following example appends the comma to the 'one' when passed to main().
//FUNC  EXEC PCGO,GPGM='FUNC',
//      PARM.GO=('one',
//      'two')

For more information on restrictions of the command-line arguments, refer to z/OS XL C/C++ User's Guide.