No code popup messages

I wanted to have an easy way to pop-up a message to inform users of something going on. I used the QUILNGTX API to create a utility that pops up a message box with a title from any application or command line. To use it:

msgbox message('...') title('..')
msgbox 'job is submitted'
msgbox ('job submitted at ' *cat &date)
msgbox (('this program is offline') ('**ERROR**'))

The message can be up to 255 characters. The title is optional and can be up to 27 characters. The title appears centered on the box.

The 255 character length was arbitrary can could be increased - if you care to tweak the command and code.

MESSAGE rpgile

h dftactgrp(*no) actgrp('QILE')                           
h option(*srcstmt:*nodebugio)                             
DMsgBox           pr                  extpgm('QUILNGTX')  
D LngTxt                       255a                       
D TextLen                       10i 0 const               
D TxtTitle                       7a                       
D TxtMsgF                       20a                       
D ErrCode                       16a                       
d Text            s            255a   inz(*blank)         
d String          s            255a   inz(*blank)         
d Title           s              7a   inz(*blank)         
d MessageF        s             20a   inz(*blank)         
d Error           s             16a                       
d TitleString     s             27    varying inz(*blank) 
d tx              s              2  0                    
d BlankString     s             27    inz(*blank)        
D JobType         S              1                       
DRtvJobA          pr                  extpgm('QUSRJOBI') 
D rtv_Data                     100a                      
D rtv_Length                    10i 0 const              
D rtv_Format                     8a                      
D rtv_Job                       26a                      
D rtv_IntJob                    16a                      
D p_Rcvr          S            100                       
D p_Format        S              8    INZ('JOBI0100')    
D p_ThisJob       S             26    INZ('*')           
D p_IntJob        S             16                       
c                   clear                   title        
c                   clear                   title                  
c                   clear                   messagef               
c     *entry        plist                                          
c                   parm                    inString        255    
c                   parm                    inTitle          27    
c                   if        %parms = 1                           
c                   eval      String = inString                    
c                   endif                                          
c                   if        %parms = 2                           
c                   eval      String = inString                    
c                   eval      TitleString = %trim(inTitle)         
c                   endif                                          
c                   if        TitleString <> *blank                
c                   if        %len(titlestring)< 27                
c                   eval      tx=((27-%len(titlestring))/2)        
c                   eval      titlestring=%subst(blankstring:1:tx) 
c                             +titlestring                         
c                             +titlestring                            
c                   eval      titlestring=titlestring                 
c                             +%subst(blankstring:1:%len(titlestring))
c                   if        %subst(titlestring:1:1)=*blank          
c                   eval      %subst(titlestring:1:1)='.'             
c                   endif                                             
c                   if        %subst(titlestring:27:1)=*blank         
c                   eval      %subst(titlestring:27:1)='.'            
c                   endif                                             
c                   eval      title=%subst(titlestring:1:7)           
c                   eval      messageF=%subst(titlestring:8:20)       
c                   endif                                             
c                   endif                                             
C                   callp     RtvJoba ( p_Rcvr     :                  
C                                      %len(p_Rcvr):                  
C                                       p_Format   :                  
C                                       p_ThisJob  :          
C                                       p_IntJob   )          
C                   EVAL      JobType = %SUBST(P_Rcvr : 61 :1)
 * B/atch I/nteractive P/restart?                             
c                   if        JobType = 'I'                   
c                   eval      Text=%trim(String)              
c                   eval      Error=''                        
c                   callp     MsgBox(Text:                    
c                                    %len(Text):              
c                                    Title:                   
c                                    MessageF:                
c                                    Error)                   
c                   endif                                     
c                   return                                    

MSGBOX Command
CMD        PROMPT('Display message in box')           
             EXPR(*YES) CASE(*MIXED) PROMPT('Message +
             to display')                             
PARM       KWD(TITLE) TYPE(*CHAR) LEN(27) MIN(0) +    
             CASE(*MIXED) PROMPT('(opt.) Title for +  


The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

This was first published in October 2002

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.