ARGPARSE | NOARGPARSE

Category

Object code control

Pragma equivalent

None.

Purpose

Parses arguments provided on the invocation line.

When ARGPARSE is in effect, arguments supplied to your program on the invocation line are parsed and passed to the main() routine in the C argument format, commonly argc and argv. argc contains the argument count, and argv contains the tokens after the command processor has parsed the string.

When NOARGPARSE is in effect, arguments on the invocation line are not parsed, argc has a value of 2, and argv contains a pointer to the string.

Syntax

Read syntax diagramSkip visual syntax diagramARGNOARG

Defaults

ARGPARSE

Usage

If you specify NOARGPARSE, you cannot specify REDIR. The compiler will turn off REDIR with a warning since the whole string on the command line is treated as an argument and put into argv.

Starting with z/OS® V1R13, the ARGPARSE option is supported with the METAL option.

Note: NOARGPARSE is ignored for the following programs:
  • Programs that use spawn() or exec().
  • Programs that are started by the z/OS UNIX System Services shell or by the BPXBATCH utility.
  • METAL programs that are dubbed.

This option has no effect under CICS®.

The usage status of this option is inserted in the object file to aid you in diagnosing a problem with your program.

IPA effects

If you specify ARGPARSE for any compilation unit in the IPA compile step, the compiler generates information for the IPA link step. This option also affects the regular object module if you request one by specifying the IPA(OBJECT) option.

If you specify this option for both the IPA Compile and the IPA link steps, the setting on the IPA link step overrides the setting on the IPA compile step. This applies whether you use ARGPARSE and NOARGPARSE as compiler options, or specify them using the #pragma runopts directive on the IPA compile step.

If you specified ARGPARSE on the IPA compile step, you do not need to specify it again on the IPA link step to affect that step. The IPA link step uses the information generated for the compilation unit that contains the main() function. If it cannot find a compilation unit that contains main(), it uses the information generated by the first compilation unit that it finds.

Predefined macros

None.