35 pts.
 RPGLE opcode similar to SNDF in CL
Is there any way we can display a message "Processing" while the program is building the data in a subfile. In CL we can use the SNDF command to send such message to the display. Please help.

Software/Hardware used:
ASKED: May 31, 2012  10:43 AM
UPDATED: June 1, 2012  2:12 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I have used this Progress Meter method by Martin Rowe

 7,185 pts.

 

Perhaps you can just send a *STATUS message while processing, and send a blank message when finished. The RPG op-code that matches with SNDF is WRITE.

Tom

 108,360 pts.

 

If a progress meter is wanted, one can be generated easily enough. Here’s a basis for a progress bar in CL that can be modified to be as fancy as needed:

pgm    ( +
         &pRow        +
         &pColumn     +
       )

   dcl   &pRow        *int
   dcl   &pColumn     *int

   dcl   &hCmdBuf     *int           value( 0 )
   dcl   &hLoLvlEnv   *int           value( 0 )
   dcl   &RtnVal      *int

   dcl   &ErrCod      *char    8     value( x'00000000' )

   dcl   &intAstrx    *int           value( 92 )   /* '*' as *INT  */

   dcl   &Data        *char  128
   dcl   &DataL       *int
   dcl   &FldId       *int           value( 0 )
   dcl   &Column      *int           value( 1 )
   dcl   &StrMAtr     *char    1     value( x'20' )
   dcl   &EndMAtr     *char    1     value( x'20' )
   dcl   &StrColAtr   *char    1     value( x'26' )
   dcl   &EndColAtr   *char    1     value( x'20' )


   if ( &pColumn *gt 80 )  +
      chgvar         &pColumn    ( 1 )

   callprc     'memset' ( &Data (&intAstrx *byval) (&pColumn *byval) )

   chgvar            &DataL        &pColumn
   chgvar            &pColumn    ( &pColumn + 1 )

   callprc 'QsnWrtDta'      ( +
                              &Data        +
                              &DataL       +
                              &FldId       +
                              &pRow        +
                              &Column      +
                              &StrMAtr     +
                              &EndMAtr     +
                              &StrColAtr   +
                              &EndColAtr   +
                              &hCmdBuf     +
                              &hLoLvlEnv   +
                              &ErrCod      +
                            ) +
                      rtnval( +
                              &RtnVal      +
                            )

   return

endpgm

This is a test program to call it:

pgm    ( +
       )

   dcl   &Column      *int            value( 1 )
   dcl   &i           *int
   dcl   &j           *int            value( 24 )


   dofor &i from( 1 ) to( 100 )
      call     DSMPRGBAR ( &j &Column )
      dlyjob   ( 1 )
   enddo

   return

endpgm

As written, it displays a row of asterisks progressing from column 1 to column 80 of row 24. When it reaches column 80, it shifts back to column 1.

The asterisks can be changed to be any displayable character by changing the decimal value of the variable &intAstrx. The color and other attributes can be changed by setting the values of the appropriate variables passed into the DSM Write Data (QsnWrtDta) API. In this case, x’26′ sets the White/Underline display attribute at the beginning (on a color display) and back to x’20′ — Green/Normal — at the end.

The test program calls the progress bar program in a loop. This might be done by a subfile-load program once every hundred rows are loaded or at some other interval.

Of course, very few subfiles should ever take more than a second or so before being displayed, so a progress bar or status message wouldn’t be on screen very long.

Tom

 108,360 pts.

 

I agree that a “Processing” status should not be needed.
If your subfile is that large, you should be building it a page at a time.

We have some applications over our audit file (12 mil records). We build it a page at a time and have no preformance issues. When the user pages down the next page is built and displayed.

Is your issue needing the “Processing” status a home grown application or part of a purchased software system?

 3,915 pts.