Announcement

Announcement Module
Collapse
No announcement yet.

Reading a HTML page from a RPG program

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading a HTML page from a RPG program

    I have a situation where I would like my AS/400 to monitor a website to see if it is active... of course the website is running on NT (explaining my concern if it is running). I seem to remember seeing someone that was able to use an RPG to somehow read in a webpage. So, I am thinking that if I set up a RPG to read the web page periodically, I can determine if the page is not responding and issue messages, etc. My problem is I can't find the article about the RPG! If anyone does remember this or has another (better) idea, I would appreciate it. TIA, JC

  • #2
    Reading a HTML page from a RPG program

    I know this doesnt directly answer your question, but would the ability to ping the nt server be adequate? The ability to ping the nt server doesnt guarantee the web site is up, of course. You would know if the nt box was completely down. If pinging sounds ok, just write a simple cl program to periodically ping the nt box. HTH, Alex Garrison

    Comment


    • #3
      Reading a HTML page from a RPG program

      Thanks Alex. First, we are behind an IBM firewall that we have restricted PING activity. Second, the MO of the problems is that the Microsoft IIS server fails, but the TCP functions on the system are still running, which would respond to PINGs whether or not the IIS was up and functioning.

      Comment


      • #4
        Reading a HTML page from a RPG program

        John, How about a simple java program you can run on your as/400 that will read the contents of your website? If it fails to read the url, it will send a message to QSYSOPR. I have a little cl driver program that will call the java class for you (and set your environment variables...). If you are interested, drop me an email and I will send the source code and compiled objects to you. Dont worry if you are not up on java. The cl driver does all the work. You do have to have 5769-JV1 installed (java) on your as/400. Alex Garrison

        Comment


        • #5
          Reading a HTML page from a RPG program

          Thanks alex. What is your email address? Mine is jclark@1stoption.com.

          Comment


          • #6
            Reading a HTML page from a RPG program

            John, I went ahead and sent the java pgm and cl driver pgm to you via email. For anyone else who may be interested, I will repeat the instructions below: Assuming you already have 5769jv1 (java) and 5769JC1 (IBM java toolkit) installed on your as/400: 1. copy the MonitorURL.class file to the /home directory on your as/400. (I just map a drive from my pc to the root directory of my as/400 and then do a copy,paste using windows explorer. Let me know if you need further direction on this.) The MonitorURL.java is the source code and could also be copied to the /home directory but is not necessary. 2. The monurl.txt file is an ILE cl program to call the java class. You compile this with CRTBNDCL PGM(MYLIB/RUNMONURL) SRCFILE(MYLIB/QCLSRC). Remember to define the parms appropriately for your system and url. When you submit the cl program, the only thing you must do is set ALWMLTTHD(*YES). For example, SBMJOB CMD(CALL PGM(MYLIB/RUNMONURL)) JOB(RUNMONURL) JOBQ(QBATCH) ALWMLTTHD(*YES). The cl program as it stands now only runs once. You could easily add a DLYJOB and a GOTO to loop back and iterate infinitely. I actually run this from a pc running nt workstation. Since it is java it runs just as well from a pc and still puts the message in QSYSOPR. The java program writes an 80 byte message to the QSYSOPR message queue with the following layout: mm/dd/yyyy hh:mm:ss SS TT dddddddddddddddddddddddddddddddddddddddddddddddddd ddd where SS = severity level 00 - 99 (99 is bad, 00 is just information) TT = some kind of desired action or escalation number (tbd, 00 for now) dd = message text to appear on the pager. Let me know if you would rather have the message go to a different message queue. It would only take a couple of minutes to make the change and send you a different version of MonitorURL.class. If you dont have 5769JV1 installed, you can install it free off the os/400 cds for your release (I assume you are at v4rx). The 5769JC1 is also on the os/400 media depending on what release you have. As you can see from the small cl program, running the java program is very simple. The only thing that requires a short explanation is the ECHOON parameter. If you set the echoon parm to 'ECHOON', you will get a QPRINT spool file containing the html text of the url each time the java program runs. If you mod the cl program to iterate you will soon have lots of QPRINT spool files hanging about. Just change the parm to 'ECHOFF' to supress the spool file.

            Comment

            Working...
            X