如何立即判斷 AS/400 物件是否有被設定日誌(journal)功能 ?(Command CHKOBJJRN with API QUSROBJD)
前一期是從 Journal 來產生該 Journal 針對哪些物件(PF, Data Queue, Data Area) 做日誌記錄,
本期直接透過 API QUSROBJD 來判斷單一物件是否有啟動日誌功能。
File : QRPGLESRC
Member: CHKOBJJRNR
Type : RPGLE
Usage : CRTBNDRPG CHKOBJJRNR
**
** Program . . : CHKOBJJRNR
** Description : Check Object journaled or not
** Author . . : Vengoal Chang
** Published . : Dimerco Data System Corporation
** Date . . . : June 15, 2005
**
**
** Program summary
** ---------------
**
** Parameters:
** INPUT PxObjNam Object name, the object for which to
** check journaled or not.
**
** INPUT PxObjLib Object library.
**
** OUTPUT PxRtnJrn Journal library and journal name
** Value: If object wasn't journal,
** Return NONE
**
** Object - User space APIs:
** QUSROBJD Retrieve Object Description with OBJD0400 format.
**
**
** Programmer's notes:
** This program checks object journed or not.
**
**
** Compile options:
**
** CrtBndRpg Pgm( CHKOBJJRNR) SrcFile(lib/QRPGLESRC)
** SrcMbr( CHKOBJJRNR ) DbgView( *List )
** **
**-- Header specifications: --------------------------------------------**
H Option( *SrcStmt ) DftActGrp(*NO) Debug
**-- System information: -----------------------------------------------**
D ApiFmtTyp S 8 Based( NulPtrTyp )
D ChrTyp S 1 Based( NulPtrTyp )
D IntTyp S 10I 0 Based( NulPtrTyp )
D LglTyp S 1N Based( NulPtrTyp )
D NamTyp S 10 Based( NulPtrTyp )
D QNamTyp S 20 Based( NulPtrTyp )
D TxtTyp S 50 Based( NulPtrTyp )
D sndpgmmsg PR
D peMsgID 7A const
D peMsgDta 256A const
D outMsgType 10A const
*---------------------------------------------------------------------
* Does the object exist?
*---------------------------------------------------------------------
D ObjExists Pr Like( LglTyp )
D ObjNam Like( NamTyp ) Value
D ObjLib Like( NamTyp ) Value
* Name, *CURLIB, or *LIBL
D ObjTyp Like( NamTyp ) Value
*---------------------------------------------------------------------
* Get the description of an object
*---------------------------------------------------------------------
D GetObjDsc Pr Like( LglTyp )
D ObjNam Like( NamTyp ) Value
D ObjLib Like( NamTyp ) Value
* Name, *CURLIB, or *LIBL
D ObjTyp Like( NamTyp ) Value
D DscFmt Like( ApiFmtTyp ) Value
D ObjDsc Like( ObjDscDs )
* Description formats
D BrfObjDscFmt C 'OBJD0200'
D DtlObjDscFmt C 'OBJD0400'
* Object description returned
D ObjDscDs Ds Inz
* BrfObjDscFmt
D ObjDscLen Like( IntTyp )
D ObjDscSiz Like( IntTyp )
D ObjNam Like( NamTyp )
D ObjLib Like( NamTyp )
D ObjTyp Like( NamTyp )
D ObjRtnLib Like( NamTyp )
D ObjAsp Like( IntTyp )
D ObjOwnr Like( NamTyp )
D ObjDmn 2
D ObjCrtDat 7
D ObjCrtTim 6
D ObjChgDat 7
D ObjChgTim 6
D ObjAtr Like( NamTyp )
D ObjTxt Like( TxtTyp )
D ObjSrcFil Like( NamTyp )
D ObjSrcLib Like( NamTyp )
D ObjSrcMbr Like( NamTyp )
* DtlObjDscFmt
D ObjSrcChgDat 7
D ObjSrcChgTim 6
D ObjSavDat 7
D ObjSavTim 6
D ObjRstDat 7
D ObjRstTim 6
D ObjCrtUsr Like( NamTyp )
D ObjCrtSys 8
D ObjResDat 7
D ObjSavSiz Like( IntTyp )
D ObjSavSeq Like( IntTyp )
D ObjStg Like( NamTyp )
D ObjSavCmd Like( NamTyp )
D ObjSavVolId 71
D ObjSavDvc Like( NamTyp )
D ObjSavFil Like( NamTyp )
D ObjSavLib Like( NamTyp )
D ObjSavLbl 17
D ObjSavLvl 9
D ObjCompiler 16
D ObjLvl 8
D ObjUsrChg Like( ChrTyp )
D ObjLicPgm 16
D ObjPtf Like( NamTyp )
D ObjApar Like( NamTyp )
D ObjUseDat 7
D ObjUsgInf Like( ChrTyp )
D ObjUseDay Like( IntTyp )
D ObjSiz Like( IntTyp )
D ObjSizMlt Like( IntTyp )
D ObjCprSts Like( ChrTyp )
D ObjAlwChg Like( ChrTyp )
D ObjChgByPgm Like( ChrTyp )
D ObjUsrAtr Like( NamTyp )
D ObjOvrflwAsp Like( ChrTyp )
D ObjSavActDat 7
D ObjSavActTim 6
D ObjAudVal Like( NamTyp )
D ObjPrmGrp Like( NamTyp )
D ObjJrnSts Like( ChrTyp )
D ObjJrnNam Like( NamTyp )
D ObjJrnLib Like( NamTyp )
D ObjJrnImg Like( ChrTyp )
D ObjJrnEntOmt Like( ChrTyp )
D ObjJrnStrDat 13
D ObjDgtSgn Like( ChrTyp )
D ObjSavUnt Like( IntTyp )
D ObjSavMul Like( IntTyp )
D ObjLibAsp Like( IntTyp )
D ObjAspDev Like( NamTyp )
D ObjLibAspDev Like( NamTyp )
D ObjDgtSgnSrc Like( ChrTyp )
D ObjDgtSgnMor Like( ChrTyp )
**-- Parameters: -------------------------------------------------------**
D PxObjNam s 10a
D PxObjLib s 10a
D PxObjTyp s 10a
D PxRtnJrn s 20a
**
D ExistLgl S 1N
D PeMsg S 256
C *Entry Plist
C Parm PxObjNam
C Parm PxObjLib
C Parm PxObjTyp
C* Parm PxRtnJrn
C If GetObjDsc( PxObjNam: PxObjLib:
C PxObjTyp: DtlObjDscFmt:
C ObjDscDs )
C If ObjJrnLib <> *blanks
C Eval PeMsg = 'Object ' + %trim(ObjRtnLib) +
C '/' + %trim(PxObjNam) +
C ' with type ' + %trim(PxObjTyp) +
C ' journaled by Journal ' +
C %trim(ObjJrnLib) + '/' +
C %trim(ObjJrnNam)
C Eval PxRtnJrn = ObjJrnLib + ObjJrnNam
C Else
C Eval PeMsg = 'Object ' + %trim(ObjRtnLib) +
C '/' + %trim(PxObjNam) +
C ' with type ' + %trim(PxObjTyp) +
C ' wasn''t journaled'
C Eval PxRtnJrn = 'NONE'
C EndIf
C callp sndpgmmsg('CPF9898' : PeMsg : '*INFO')
C EndIf
C* dump
C
C Return
*==================================================================
P ObjExists B
*==================================================================
D Pi Like( LglTyp )
D ObjNam Like( NamTyp ) Value
D ObjLib Like( NamTyp ) Value
* Name, *CURLIB, or *LIBL
D ObjTyp Like( NamTyp ) Value
C Return GetObjDsc( ObjNam: ObjLib:
C ObjTyp: BrfObjDscFmt:
C ObjDscDs )
P E
*=====================================================================
P GetObjDsc B
*====================================================================
D Pi Like( LglTyp )
D ObjNam Like( NamTyp ) Value
D ObjLib Like( NamTyp ) Value
* Name, *CURLIB, or *LIBL
D ObjTyp Like( NamTyp ) Value
D DscFmt Like( ApiFmtTyp ) Value
D ObjDsc Like( ObjDscDs )
D QObjNam S Like( QNamTyp )
D BrfObjDscSiz C 180
D DtlObjDscSiz C %Size( ObjDscDs )
**-- Api error data structure: ----------------------------------
D ApiError Ds
D AeBytPro 10i 0 Inz( %Size( ApiError ))
D AeBytAvl 10i 0 Inz
D AeMsgId 7a
D 1a
D AeMsgDta 256a
C Reset ObjDscDs
C Eval QObjNam = ObjNam + ObjLib
C If DscFmt = BrfObjDscFmt
C Eval ObjDscSiz = BrfObjDscSiz
C Else
C Eval ObjDscSiz = DtlObjDscSiz
C EndIf
C Eval ObjDsc = ObjDscDs
C Call 'QUSROBJD'
C Parm ObjDsc
C Parm ObjDscSiz
C Parm DscFmt
C Parm QObjNam
C Parm ObjTyp
C Parm ApiError
C If AeBytAvl > *Zero
C callp sndpgmmsg(AeMsgID: AeMsgDta : '*ESCAPE')
C EndIf
C Return ( AeBytAvl = 0 )
P E
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* This ends this program abnormally, and sends back an escape.
* message explaining the failure.
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
P sndpgmmsg B
D sndpgmmsg PI
D peMsgID 7A const
D peMsgDta 256A const
D outMsgType 10A const
D QMHSNDPM PR ExtPgm('QMHSNDPM')
D MessageID 7A Const
D QualMsgF 20A Const
D MsgData 256A Const
D MsgDtaLen 10I 0 Const
D MsgType 10A Const
D CallStkEnt 10A Const
D CallStkCnt 10I 0 Const
D MessageKey 4A
D ErrorCode 32766A options(*varsize)
D dsEC DS
D dsECBytesP 1 4I 0 INZ(256)
D dsECBytesA 5 8I 0 INZ(0)
D dsECMsgID 9 15
D dsECReserv 16 16
D dsECMsgDta 17 256
D wwMsgLen S 10I 0
D wwTheKey S 4A
c eval wwMsgLen = %len(%trimr(peMsgDta))
c if wwMsgLen<1
c return
c endif
c callp QMHSNDPM (PeMsgID : 'QCPFMSG *LIBL':
c peMsgDta: wwMsgLen: %trim(outMsgType):
c '*PGMBDY': 1: wwTheKey: dsEC)
c return
P E
File : QCMDSRC
Member: CHKOBJJRN
Type : CMD
Usage : CRTCMD CMD(CHKOBJJRN) PGM(CHKOBJJRNR)
/********************************************************************/
/* Title: CHKOBJJRN : Check Object Journaled or not */
/* */
/* Author: Vengoal Chang */
/* Date : June 15,2005 */
/* */
/* The Create Command command should include the following: */
/* */
/* CRTCMD CMD(CHKOBJJRN) PGM(CHKOBJJRNR) */
/* */
/********************************************************************/
/*------------------------------------------------*/
/* Command Definition */
/*------------------------------------------------*/
CMD PROMPT('Check Object Journaled')
PARM KWD(OBJECT) TYPE(*NAME) LEN(10) MIN(1) +
EXPR(*YES) PROMPT('Object')
PARM KWD(LIBRARY) +
TYPE(*NAME) +
LEN(10) +
DFT(*LIBL) +
SPCVAL( +
(*LIBL ) +
(*CURLIB *CURLIB )) +
EXPR(*YES) +
PROMPT('Library')
PARM KWD(OBJTYPE) +
TYPE(*CHAR) +
LEN(10) +
RSTD(*YES) +
SPCVAL( +
(*ALRTBL *ALRTBL) +
(*AUTL *AUTL) +
(*BNDDIR *BNDDIR) +
(*CFGL *CFGL) +
(*CHTFMT *CHTFMT) +
(*CLD *CLD) +
(*CLS *CLS) +
(*CMD *CMD) +
(*CNNL *CNNL) +
(*COSD *COSD) +
(*CRG *CRG) +
(*CRQD *CRQD) +
(*CSI *CSI) +
(*CSPMAP *CSPMAP) +
(*CSPTBL *CSPTBL) +
(*CTLD *CTLD) +
(*DEVD *DEVD) +
(*DOC *DOC) +
(*DTAARA *DTAARA) +
(*DTADCT *DTADCT) +
(*DTAQ *DTAQ) +
(*EDTD *EDTD) +
(*EXITRG *EXITRG) +
(*FCT *FCT) +
(*FILE *FILE) +
(*FLR *FLR) +
(*FNTRSC *FNTRSC) +
(*FNTTBL *FNTTBL) +
(*FORMDF *FORMDF) +
(*FTR *FTR) +
(*GSS *GSS) +
(*IGCDCT *IGCDCT) +
(*IGCSRT *IGCSRT) +
(*IGCTBL *IGCTBL) +
(*IMGCLG *IMGCLG) +
(*IPXD *IPXD) +
(*JOBD *JOBD) +
(*JOBQ *JOBQ) +
(*JOBSCD *JOBSCD) +
(*JRN *JRN) +
(*JRNRCV *JRNRCV) +
(*LIB *LIB) +
(*LIND *LIND) +
(*LOCALE *LOCALE) +
(*MEDDFN *MEDDFN) +
(*MENU *MENU) +
(*MGTCOL *MGTCOL) +
(*MODD *MODD) +
(*MODULE *MODULE) +
(*MSGF *MSGF) +
(*MSGQ *MSGQ) +
(*M36 *M36) +
(*M36CFG *M36CFG) +
(*NODGRP *NODGRP) +
(*NODL *NODL) +
(*NTBD *NTBD) +
(*NWID *NWID) +
(*NWSD *NWSD) +
(*OUTQ *OUTQ) +
(*OVL *OVL) +
(*PAGDFN *PAGDFN) +
(*PAGSEG *PAGSEG) +
(*PDG *PDG) +
(*PGM *PGM) +
(*PNLGRP *PNLGRP) +
(*PRDDFN *PRDDFN) +
(*PRDLOD *PRDLOD) +
(*PSFCFG *PSFCFG) +
(*QMFORM *QMFORM) +
(*QMQRY *QMQRY) +
(*QRYDFN *QRYDFN) +
(*RCT *RCT) +
(*SBSD *SBSD) +
(*SCHIDX *SCHIDX) +
(*SPADCT *SPADCT) +
(*SQLPKG *SQLPKG) +
(*SQLUDT *SQLUDT) +
(*SRVPGM *SRVPGM) +
(*SSND *SSND) +
(*SVRSTG *SVRSTG) +
(*S36 *S36) +
(*TBL *TBL) +
(*USRIDX *USRIDX) +
(*USRPRF *USRPRF) +
(*USRQ *USRQ) +
(*USRSPC *USRSPC) +
(*VLDL *VLDL) +
(*WSCST *WSCST)) +
MIN(1) +
EXPR(*YES) +
PROMPT('Object type')
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期二, 11月 07, 2023
2005-06-29 如何立即判斷 AS/400 物件是否有被設定日誌(journal)功能 ?(Command CHKOBJJRN with API QUSROBJD)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言