Figure 3B - PrtObjAut command processing program PrtObjAut1

 
/*  ===============================================================  */
/*  =  Program....... PrtObjAut1                                  =  */
/*  =  Source type... CLP                                         =  */
/*  =  Type.......... Command processing program for PrtObjAut    =  */
/*  =  Description... Print Object Authorities                    =  */
/*  =  ---------------------------------------------------------  =  */
/*  =  Parameters                                                 =  */
/*  =                                                             =  */
/*  =    &Obj            Input     Qualified object name          =  */
/*  =                                                             =  */
/*  =    &ObjType        Input     Object type                    =  */
/*  ===============================================================  */

Pgm        (                                                          +
             &Obj                                                     +
             &ObjType                                                 +
           )

/*  ===============================================================  */
/*  = Variable declarations                                       =  */
/*  ===============================================================  */

  Dcl        &Obj        *Char     (   20    )
  Dcl        &ObjType    *Char     (   10    )
  Dcl        &ObjName    *Char     (   10    )
  Dcl        &MsgID      *Char     (    7    )
  Dcl        &MsgF       *Char     (   10    )
  Dcl        &MsgFLib    *Char     (   10    )
  Dcl        &MsgDta     *Char     (  100    )
  Dcl        &ErrorFlag  *Lgl

/*  ===============================================================  */
/*  = File declaration                                            =  */
/*  ===============================================================  */

  DclF       QADspObj

/*  ===============================================================  */
/*  = Global error monitor                                        =  */
/*  ===============================================================  */

  MonMsg     ( CPF0000 MCH0000 ) Exec(                                +
    GoTo       Error                 )

/*  ===============================================================  */
/*  =  Retrieve list of objects to a file                         =  */
/*  ===============================================================  */

  ChgVar     &ObjName    ( %Sst( &Obj  1 10 ) )
  ChgVar     &ObjLib     ( %Sst( &Obj 11 10 ) )

  DspObjD    Obj( &ObjLib/&ObjName )                                  +
             ObjType( &ObjType )                                      +
             Detail( *Basic )                                         +
             Output( *OutFile )                                       +
             OutFile( QTemp/ObjList )

/*  ===============================================================  */
/*  =  Read records in file ObjList and print authorities         =  */
/*  ===============================================================  */

  OvrDbF     File( QADspObj )                                         +
             ToFile( QTemp/ObjList )

ReadBegin:

  RcvF       RcdFmt( QLiDObjD )
  MonMsg     ( CPF0864 ) Exec(                                        +
    GoTo       Exit          )

  DspObjAut  Obj( &ODLbNm/&ODObNm )                                   +
             ObjType( &ODObTp )                                       +
             Output( *Print )

  GoTo       ReadBegin

/*  ===============================================================  */
/*  = Error handler                                               =  */
/*  ===============================================================  */

Error:

  If         ( &ErrorFlag )                                           +
    Do
      SndPgmMsg  MsgID( CPF9897 )                                     +
                 MsgF( QSys/QCPFMsg )                                 +
                 MsgDta( 'Error in PrtObjAut. See joblog.' )          +
                 MsgType( *Escape )
      MonMsg     ( CPF0000 MCH0000 ) Exec(                            +
        Return                           )
    EndDo

  ChgVar     &ErrorFlag  ( '1' )

  RcvMsg     MsgType( *Excp )                                         +
             MsgDta( &MsgDta )                                        +
             MsgID( &MsgID )                                          +
             MsgF( &MsgF )                                            +
             MsgFLib( &MsgFLib )

  MonMsg     ( CPF0000 MCH0000 )

  SndPgmMsg  MsgID( &MsgID )                                          +
             MsgF( &MsgFLib/&MsgF )                                   +
             MsgDta( &MsgDta )                                        +
             MsgType( *Escape )

  MonMsg     ( CPF0000 MCH0000 )

/*  ===============================================================  */
/*  = Clean up and exit program                                   =  */
/*  ===============================================================  */

Exit:

  DltF       QTemp/ObjList
  MonMsg     ( CPF0000 MCH0000 )

/*  ===============================================================  */
/*  = End of program                                              =  */
/*  ===============================================================  */

EndPgm