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.
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.
- Search400's Best Developer Web Links: tips, tutorials and more.
- Top 10 Programmer Tips: You picked 'em. Here are the top tips for August through October based solely on the ratings you gave them.
- Ask your programmer questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our programmer gurus are waiting to answer your technical questions.