× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You can use the send program message API to send an immediate message.
Immediate messages do not need message IDs or message files.  An example
follows.  Seems like a useful method to add to the Toolbox JobLog/RJobLog
object.  I will have Robb add it to our todo list for consideration for a
future release.

   void writeToJobLog()
   {
      try
      {

         AS400 system = new AS400();
         AS400Text char7   = new AS400Text(7,  system);
         AS400Text char10  = new AS400Text(10, system);
         AS400Text char20  = new AS400Text(20, system);
         AS400Text char21  = new AS400Text(21, system);
         AS400Text char80  = new AS400Text(80, system);
         AS400Bin4 bin4    = new AS400Bin4();

         ProgramCall pc = new ProgramCall(system);

         String progName = "/QSYS.LIB/QMHSNDPM.PGM";
         pc.setProgram(progName);

         ProgramParameter[] parms = new ProgramParameter[9];

         // seven spaces means send an immediate message
         parms[0] = new ProgramParameter(char7.toBytes("       "));

         // message file ingored when message id is blanks
         parms[1] = new ProgramParameter(char20.toBytes("
"));

         // Third parm is the message, I am sending up to 80 bytes but I'm
         // sure more can be sent
         parms[2] = new ProgramParameter(char80.toBytes("Hi Mom"));

         // fourth parm is the message length
         parms[3] = new ProgramParameter(bin4.toBytes(80));

         parms[4] = new ProgramParameter(char10.toBytes("*INFO"));
         parms[5] = new ProgramParameter(char21.toBytes("*"));
         parms[6] = new ProgramParameter(bin4.toBytes(0));
         parms[7] = new ProgramParameter(4);

         // last parm is the error area
         byte[] errorArea = new byte[32];
         parms[8] = new ProgramParameter(errorArea, 32);

         pc.setParameterList(parms);

         if (pc.run() != true)
         {
            AS400Message[] messagelist = pc.getMessageList();
            for (int i=0; i < messagelist.length; i++)
            {
                  System.out.println( messagelist[i] );
            }
         }
      }
      catch (Exception e) { e.printStackTrace(); }
      pause();
   }


David Wall
AS/400 Toolbox for Java




                      "Richards, Etienne
                      (CAP, PTL)"               To:       
"'java400-l@midrange.com'" <java400-l@midrange.com>
                      <Etienne.Richards@        cc:
                      penske.com>               Subject:  Job Log
                      Sent by:
                      java400-l-admin@mi
                      drange.com


                      02/07/2002 07:07
                      AM
                      Please respond to
                      java400-l





All,

A while back I asked a question about creating job log entries from Java
and
I did the correct answers, thanks.

But...

The Java world and the "old style " AS/400 world is sometimes worlds apart
(As most of you have probably experienced). I am looking for a way of
logging application errors / warnings that will be easy for "old style"
AS/400 users to accept. Writing this to a log file on the IFS seems to be
counter intuitive for some users.

1. Can I write arbitrary messages to a Job log? (Without message id's)
2. Can you suggest another solution that is closer to the way other typical
AS/400 apps' do this type of error reporting?

Etienne
_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.