Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

FETCH statement

The FETCH statement checks main storage for the named procedures. Procedures not already in main storage are loaded from the disk.

Read syntax diagramSkip visual syntax diagram>>-FETCH-------------------------------------------------------->
 
   .-,----------------------------------------------------------.
   V                                                            |
>----entry-constant-+-----------------+-+---------------------+-+-->
                    '-SET-(-ptr-ref-)-' '-TITLE-(-char-expr-)-'
 
>--;-----------------------------------------------------------><
 
entry-constant
Specifies the name by which the procedure to be fetched is known to the operating system. Details of the linking considerations for fetchable procedures are given in the Programming Guide.

The entry-constant must be the same as the one used in the corresponding CALL statement, CALL option, or function reference.

SET
Specifies a pointer reference (ptr-ref) that will be set to the address of the entry point of the loaded module. This option can be used to load tables (non-executable load modules). It can also be used for entries that are fetched and whose addresses need to be passed to non-PL/I procedures.

If the load module is later released by the RELEASE statement, and the load module is accessed (through the pointer), unpredictable results can occur.

TITLE
For TITLE, char-expr is any character expression or an expression that can be converted to a character expression. If TITLE is specified, the load module name specified is searched for and loaded. If it is not specified, the load module name used is the environment name specified in the EXTERNAL attribute for the variable (if present) or the entry constant name itself.

For example:

  dcl A entry;
  dcl B entry ext('C');
  dcl T char(20) varying;
  T = 'Y';
 
  fetch A title('X');           /* X is loaded */
  fetch A;                      /* A is loaded */
  fetch B title('Y');           /* Y is loaded */
  fetch B;                      /* C is loaded */
  fetch B title(T);             /* Y is loaded */

For more detailed information on title strings, refer to the Programming Guide.

RELEASE statement

The RELEASE statement frees the main storage occupied by procedures identified by its specified entry constants.

Read syntax diagramSkip visual syntax diagram              .-,--------------.
              V                |
>>-RELEASE--+---entry-constant-+-+--;--------------------------><
            '-*------------------'
 
entry constant
Must be the same as the one used in the corresponding CALL statement, CALL option, function reference, and FETCH statements. RELEASE * releases all previously fetched PL/I modules. It must not be executed from within a fetched module.

Consider the following example, in which ProgA and ProgB are entry names of procedures resident on disk:

         Prog:  procedure;
 
 1          fetch ProgA;
 2          call ProgA;
 3          release ProgA;
 
 4          call ProgB;
            go to Fin;
 
            fetch ProgB;
         Fin:  end Prog;

 1 
ProgA is loaded into main storage by the first FETCH statement.
 2 
ProgA executes when the first CALL statement is reached.
 3 
Storage for ProgA is released when the RELEASE statement is executed.
 4 
ProgB is loaded and executed when the second CALL statement is reached, even though the FETCH statement referring to this procedure is never executed.

The same results would be achieved if the statement FETCH ProgA were omitted. The appearance of ProgA in a RELEASE statement causes the statement CALL ProgA to load the procedure, as well as invoke it.

The fetched procedure is compiled and linked separately from the calling procedure. You must ensure that the entry constant specified in FETCH, RELEASE, and CALL statements; CALL options; and in function references is the name known on the disk. This is discussed in the Programming Guide.


Terms of use | Feedback

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