ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Override php errors to specific queue

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

  • Override php errors to specific queue

    We have PHP scripts that are being run from an AS/400 CL. How can I capture any/all errors that would be thrown from the PHP itself and move them into a non printer queue?

  • #2
    Re: Override php errors to specific queue

    I would like to see a sample of that.

    Can you post one of your CLLE programs?

    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Override php errors to specific queue

      I haven't done this but if sounds like from your description that the PHP errors are written to a spool file? If so, you can change the output queue with the job description or by issuing a CHGJOB within the CL.

      Comment


      • #4
        Re: Override php errors to specific queue

        @Jamie, sure!

        Code:
                     PGM        PARM(&ORD &PGM)
                     DCL        VAR(&ORD) TYPE(*CHAR) LEN(6)
                     DCL        VAR(&PGM) TYPE(*CHAR) LEN(30)
                     DCL        VAR(&PARM) TYPE(*CHAR) LEN(60)
        
                     DCL        VAR(&LIBNAME) TYPE(*CHAR) LEN(10) +
                                  VALUE('BSDLIB    ')
                     DCL        VAR(&PGMNAME) TYPE(*CHAR) LEN(10) +
                                  VALUE('WEBOCNFCL ')
                     DCL        VAR(&RUNDATE) TYPE(*CHAR) LEN(6)
                     DCL        VAR(&RUNTIME) TYPE(*CHAR) LEN(6)
                     DCL        VAR(&PGMUSER) TYPE(*CHAR) LEN(10)
                     OVRDBF     FILE(PGMLOG) TOFILE(PGMLOG) +
                                  RCDFMTLCK((PGMLOGPF *SHRUPD))
                     RTVJOBA    DATE(&RUNDATE) CURUSER(&PGMUSER)
                     RTVSYSVAL  SYSVAL(QTIME) RTNVAR(&RUNTIME)
                     CALL       PGM(REFPGM) PARM(&LIBNAME &PGMNAME &RUNDATE +
                                 &RUNTIME &PGMUSER)
        
                     CHGVAR     VAR(&PARM) VALUE(&ORD *TCAT '&PA' *TCAT '&' +
                                  *TCAT &PGM)
                     
                     CALL       PGM(QP2SHELL) +
                                  PARM('/USR/LOCAL/ZENDSVR/BIN/PHP-CLI' +
                                  '/WWW/ZENDSVR/HTDOCS/WEB/orderConfirmationE+
                                  mail/orderConfirmation.php' &PARM)
                     
        
                     ENDPGM

        Comment


        • #5
          Re: Override php errors to specific queue

          Originally posted by Scott M View Post
          I haven't done this but if sounds like from your description that the PHP errors are written to a spool file? If so, you can change the output queue with the job description or by issuing a CHGJOB within the CL.
          Yes, they are getting written to a spool file that based on the user hits their printer.

          The easiest solution is to quit making mistakes in the code. <_< but somehow something always pops up.

          Comment


          • #6
            Re: Override php errors to specific queue

            Thanks for the sample, been thinking about this myself.
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: Override php errors to specific queue

              @Scott - Does the CHGJOB OUTQ change effect all things that user would run or only the one job I am doing?

              Comment


              • #8
                Re: Override php errors to specific queue

                It would change everything in the job. So you should use RTVJOBA to retrieve the current outq before you change it. Then after running your command the program can put it back to what is was originally.

                Comment


                • #9
                  Re: Override php errors to specific queue

                  Forgive me, I've not done a ton of CL programming before. You are talking something like this?

                  Code:
                   RTVJOBA    OUTQ(&USEROUTQ)
                   CHGJOB     OUTQ(PHPLOG)
                   CALL       PGM(QP2SHELL) +
                                 PARM('/USR/LOCAL/ZENDSVR/BIN/PHP-CLI' +
                                         '/WWW/ZENDSVR/HTDOCS/WEB/orderConfirmationE+
                                         mail/orderConfirmation.php' &PARM)
                   CHGJOB     OUTQ(&USEROUTQ)

                  Comment


                  • #10
                    Re: Override php errors to specific queue

                    Yes, probably want to also get the outq library also just to make sure you reset it back to the correct one.

                    Comment

                    Working...
                    X