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

Appendix E. Batch processing sample

The following code samples show how to implement a 'batch compiler' with Enterprise PL/I.

  batch: proc options(main);

     dcl eof     bit(1);
     dcl rc      fixed bin(15);
     dcl system  builtin;
     dcl source  char(80);
     dcl sysutz  file output record sequential
                 env( fb,recsize(80) );

     dcl compin  file input record sequential;

     dcl plixopt ext static char(40) var
                 init('errcount(0),heap(2m,1m,any,free)');

     open file(compin);

     rc = 0;
     eof = '0'b;
     data_read = '0'b;
     on endfile(compin) eof = '1'b;

     data_read = '0'b;
     open file(sysutz);
     read file(compin) into(source);
     do while( eof = '0'b );
       if substr(source,1,8) = '*PROCESS' then
         if data_read then
           do;
             close file(sysutz);

             rc = max( rc, system('ibmzpli @dd:options') );

             data_read = '0'b;
             open file(sysutz);
           end;
         else;
       else
         data_read = '1'b;
       write file(sysutz) from(source);
       read file(compin) into(source);
     end;

     close file(sysutz);

     rc = max( rc, system('ibmzpli @dd:options') );
     call pliretc(rc );
   end;

This program when compiled and linked could be used as a "batch compiler" if the following JCL were used when the program is run.

  //SYSPRINT  DD SYSOUT=*
  //OPTIONS   DD  *
   dd(*,sysutz) name
   limits(extname(7)) norent cmpat(v2)
  //COMPIN    DD  *
  *PROCESS X(F);
    x: proc;
      dcl a ext char(80);
    end;
  *PROCESS NORENT;
    y: proc;
      dcl b ext char(40);
    end;
  //SYSLIN   DD DSN=...,DISP=(MOD)
  //SYSUT1    DD DSN=&&SYSUT1,UNIT=SYSDA,
  //             SPACE=(1024,(200,50),,CONTIG,ROUND),DCB=BLKSIZE=1024
  //SYSUTZ  DD DSN=&&SOURCE,DISP=(NEW),UNIT=SYSSQ,
  //             SPACE=(CYL,(3,1))

The first line in the OPTIONS DD specifies the DD(*,SYSUTZ) and NAME and is necessary to make the program work as a batch compiler. The second line is used merely as an example.


Terms of use | Feedback

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