ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Dltjrnrcv

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dltjrnrcv

    Hi All,

    I want to delete journal receivers and then monitor for any errors that occur as a part of deletion.
    After monitoring i want to send email to my inbox containing the error text and error ID.
    Below is the code i am trying with variables along with there lenghts declared .
    Please let me know if this is correct

    DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) VALUE(' ')
    DCL VAR(&MSGTEXT) TYPE(*CHAR) LEN(300) VALUE(' ')
    DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) VALUE(' ')
    DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) VALUE(' ')
    DCL VAR(&VAR1) TYPE(*CHAR) LEN(30) VALUE('The +
    journal receiver name is ')
    DCL VAR(&VAR2) TYPE(*CHAR) LEN(20) VALUE('The +
    error code is')

    DLTJRNRCV JRNRCV(*LIBL/&journalreceiver) DLTOPT(*IGNINQMSG)
    MONMSG MSGID(CPF0000) EXEC(DO)
    RCVMSG MSGTYPE(*EXCP) MSG(&MSGTEXT) MSGID(&MSGID) +
    MSGF(&MSGF) MSGFLIB(&MSGFLIB)
    SNDDST TYPE(*LMSG) +
    TOINTNET(('xxx@xxx.com')) +
    DSTD(EMAIL) LONGMSG(' ' *TCAT &MSGTEXT +
    *BCAT &VAR1 *BCAT &ODOBNM *BCAT &VAR2 +
    *BCAT &MSGID *TCAT ' ') SUBJECT('xxx')

    Thanks
    Sumit

  • #2
    Re: Dltjrnrcv

    1) i'd test it first 2) i'd use one of my free email packages instead of that ugly snddst. But I'm crazy or so the voices in my head say so.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Dltjrnrcv

      It's hard to say if it's correct since it's not quite complete. Assuming that &journalreceiver is a placeholder for an actual variable with an appropriate value and that &ODOBNM gets defined with a valid value, it should work. But it might not be "correct". We're not sure what it's actually supposed to do.

      The *LIBL qualifier for JRNRCV() might be trouble; *USRLIBL might be a better choice. Also, if &journalreceiver is going to be a *generic value, I'd guess that this is intended to run over a list of journals and somehow the receiver names can be calculated. It's not clear from the snippet that we see. And of course, we have to assume that the SNDDST command runs in an appropriately configured SNA/DS environment including the bridge to SMTP and the relevant SMTP setup.
      Tom

      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

      Comment


      • #4
        Re: Dltjrnrcv

        DCL VAR(&COUNT) TYPE(*DEC) LEN(10)
        DCL VAR(&$#SYNM) TYPE(*CHAR) LEN(10)
        DCL VAR(&TOTREC) TYPE(*DEC) LEN(10)
        DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) VALUE(' ')
        DCL VAR(&MSGTEXT) TYPE(*CHAR) LEN(300) VALUE(' ')
        DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) VALUE(' ')
        DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) VALUE(' ')
        DCL VAR(&VAR1) TYPE(*CHAR) LEN(30) VALUE('The +
        journal receiver name is ')
        DCL VAR(&VAR2) TYPE(*CHAR) LEN(20) VALUE('The +
        error code is')

        DCLF FILE(ODJRNRCVS)
        RTVEMCHA $#SYNM(&$#SYNM)

        DSPOBJD OBJ(Usrlib/SIJRN*) OBJTYPE(*JRNRCV) +
        OUTPUT(*OUTFILE) OUTFILE(QTEMP/ODJRNRCVS)
        OUTMBR(*FIRST *REPLACE)

        OVRDBF FILE(ODJRNRCVS) TOFILE(QTEMP/ODJRNRCVS)
        RTVMBRD FILE(QTEMP/ODJRNRCVS) NBRCURRCD(&TOTREC)
        NEXT1: RCVF
        MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDCL))
        CHGVAR VAR(&COUNT) VALUE(&COUNT + 1)

        IF COND(&COUNT *EQ &TOTREC) THEN(GOTO +
        CMDLBL(ENDCL))
        DLTJRNRCV JRNRCV(usrlib/&ODOBNM) DLTOPT(*IGNINQMSG)
        MONMSG MSGID(CPF0000) EXEC(DO)
        RCVMSG MSGTYPE(*EXCP) MSG(&MSGTEXT) MSGID(&MSGID) +
        MSGF(&MSGF) MSGFLIB(&MSGFLIB)
        SNDDST TYPE(*LMSG) +
        TOINTNET('xxx.yyy@ggg.com')) +
        DSTD(EMAIL) LONGMSG(' ' *TCAT &MSGTEXT +
        *BCAT &VAR1 *BCAT &ODOBNM *BCAT &VAR2 +
        *BCAT &MSGID *TCAT ' ') SUBJECT(' ')
        GOTO CMDLBL(ENDCL)
        ENDDO
        GOTO NEXT1

        ENDCL:
        ENDPGM


        Please find the complete code.You are right there are number of journal receivers and i am trying to delete except the last one attached with journal JRNMIO

        Thanks for your reply.

        Thanks and Regards
        Sumit Goyal

        Comment


        • #5
          Re: Dltjrnrcv

          Just curious: are you not concerned that these journal receivers have not been saved? Your program just checks to see if the objects exist. It doesn't check the current status.

          Once the journal receivers are deleted, if they are not saved then there would be no way to restore using them because they won't be present anywhere. There would also be no way to query the entries they contain.

          That begs the question, why even have them to begin with? Why not change the journal definition to automatically delete them when they detach?

          .
          "Contrariwise, if it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic."--Tweedledee

          Comment


          • #6
            Re: Dltjrnrcv

            Actually you are right but this was an inbuilt code i used and may be the save functionality is not required.But is the rest of code looks fine to you?

            Comment


            • #7
              Re: Dltjrnrcv

              Without testing, it's hard to be sure. But it looks okay. I would create a test journal, generate a couple receivers and run against it first. The receiver name ("SIJRN*") would be an input parm value so I could call it for any set of receivers.

              Actually, I'd probably remove the DSPOBJD and the RCVF loop, and just run DLTJRNRCV against the generic name. It's not clear why you want to run against each individual receiver, but you probably have your reasons.

              The issue of being saved or not is probably handled separately. Still, that's also something you'll want to look into.
              Tom

              There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

              Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

              Comment


              • #8
                Re: Dltjrnrcv

                Tom,

                Just had a doubt in my coding that suppose i want to trap all the errors that occur as a part of deletion using DLTJRNRCV i have used MONMSG(CPF000).Please let me know suppose there is any other type of error that occurs suppose starting with MCH or something will it be able to catch?
                Or since there is no such type of error for DLTJRNRCV as i searched in IBM material for DLTJRNRCV ,we donot need to bother about such an MCH,etc error.


                Thanks
                Sumit

                Comment


                • #9
                  Re: Dltjrnrcv

                  The extended help text for (almost) any IBM command includes a list of all message IDs that can be monitored. Just prompt the DLTJRNRCV command, press F1 to see the help, and F2 for extended help. Scroll to the bottom to see the list of all possible *ESCAPE messages from the command.
                  Tom

                  There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                  Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                  Comment


                  • #10
                    Re: Dltjrnrcv

                    Thanks a lot for your reply.Highly appreciated.


                    Thanks
                    Sumit

                    Comment


                    • #11
                      Re: Dltjrnrcv

                      You should see that the list in the help text shows that every possible monitored message ID fits the "CPFxxyy" pattern. Therefore, "CPF0000" will match any of them.

                      The patterns work over groups of two hex digits in the numeric portion. A pattern of "CPF2100" would match the IDs from CPF2105 through CPF2189. But a pattern of "CPF2000" wouldn't match anything because none of the available message IDs fit with "CPF20yy". (Unless something has really changed in some recent release!)
                      Tom

                      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                      Comment

                      Working...
                      X