Example 5: The STACK keyword

Assume these LIBDEF commands are executed:

ISPEXEC LIBDEF ISPPLIB
ISPEXEC LIBDEF ISPPLIB STACK

ISPEXEC LIBDEF ISPPLIB DATASET ID('ISPFPROJ.LWG.PANELS') STACK

ISPEXEC LIBDEF ISPPLIB DATASET ID('ISPFPROJ.LWGMVS33.PANELS') STACK

The execution of these commands produces these results:

  1. The first LIBDEF resets the ISPPLIB LIBDEF definition. This is considered a "null" definition for ISPPLIB.
  2. The second LIBDEF stacks the previous "null" definition for ISPPLIB and resets the ISPPLIB LIBDEF definition. This is the second "null" definition for ISPPLIB.
  3. The third LIBDEF stacks the previous "null" definition for ISPPLIB and establishes the ISPPLIB definition for data set 'ISPFPROJ.LWG.PANELS'.
  4. The fourth LIBDEF stacks the previous ISPPLIB definition for data set 'ISPFPROJ.LWG.PANELS' and establishes the ISPPLIB definition for data set 'ISPFPROJ.LWGMVS33.PANELS'.
Next, these LIBDEF service calls are issued:
ISPEXEC LIBDEF ISPPLIB        (restores 'ISPFPROJ.LWG.PANELS')
 Return code = 0

ISPEXEC LIBDEF ISPPLIB        (restores stacked "null" definition)

 Return code = 0

ISPEXEC LIBDEF ISPPLIB        (restores stacked "null" definition)

 Return code = 0

ISPEXEC LIBDEF ISPPLIB

 Return code = 4

The preceding service calls produce these results:

  1. The first LIBDEF reset restores the ISPPLIB definition for data set 'ISPFPROJ.LWG.PANELS'.
  2. The second LIBDEF reset restores the stacked "null" definition for ISPPLIB. This is the "null" definition which issued the keyword, STACK.
  3. The third LIBDEF restores the stacked "null" definition. This is the "null" definition which did not issue the keyword, STACK.
  4. The fourth LIBDEF receives a return code of 4 because there is nothing in the stack and there is no active ISPPLIB definition.