Problem solve Get help with specific problems with your technologies, process and projects.

Status messages help users get through long jobs

This easy solution helps prevent users from canceling jobs midway, minimizing the amount of support and cleanup on your end.

A friend asked me recently if I had a simple solution for the following problem. He was dealing with a legacy application that ran interactively for a long period of time. Users would occasionally get tired of waiting on this job, assume the job was hung up and cancel the job in the middle of processing. Then they would try to rerun the job. Because of the complexity of this job and time constraints, rewriting this to be a batch job was not an option he could consider. But he had to find a way to minimize the amount of support and cleanup he had to deal with.

The solution that made everyone happy was to insert status messages at key places in the job stream to give the user a visual cue to the job's progress. Although this example shows a technique that was used to help a legacy application, it could also be used for system-type jobs that you may want -- or need -- to run interactively.

Code:

PGM                                                      
                                                                      
/* Send status message to inform user what is happening */             
             SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Ex. +    
                          Initializing job') TOPGMQ(*EXT) +           
                          MSGTYPE(*STATUS)                            
                                                                      
/* Perform simulated processing */
             DLYJOB     DLY(4)                                        
                                                                      
/* Send status message to inform user what is happening */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Ex. +    
                          Performing Updates') TOPGMQ(*EXT) +         
                          MSGTYPE(*STATUS) 
                           
/* Perform simulated processing */
             DLYJOB     DLY(4)       

/* Send completion message */
             SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Ex. Job + 
                          completed successfully') MSGTYPE(*INFO)      
                                                                       
 ENDPGM:     ENDPGM                                                                                     

---------------------------
About the author: Tim is vice president of Technical Services at Interlink Technologies in Maumee, Ohio, where he serves as chief architect for their warehouse management system. He has worked in the banking, insurance, healthcare and distribution industries in various positions, including programmer/analyst, systems analyst and DP manager. Tim has worked on IBM midrange platforms since 1983.

==================================
MORE INFORMATION
==================================

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close