How to create a Script NCL
search cancel

How to create a Script NCL

book

Article ID: 110907

calendar_today

Updated On:

Products

SOLVE:Operations Automation SOLVE:Access Session Management SOLVE:FTS SOLVE

Issue/Introduction

A Script NCL is used to automate the Logon process for a user to an application. When the Script NCL runs after the Session is initiated, there is no need to manually enter Userid and Password. That manual interaction instead is coded inside the NCL. How this works is explined here.

Environment

Release:
Component: SACCES

Resolution

The process is as follows:

You need to logon to the desired application through SOLVE:Access. During that logon protocol any entry you made and every PF-KEy you hit. Also write down the column and row where you entered data. Then wait for the applications next screen. Look for a string which is typical for that screen as you will use such typical strings to recognize if the correct panel was sent.

With this data you can go and create the Script Procedure.

The NCL consist of these two blocks which are repeated as much as needed.
First the NCL searches for a string sent from the application, then the appropriate data is entered.

-******************************************************************     
-* Logon to application                                           *     
-******************************************************************     
&CONTROL NODUPCHK NOENDMSG LOOPCHK
-*-----------------------------------------------------------------     
-* Search for '......'
-*-----------------------------------------------------------------     
&DOUNTIL &RETCODE = 0                                                   
   &GOSUB .WAITOUTPUT                                                   
   &MAIFIND ......                                                   
&DOEND                                                                  
                                                                        
-*-----------------------------------------------------------------     
-* Enter data
-*-----------------------------------------------------------------     
&IF .&MAIUNLCK = .NO &GOSUB .WAITUNLOCK                                 
                                                                        
&MAIPUT ROW=<nnn> COL=<mmm> <data_to_enter>
&MAIINKEY ENTER                                                         
&MAICONT BOTH


Then the script ends or searches for the next string from the application.

At the end of the Script we need two subroutines which wait for Output from the application and wait for unlock of the keyboard so that data can be entered:


&END
     
-*================================================================*     
-*==========  I n t e r n a l   S u b r o u t i n e s  ===========*
-*================================================================*

-*-----------------------------------------------------------------     
-* Subroutine .WAITOUTPUT, waiting for Output from the application.
-* (Answers to Queries from the PLU (Datastream F3...) to the SLU     
-* are forwarded).
-*-----------------------------------------------------------------     
.WAITOUTPUT                                                             
&WRITEL &0 ===> Script im Unterprogramm .WAITOUTPUT                     
&MAIREAD ANY                                                            
&DOWHILE .&MAIFRLU = .PLU                                               
   &MAIDSFMT STRING &FIRST(1)                                           
   &IF .&FIRST = .F3 &THEN &DO                                          
      &MAICONT SLU VIEW=WAIT                                            
      &MAIREAD SLU                                                      
      &MAICONT PLU VIEW=WAIT                                            
      &MAIREAD PLU                                                      
   &DOEND                                                               
   &RETSUB                                                              
&DOEND                                                                  
&MAIDEL                                                                 
&GOTO .WAITOUTPUT                                                       
                                                                        
-*-----------------------------------------------------------------     
-* Subroutine .WAITUNLOCK, waiting to get the keyboard unlocked.
-*-----------------------------------------------------------------     
.WAITUNLOCK
&WRITEL &0 ===> Script im Unterprogramm .WAITUNLOCK
&GOSUB .WAITOUTPUT
&IF .&MAIUNLCK = .YES &THEN &RETSUB
&GOTO .WAITUNLOCK

Additional Information

If having problems, add the line
&control traceall tracelog                                              

at the beginning of the NCL and unload the NCL. When the NCL is executed you find the trace information in the Activity Log. This helps to debug possible errors in the Script NCL.