Editing FOCEXECs

You can create FOCUS executable procedures (FOCEXECs) using TED, just as you can create any other file. One advantage of creating or editing FOCEXECs in TED is that you can use the RUN command, which enables you to run a FOCEXEC from within TED without moving to an editor outside the FOCUS command level. For example:

 FOCEXEC(M1)                           SIZE=10    LINE=0                
                                                                        
00000 * * * TOP OF FILE * * *                                           
00001 MODIFY FILE EMPLOYEE                                              
00002 FREEFORM EMP_ID CURR_SAL                                          
00003 MATCH EMP_ID                                                      
00004  ON NOMATCH REJECT                                                
00005  ON MATCH UPDATE CURR_SAL                                         
00006 DATA                                                              
00007 EMP_ID=071382660, CURR_SAL=21400.50, $                            
00008 EMP_ID=112847612, CURR_SAL=20350.00, $                            
00009 EMP_ID=117593129, CURR_SAL=22600.34, $                            
00010 END                                                               
00011 * * * END OF FILE * * *                                           
                                                                        
====> RUN                                                               
                                                            EDITING MODE

Once you type RUN and press the Enter key, this FOCEXEC is executed by FOCUS. Also note that you can add parameters to the RUN command. For example:

====> RUN ECHO=ON

If there is an error in the FOCEXEC, simply enter

TED

after the error message. The file will be redisplayed in TED, with the error line as the current line.

In the following example, the FOCEXEC has an incorrect field name (EMPID, should be EMP_ID):

 FOCEXEC(M2)                           SIZE=9     LINE=0                
                                                                        
00000 * * * TOP OF FILE * * *                                           
00001 MODIFY FILE EMPLOYEE                                                      
00002 FREEFORM EMPID CURR_SAL                                          
00003 MATCH EMP_ID                                                      
00004  ON NOMATCH REJECT                                                
00005  ON MATCH UPDATE CURR_SAL                                         
00006 DATA                                                              
00007 EMP_ID=071382660, CURR_SAL=21400.50, $                            
00008 EMP_ID=112847612, CURR_SAL=20350.00, $                            
00009 EMP_ID=117593129, CURR_SAL=22600.34, $ 
00010 END                            
00011 * * * END OF FILE * * *                                           
                                                                        
====>                                                                   
                                                            EDITING MODE

After you type RUN and press the Enter key, FOCUS displays the following error:

 ERROR AT OR NEAR LINE      2  IN PROCEDURE M2      FOCEXEC *         
(FOC419) FIXFORM SUBCOMMAND ELEMENT OR FIELDNAME NOT RECOGNIZED: EMPID
 BYPASSING TO END OF COMMAND                                          

If you issue the TED command (it is not necessary to include the file name), you are placed in EDIT mode with the following screen displayed. The current line is FREEFORM EMPID CURR_SAL

 FOCEXEC(M2)                           SIZE=10    LINE=2                
                                                                        
00002 FREEFORM EMPID CURR_SAL                                           
00003 MATCH EMP_ID                                                      
00004  ON NOMATCH REJECT                                                
00005  ON MATCH UPDATE CURR_SAL                                         
00006 DATA                                                              
00007 EMP_ID=071382660, CURR_SAL=21400.50, $                            
00008 EMP_ID=112847612, CURR_SAL=20350.00, $                            
00009 EMP_ID=117593129, CURR_SAL=22600.34, $                            
00010 END                                                               
00011 * * * END OF FILE * * *                                           
                                                                        
====>                                                                   
                                                            EDITING MODE

Note: FOCEXECs are described in detail in the Developing Applications manual.


Information Builders