星期三, 11月 08, 2023

2008-03-28 如何取得 Journal Receiver 的屬性?(Command RTVJRNRCVA with API QjoRtvJrnReceiverInformation)


如何取得 Journal Receiver 的屬性?(Command RTVJRNRCVA with API QjoRtvJrnReceiverInformation)

如何取得 Journal Receiver 的屬性?(Command RTVJRNRCVA with API QjoRtvJrnReceiverInformation)


File   : QCLSRC
Member : RTVJRNRCVA
Type   : CLLE
Usage  : CRTBNDCL PGM(RTVJRNRCVA)


/*  ===============================================================  */
/*  = Command RtvJrnRcvA CPP                                      =  */
/*  =   RtvJrnRcvA CLLE                                           =  */
/*  ===============================================================  */
/*  = Date  : 2008/03/14                                          =  */
/*  = Author: Vengoal Chang                                       =  */
/*  ===============================================================  */

PGM PARM(&QUALRCVR &RTNLIB &STATUS &ASP &THRESHOLD &SIZE &NBRENTP +
         &MAXNULIND &MAXENTLEN &MAXENTLENP &RCVMAXOPT +
         &FSTSEQNBRP &LSTSEQNBRP &ACTDATTIM &DACTDATTIM &SAVDATTIM +
         &JRNNAME &JRNLIB &TEXT)

             DCL        VAR(&QUALRCVR) TYPE(*CHAR) LEN(20)
             DCL        VAR(&RCVRNAME) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RCVRLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&RTNLIB ) TYPE(*CHAR) LEN(10)
             DCL        VAR(&JRNNAME) TYPE(*CHAR) LEN(10)
             DCL        VAR(&JRNLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&THRESHOLD) TYPE(*DEC) LEN( 7 0)
             DCL        VAR(&SIZE)      TYPE(*DEC) LEN( 7 0)
             DCL        VAR(&ASP )      TYPE(*DEC) LEN(3 0)
             DCL        VAR(&NBRENT   ) TYPE(*DEC) LEN(10 0)
             DCL        VAR(&NBRENTP  ) TYPE(*DEC) LEN(15 0)
             DCL        VAR(&NBRENT2  ) TYPE(*CHAR) LEN(20)
             DCL        VAR(&MAXENTLEN) TYPE(*DEC) LEN( 7 0)
             DCL        VAR(&MAXENTLENP) TYPE(*DEC) LEN(15 0)
             DCL        VAR(&MAXENTLEN2) TYPE(*CHAR) LEN(20)
             DCL        VAR(&MAXNULIND) TYPE(*DEC) LEN(15 0)
             DCL        VAR(&MINDTAARA) TYPE(*CHAR) LEN(1)
             DCL        VAR(&MINDTAFLE) TYPE(*CHAR) LEN(1)
             DCL        VAR(&RCVMAXOPT) TYPE(*CHAR) LEN(1)
             DCL        VAR(&FSTSEQNBR) TYPE(*DEC) LEN(15 0)
             DCL        VAR(&LSTSEQNBR) TYPE(*DEC) LEN(15 0)
             DCL        VAR(&FSTSEQNBRP) TYPE(*DEC) LEN(15 0)
             DCL        VAR(&FSTSEQNBRL) TYPE(*CHAR) LEN(20)
             DCL        VAR(&LSTSEQNBRP) TYPE(*DEC) LEN(15 0)
             DCL        VAR(&LSTSEQNBRL) TYPE(*CHAR) LEN(20)

             DCL        VAR(&STATUS) TYPE(*CHAR) LEN(1)
         /*   1  *ATTACHED   Currently attached                     */
         /*   2  *ONLINE     On line, detached, but not saved       */
         /*   3  *SAVED      On line, detached, and saved           */
         /*   4  *FREED      On line, detached, saved and stg freed */
         /*   5  *PARTIAL    See note                               */
         /*   6  *EMPTY      Never attached                         */

             DCL        VAR(&ACTDATTIM) TYPE(*CHAR) LEN(13)
                        /* CYYMMDDHHMMSS */
             DCL        VAR(&DACTDATTIM) TYPE(*CHAR) LEN(13)
             DCL        VAR(&SAVDATTIM) TYPE(*CHAR) LEN(13)
             DCL        VAR(&TEXT) TYPE(*CHAR) LEN(50)

             DCL        VAR(&RCV) TYPE(*CHAR) LEN(512)
             DCL        VAR(&RCVLEN) TYPE(*CHAR) LEN(4)
             DCL        VAR(&JRNRCV) TYPE(*CHAR) LEN(20)
             DCL        VAR(&FSTSEQNBRC) TYPE(*CHAR) LEN(20)
             DCL        VAR(&LSTSEQNBRC) TYPE(*CHAR) LEN(20)
             DCL        VAR(&RCVRINFO) TYPE(*CHAR) LEN(20)
             DCL        VAR(&WORK) TYPE(*CHAR) LEN(4)

             DCL        VAR(&MSGID) TYPE(*CHAR) LEN(7)
             DCL        VAR(&MSGDTA) TYPE(*CHAR) LEN(256)
             DCL        VAR(&MSGF) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSGTXT) TYPE(*CHAR) LEN(256)

          MONMSG     MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(ERROR))

             CHGVAR     VAR(&RCVRNAME) VALUE(%SST(&QUALRCVR  1 10))
             CHGVAR     VAR(&RCVRLIB ) VALUE(%SST(&QUALRCVR 11 10))
             CHKOBJ     OBJ(&RCVRLIB/&RCVRNAME) OBJTYPE(*JRNRCV)
             If         (&RCVRLIB *EQ '*LIBL') Do
             RTVOBJD    OBJ(&RCVRLIB/&RCVRNAME) OBJTYPE(&JRNRCV) +
                          RTNLIB(&RTNLIB)
             MONMSG     MCH3601
             EndDo
             Else Do
             CHGVAR     VAR(&RTNLIB) VALUE(&RCVRLIB)
             MONMSG     MCH3601
             EndDo

             CHGVAR     VAR(%BIN(&RCVLEN)) VALUE(512)
             CHGVAR     VAR(&JRNRCV) VALUE(&RCVRNAME *CAT &RCVRLIB)
             CALLPRC PRC('QjoRtvJrnReceiverInformation') +
                        PARM((&RCV) (&RCVLEN) (&JRNRCV) +
                        ('RRCV0100') (*OMIT))
             CHGVAR     VAR(&JRNNAME) VALUE(%SST(&RCV 29 10))
             MONMSG     MCH3601
             CHGVAR     VAR(&JRNLIB) VALUE(%SST(&RCV 39 10))
             MONMSG     MCH3601
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 49 4))
             CHGVAR     VAR(&THRESHOLD) VALUE(%BIN(&WORK))
             MONMSG     MCH3601
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 53 4))
             CHGVAR     VAR(&SIZE) VALUE(%BIN(&WORK))
             MONMSG     MCH3601
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 57 4))
             CHGVAR     VAR(&ASP) VALUE(%BIN(&WORK))
             MONMSG     MCH3601
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 61 4))
             CHGVAR     VAR(&NBRENT) VALUE(%BIN(&WORK))
             MONMSG     MCH3601
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 65 4))
             CHGVAR     VAR(&MAXENTLEN) VALUE(%BIN(&WORK))
             MONMSG     MCH3601
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 69 4))
             CHGVAR     VAR(&MAXNULIND) VALUE(%BIN(&WORK))
             MONMSG     MCH3601
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 73 4))
             CHGVAR     VAR(&FSTSEQNBR) VALUE(%BIN(&WORK))
             CHGVAR     VAR(&MINDTAARA) VALUE(%SST(&RCV 77 1))
             CHGVAR     VAR(&MINDTAFLE) VALUE(%SST(&RCV 78 1))
             CHGVAR     VAR(&WORK) VALUE(%SST(&RCV 81 4))
             CHGVAR     VAR(&LSTSEQNBR) VALUE(%BIN(&WORK))
             CHGVAR     VAR(&STATUS) VALUE(%SST(&RCV 89 1))
             MONMSG     MCH3601
             CHGVAR     VAR(&RCVMAXOPT) VALUE(%SST(&RCV 89 1))
             MONMSG     MCH3601
             CHGVAR     VAR(&ACTDATTIM) VALUE(%SST(&RCV 96 13))
             MONMSG     MCH3601
             CHGVAR     VAR(&DACTDATTIM) VALUE(%SST(&RCV 109 13))
             MONMSG     MCH3601
             CHGVAR     VAR(&SAVDATTIM) VALUE(%SST(&RCV 122 13))
             MONMSG     MCH3601
             CHGVAR     VAR(&NBRENT2) VALUE(%SST(&RCV 373 20))
             CHGVAR     VAR(&NBRENTP) VALUE(&NBRENT2)
             MONMSG     MCH3601
             CHGVAR     VAR(&MAXENTLEN2) VALUE(%SST(&RCV 393 20))
             CHGVAR     VAR(&MAXENTLENP) VALUE(&MAXENTLEN2)
             MONMSG     MCH3601
             CHGVAR     VAR(&FSTSEQNBRL) VALUE(%SST(&RCV 413 20))
             CHGVAR     VAR(&FSTSEQNBRP) VALUE(&FSTSEQNBRL)
             MONMSG     MCH3601
             CHGVAR     VAR(&LSTSEQNBRL) VALUE(%SST(&RCV 433 20))
             CHGVAR     VAR(&LSTSEQNBRP) VALUE(&LSTSEQNBRL)
             MONMSG     MCH3601
             CHGVAR     VAR(&TEXT) VALUE(%SST(&RCV 135 50))
             MONMSG     MCH3601

             Return

