× 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.



On Mon, 2005-11-21 at 15:12 -0600, Booth Martin wrote:
> ERRSFL with more than one message per field.
> 
> Color me surprised today.  Even after I read the dds manual i am uncertain
> about this and want to run it past people.  
> 
> I have a screen with an input/output field.  There can be five different
> errors occurring on this field, and they are not mutually exclusive.  A user
> could really get it wrong and have four of the errors at once.  
> 
> Evidently ERRSFL will only show the first error for the field?  There won't
> be a subfile of all the errors?
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/rzakc/rzakcmstdferrsf.htm#dferrsf

I've almost always rolled my own message subfiles, so haven't used
ERRSFL.  However, according to what I read in the DDS manual, it will
show a list.  The IBM sample in the manual puts the subfile on line 24,
so there is a list of one at a time.  I suppose you could change MSGLOC
to something other than 24.

Here is what I've been using.  This is just a partial example snipped
from a working program.  I'm pretty sure this won't compile and run, but
is good for getting the gist of things.  

The basic idea is to wrap the QMHSNDPM and QMHRMVPM api's into the
simple function calls clear_errors() and send_message().  By setting
SFLPGMQ to point to the same place we send the messages, OS/400 will
then automatically display the entries for us whenever we write the
MSGCTL record.

... snip ...
     A          R MSGSFL                    SFL
     A                                      SFLMSGRCD(24)
     A            MSGKEY                    SFLMSGKEY
     A            SFLPGMQ                   SFLPGMQ(276)

     A          R MSGCTL                    SFLCTL(MSGSFL)
     A                                      SFLSIZ(2)
     A                                      SFLPAG(1)
     A                                      SFLDSP
     A                                      SFLDSPCTL
     A                                      SFLINZ
     A N99                                  SFLEND
     A            SFLPGMQ                   SFLPGMQ(276)
... snip ...



     H DFTACTGRP(*NO) ACTGRP(*CALLER)
     H OPTION(*SRCSTMT:*NODEBUGIO)

     FWM1100D   CF   E             WORKSTN
     F                                     sfile(sfl01:rrn01)
     F                                     infds(infds)

      * Program Status Data Structure
     D psds           sds
     D   sds_proc        *proc
     D   $usr                358    367

      * File Information Data structure
     D infds           ds
     D   $dspf           *file
     D   cfkey               369    369

      * Relevant command keys
     D cf_exit         c                   x'33'
     D cf_process      c                   x'39'

      * Named indicators
     D pInd            s               *   inz(%addr(*in))
     D                 ds                  based(pInd)
     D ofc_error                     30

      * Send program message API variables and constants
     d msgloc          c                   'WM1150M   *LIBL     '
     d msgtype         c                   '*DIAG'
     d msgrmv          c                   '*ALL'
     d msgqueue        s            276a
     d msgentry        s             10i 0 inz(0)
     d msgkey          s              4a   inz
     d error_count     s              5i 0


      * API errors
     d err             ds                  qualified
     d  provided                     10i 0 inz(%size(err))
     d  available                    10i 0 inz
     d  msgid                         7a   inz
     d  reserved                      1a   inz
     d  msgtext                      50    inz

... snip ...

        // set the SFLPGMQ keyword
 (In first pass)
         sflpgmq = SDS_PROC;
         msgqueue = SDS_PROC;

... snip ...
         // collect user input until they want to exit or process
         dow 1 = 1;

             WRITE msgctl;
    // error messages
             WRITE ctl01;     // subfile control record
             WRITE ovl01;     // function key line
             READ  ctl01;     // wait for user input

             // exit requested
             if cfkey = cf_exit;
                 leave;
             endif;

             // Edit the screen
             // Can't process unless screen is clean
             // And user presses the 'process' key
             if screen_edit() = '1';
                 // process requested
                 if cfkey = cf_process;
                     emit_parms();
                     leave;
                 endif;
             endif;
         enddo;

         *inlr = '1';
      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 
      * Edit screen fields for completeness/correctness
     p screen_edit     b
     d screen_edit     pi              n

     d i               s              5p 0
     d result          s               n
     d count           s              5p 0

      /free

         // CLEAR the error subfile
         clear_errors();
  

         for i = 1 to MAX_ROWS;
             chain i sfl01;
             ofc_error = *off; // dspatr(RI PC) 
             if ofcls <> *blanks;
                 count = count + 1;
                 if as_numeric(ofcls: nfcls);
                     check_desc();
                 else;
                     ofc_error = *on;
                     // Send a message to the error subfile
                     send_message('WMC0010');
  
                 endif;
             endif;
             update sfl01;
         endfor;

         // At least one class must be selected
         if count = 0;
             send_message('WMC0006');
         endif;

         result = (error_count = 0);
         return result;
      /end-free
     p                 e

      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 
      * Clear the error message subfile
     p clear_errors    b
     d clear_errors    pi

     d qmhrmvpm        pr                  extpgm('QMHRMVPM')
     d  queue                       276a   const
     d  callstack                    10i 0 const
     d  key                           4a   const
     d  rmv                          10a   const
     d  error                              likeds(err)

      /free
         qmhrmvpm(msgqueue: msgentry: '    ': msgrmv: err);
         error_count = 0;
      /end-free
     p                 e

      * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 
      * Send a message to the subfile program message queue
     p send_message    b
     d send_message    pi
     d  msgid                         7    const

     d qmhsndpm        pr                  extpgm('QMHSNDPM')
     d  id                            7a   const
     d  loc                          20a   const
     d  rpldta                        1a   const
     d  rpldtalen                    10i 0 const
     d  type                         10a   const
     d  queue                       276a   const
     d  callstack                    10i 0 const
     d  key                           4a   const
     d  error                              likeds(err)

      /free
         qmhsndpm(msgid: msgloc: ' ': 0: msgtype:
                  msgqueue: msgentry: msgkey: err);
         error_count = error_count + 1;
      /end-free
     p                 e




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.