  * TNAPIEX                                                              
  * Example of TNAPI use                                                   
  *                                                                      
 D ParmWaitArr     ds                                                    
 D  WaitArr                      37    dim(20)                           
                                                                         
 D ParmScrnChar    ds                                                    
 D  Row                          80    dim(24)                           
                                                                         
 C     *entry        plist                                               
 C                   parm                    UserID           10         
 C                   parm                    Password         10         
                                                                         
  /free                                                                  
                                                                         
   // Send user ID and password (do not log password)                    
   ParmSendBuff = UserID + '%L0' + Password;                             
   ParmFctKey  = 'ENTER';                                                
   exsr TNAPICALL;                                                       
                                                                         
   // Press ENTER key twice                                              
   ParmFctKey  = 'ENTER';                                                
   exsr TNAPICALL;                                                       
   ParmFctKey  = 'ENTER';                                                
   exsr TNAPICALL;                                                       
                                                                         
   // Position the cursor to 10,23 (for demonstration purposes only)     
   ParmSendBuff = '10,23';                                               
   ParmFctKey = 'POSCSR';                                                
   exsr TNAPICALL;                                                       
                                                                         
   // Get any waiting data (for demonstration purposes only)             
   ParmFctKey = 'GETDTA';                                                
   exsr TNAPICALL;                                                       
                                                                        
   // Check contents of row 1, column 20                                 
   if %subst(Row(1):20) = 'Menu ';                                       
     ParmFctKey = 'F12';                                                
     exsr TNAPICALL;                                                    
   endif;                                                                
                                                                        
   // Send TAB key                                                       
   ParmSendBuff = '%TB';                                                 
   exsr TNAPICALL;                                                       
                                                                        
   // Command entry (wait for 'Command' to appear on line 1)             
   ParmSendBuff = 'CALL QCMD';                                           
   ParmFctKey  = 'ENTER';                                                
   WaitArr(1) = 'O0134Command';                                          
   exsr TNAPICALL;                                                       
                                                                        
   // Send 'DSPSYSTS' and wait for 'Display to appear on line 1          
   ParmSendBuff = 'DSPSYSSTS';                                           
   ParmFctKey  = 'ENTER';                                                
   // WaitArr(1) = 'O0130Display';                                       
   exsr TNAPICALL;                                                       
                                                                        
   // Exit the application                                               
   ParmFctKey  = 'F3';                                                   
   exsr TNAPICALL;                                                       
                                                                        
   // Signoff                                                            
   ParmSendBuff = 'SIGNOFF';                                             
   ParmFctKey  = 'ENTER';                                                
   exsr TNAPICALL;                                                       
                                                                        
  // End the session                                                    
  ParmFctKey  = 'EOJ';                                                  
  exsr TNAPICALL;                                                       
                                                                        
 /end-free                                                              
 *                                                                      
 *******************************************************************    
 *                                                                      
C     TNAPICALL     begsr                                               
                                                                        
C                   call      'TNAPI'                                   
C                   parm                    ParmSendbuff    256         
C                   parm                    ParmFctKey        6         
C                   parm      30            ParmWaitTime      5 1       
C                   parm                    ParmWaitArr                 
C                   parm                    ParmSystem       64         
C                   parm      'Y'           ParmDisplay       1         
C                   parm      'N'           ParmAttr          1         

C                   parm                    ParmLogFile      10     
C                   parm                    ParmWaitPtr       2 0   
C                   parm                    ParmReturn        1     
C                   parm                    ParmScrnChar   1920     
C                   parm                    ParmScrnAttr   1920     
C                   parm                    ParmCurrRow       2 0   
C                   parm                    ParmCurrcol       2 0   
                                                                    
C     ParmReturn    ifgt      '1'                                   
C                   move      *on           *inlr                   
C                   return                                          
C                   endif                                           
                                                                    
C                   eval      ParmSendBuff = *blanks                
C                   eval      ParmFctKey = *blanks                  
C                   eval      ParmWaitArr = *blanks                 

C                   endsr                                               