/*  ===============================================================  */
/*  = Error routine                                               =  */
/*  ===============================================================  */

Error:

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

SndMsg:

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

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

ENDPGM



File   : QCMDSRC
Member : RTVJRNRCVA
Type   : CMD
Usage  : CRTCMD CMD(your-lib/RTVJRNRCVA) PGM(your-lib/RTVJRNRCVA) ALLOW(*IPGM *BPGM) 

/*  ===============================================================  */
/*  = Command....... RtvJrnrcvA                                   =  */
/*  = CPP........... RtvJrnRcvA CLLE                              =  */
/*  = Description... Retrieve journal receiver attributes         =  */
/*  =                                                             =  */
/*  = CrtCmd      Cmd( RtvJrnrcvA )                               =  */
/*  =             Pgm( RtvJrnrcvA )                               =  */
/*  =             SrcFile( YourSourceFile )                       =  */
/*  =             Allow(*Ipgm *Bpgm)                              =  */
/*  ===============================================================  */
/*  = Date  : 2008/03/14                                          =  */
/*  = Author: Vengoal Chang                                       =  */
/*  ===============================================================  */
/*  = Parameter     Description                                   =  */
/*  =   JRNRCV      The qualified name of the journal receiver to =  */
/*  =               be retrieved.                                 =  */
/*  =   RTNLIB      The library containing the journal receiver.  =  */
/*  =   STATUS      The status of the journal receiver. One of the=  */
/*  =               following values will be returned:            =  */
/*  =               *ATTACHED   Currently attached                =  */
/*  =               *ONLINE     On line, detached, but not saved  =  */
/*  =               *SAVED      On line, detached, and saved      =  */
/*  =               *FREED      On line, detached, saved and stg  =  */
/*  =                           freed.                            =  */
/*  =               *PARTIAL    See API detail                    =  */
/*  =                           QjoRetrieveJournalInformation     =  */
/*  =               *EMPTY      Never attached                    =  */
/*  =   ASP         The Auxiliary Storage pool containing the     =  */
/*  =               journal.                                      =  */
/*  =   THRESHOLD   The value of the THRESHOLD parameter specified=  */
/*  =               on CRTJRNRCV                                  =  */
/*  =   SIZE        The size of the journal receiver.specified    =  */
/*  =               The value is in KB.                           =  */
/*  =   NBRENT      The number of entries in the journal receiver.=  */
/*  =   MAXNULLIND  The maximum number of null value indicators   =  */
/*  =               among all journal entries in this journal     =  */
/*  =               receiver.                                     =  */
/*  =   MAXENTLEN   The maximum length of the entry specific data =  */
/*  =               for any journal entry, If the value exceeds   =  */
/*  =               99999, zero willbe returned.(use MAXENTLEN2). =  */
/*  =   MAXENTLEN2  The maximum length of the entry specific data =  */
/*  =               for any journal entry                         =  */
/*  =   RCVMAXOPT   Indicates the journal receiver sequence number=  */
/*  =               and size options.                             =  */
/*  =               Blank means the journal receiver has not yet  =  */
/*  =               been attached. A description of the codes can =  */
/*  =               be found in QjoRtvJrnReceiverInformation API. =  */
/*  =   FSTSEQNBR   The first journal sequence number in the      =  */
/*  =               receiver.                                     =  */
/*  =   LSTSEQNBR   The last journal sequence number in the       =  */
/*  =               receiver.                                     =  */
/*  =   ATCDATTIM   The date the journal receiver was attached in =  */
/*  =               the format CYYMMDDHHMMSS                      =  */
/*  =   DATCDATTIM  The date the journal receiver was detached in =  */
/*  =               the format CYYMMDDHHMMSS                      =  */
/*  =   SAVDATTIM   The date the journal receiver was saved    in =  */
/*  =               the format CYYMMDDHHMMSS                      =  */
/*  =   JRN         The journal the receiver is or was attached to=  */
/*  =               If never attached, the value will be blank.   =  */
/*  =   JRNLIB      The library of the journal the receiver is or =  */
/*  =               was attached to. If never attached, the value =  */
/*  =               will be blank.                                =  */
/*  =   TEXT        The text description of the journal receiver. =  */
/*  ===============================================================  */
             CMD        PROMPT('Retrieve Journal Receiver Atr')

             PARM       KWD(JRNRCV) TYPE(QUAL) MIN(1) +
                          PROMPT('Journal receiver')

             PARM       KWD(RTNLIB) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
                          PROMPT('CL var for RTNLIB       (10)')
             PARM       KWD(STATUS) TYPE(*CHAR) LEN(1) RTNVAL(*YES) +
                          PROMPT('CL var for STATUS       ( 1)')
             PARM       KWD(ASP) TYPE(*DEC) LEN(3 0) RTNVAL(*YES) +
                          PROMPT('CL var for ASP         (3 0)')
             PARM       KWD(THRESHOLD) TYPE(*DEC) LEN(7 0) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          THRESHOLD   (7 0)')
             PARM       KWD(SIZE) TYPE(*DEC) LEN(7 0) RTNVAL(*YES) +
                          PROMPT('CL var for SIZE        (7 0)')
             PARM       KWD(NBRENT) TYPE(*DEC) LEN(15 0) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          NBRENT     (15 0)')
             PARM       KWD(MAXNULLIND) TYPE(*DEC) LEN(15 0) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          MAXNULLIND (15 0)')
             PARM       KWD(MAXENTLEN) TYPE(*DEC) LEN( 7 0) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          MAXENTLEN  (15 0)')
             PARM       KWD(MAXENTLEN2) TYPE(*DEC) LEN(15 0) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          MAXENTLEN2 (15 0)')
             PARM       KWD(RCVMAXOPT ) TYPE(*CHAR) LEN(1) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          RCVMAXOPT     (1)')
             PARM       KWD(FSTSEQNBR) TYPE(*DEC) LEN(15 0) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          FSTSEQNBR  (15 0)')
             PARM       KWD(LSTSEQNBR) TYPE(*DEC) LEN(15 0) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          LSTSEQNBR  (15 0)')
             PARM       KWD(ACTDATTIM) TYPE(*CHAR) LEN(13) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          ACTDATTIM    (13)')
             PARM       KWD(DACTDATTIM) TYPE(*CHAR) LEN(13) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          DACTDATTIM   (13)')
             PARM       KWD(SAVDATTIM) TYPE(*CHAR) LEN(13) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          SAVDATTIM    (13)')
             PARM       KWD(JRN) TYPE(*CHAR) LEN(10) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          JRN          (10)')
             PARM       KWD(JRNLIB) TYPE(*CHAR) LEN(10) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          JRNLIB       (10)')
             PARM       KWD(TEXT) TYPE(*CHAR) LEN(50) +
                          RTNVAL(*YES) PROMPT('CL var for +
                          TEXT         (50)')


 QUAL:       QUAL       TYPE(*NAME) LEN(10) SPCVAL((*ALL)) EXPR(*YES)
             QUAL       TYPE(*NAME) LEN(10) DFT(*LIBL) +
                          SPCVAL((*LIBL) (*CURLIB)) EXPR(*YES) +
                          PROMPT('Library')



File   : QCLSRC
Member : RTVJRNRCVT
Type   : CLP
Usage  : 測試程式 
         CRTCLPGM RTVJRNRCVT
         CALL RTVJRNRCVT 

PGM
     DCL &FSTSEQNBR *DEC 15 0
     DCL &LSTSEQNBR *DEC 15 0
     DCL &RTNLIB    *CHAR 10
     DCL &STATUS    *CHAR 1
     DCL &ASP       *DEC  3 0
     DCL &THRESHOLD *DEC  7 0
     DCL &SIZE      *DEC  7 0
     DCL &NBRENT    *DEC 15 0
     DCL &MAXENTLEN *DEC 7 0
     DCL &MAXENTLEN2 *DEC 15 0
     DCL &MAXNULIND  *DEC 15 0
     DCL &RCVMAXOPT  *CHAR 50
     DCL &ACTDATTIM  *CHAR 13
     DCL &DACTDATTIM  *CHAR 13
     DCL &SAVDATTIM  *CHAR 13
     DCL &JRN        *CHAR 10
     DCL &JRNLIB     *CHAR 10
     DCL &TEXT       *CHAR 50
     DCL &RCVRNAME *CHAR 10    'AUDRCV0075'
     DCL &RCVRLIB  *CHAR 10    'PMEDHJRN'
  /* DCL &RCVRLIB  *CHAR 10    '*LIBL'      */
             RTVJRNRCVA JRNRCV(&RCVRLIB/&RCVRNAME) RTNLIB(&RTNLIB) +
                          STATUS(&STATUS) ASP(&ASP) +
                          THRESHOLD(&THRESHOLD) SIZE(&SIZE) +
                          NBRENT(&NBRENT) MAXNULLIND(&MAXNULIND) +
                          MAXENTLEN(&MAXENTLEN) +
                          MAXENTLEN2(&MAXENTLEN2) +
                          RCVMAXOPT(&RCVMAXOPT) +
                          FSTSEQNBR(&FSTSEQNBR) +
                          LSTSEQNBR(&LSTSEQNBR) +
                          ACTDATTIM(&ACTDATTIM) +
                          DACTDATTIM(&DACTDATTIM) +
                          SAVDATTIM(&SAVDATTIM) JRN(&JRN) +
                          JRNLIB(&JRNLIB) TEXT(&TEXT)
     DMPCLPGM


ENDPGM


                        



沒有留言: