Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Programming Guide

Invoking MAIN under z/OS UNIX

Under z/OS UNIX, if you compile a MAIN program with the SYSTEM(MVS) option, the program will be passed, as usual, one CHARACTER VARYING string containing the parameters specified when it was invoked.

However, under z/OS UNIX, if you compile a MAIN program with the SYSTEM(OS) option, the program will be passed 7 parameters as specified in the z/OS UNIX manuals. These 7 parameters include:

The program in Figure 17 uses the SYSTEM(OS) interface to address and display the individual arguments and environment variables.

Figure 17. Sample program to display z/OS UNIX args and environment variables
  *process display(std) system(os);

   sayargs:
    proc(argc, pArgLen, pArgStr, envc, pEnvLen, pEnvStr, pParmSelf)
    options( main, noexecops );

     dcl argc                fixed bin(31) nonasgn byaddr;
     dcl pArgLen             pointer nonasgn byvalue;
     dcl pArgStr             pointer nonasgn byvalue;
     dcl envc                fixed bin(31) nonasgn byaddr;
     dcl pEnvLen             pointer nonasgn byvalue;
     dcl pEnvStr             pointer nonasgn byvalue;
     dcl pParmSelf           pointer nonasgn byvalue;

     dcl q(4095)             pointer based;
     dcl bxb                 fixed bin(31) based;
     dcl bcz                 char(31) varz based;

     display( 'argc = ' || argc );
     do jx = 1 to argc;
       display( 'pargStr(jx) =' || pArgStr->q(jx)->bcz );
     end;
     display( 'envc = ' || envc );
     do jx = 1 to envc;
       display( 'pEnvStr(jx) =' || pEnvStr->q(jx)->bcz );
     end;

   end;

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)