Now that the SQL query has been generated, you can use OpenESQL Assistant to generate a generic SQL program and embed the
               query right into it. 
               	 
            
 
            	 
             
               		 
               		  
               - Requirements 
                  		  
               
  
               		  
               - Before attempting this tutorial, you must complete the following tutorials in the order listed: 
                  			 
                  
 
                     				
                     - Tutorial: Create a SQL Server Database 
                        				
                     
  
                     				
                     - Tutorial: Create and Configure 
                           					 a Visual Studio Project 
                        				
                     
  
                     				
                     - Tutorial: Set OpenESQL Assistant Configuration Options 
                        				
                     
  
                     				
                     - Tutorial: Catalog a Connection 
                        				
                     
  
                     				
                     - Tutorial: Build and Test a Query 
                        				
                     
  
                     			 
                  
 
                  		  
                 
               		 
               		 
               		  
               - Generate a Generic SQL Program 
                  		  
               
  
               		  
               -  
                  			 
                  
 
                     				
                     - In the OpenESQL Assistant, click the 
                        				  Auxiliary Code tab. 
                        				
                     
  
                     				
                     - From the 
                        				  Statement Type drop-down list, select 
                        				  Generic SQL Program. 
                        				  
                        
OpenESQL Assistant generates a generic SQL program in the 
                           					 Generated Auxiliary Code box on the 
                           					 Auxiliary Code tab. 
                           				  
                        
 
                        				
                       
                     			 
                  
 
                  		  
                 
               		 
               		 
               		 
               		  
               - Open Program1.cbl 
                  		  
               
  
               		  
               - The 
                  			 Program1.cbl program file was automatically generated and added to the 
                  			 OESQLAssistantTutorial project when the project was created. Here you delete its contents so you can replace them with the code generated by OpenESQL
                  Assistant. 
                  			 
                  
 
                     				
                     - In Solution Explorer, double-click 
                        				  Program1.cbl. 
                        				  
                        
This opens the source code editor with the cursor placed at the very beginning of the file. 
                           				  
                        
 
                        				
                       
                     				
                     - Select and delete all text in the file. 
                        				
                     
  
                     			 
                  
 
                  		  
                 
               		 
               		 
               		  
               - Embed the Generic SQL Program 
                  		  
               
  
               		  
               - Now you can embed the generic SQL program generated by the OpenESQL Assistant into the 
                  			 Program1.cbl file. 
                  			 
                  
 
                     				
                     - Place your cursor at the beginning of the 
                        				  Program1.cbl file. 
                        				
                     
  
                     				
                     - On the OpenESQL Assistant, with the 
                        				  Auxiliary Code tab showing in the right pane, click 
                        				  Insert query into program (
) from the toolbar. 
                        				
                       
                     				
                     - Switch back to 
                        				  Program1.cbl in the COBOL Editor. 
                        				  
                        
You can see that the generated code now appears in 
                           					 Program1.cbl. 
                           				  
                        
 
                        				
                       
                     				
                     - Click 
                        				  Save (
) to save the program file. Do not close the COBOL Editor. 
                        				
                       
                     			 
                  
 
                  		  
                 
               		 
               		 
               		  
               - Embed the SQL Query 
                  		  
               
  
               		  
               - Next, you embed the generated SQL query into 
                  			 Program1.cbl. 
                  			 
                  
 
                     				 
                     				
                     - In 
                        				  Visual Studio, in the COBOL Editor, place the cursor on the line just after the comment: 
                        				  
*> Put your program logic/SQL statements here
 
                        				  
                     				 
                     				
                     				
                     - On the OpenESQL Assistant, click the 
                        				  Query tab; then click 
                        				  Insert query into program (
) from the toolbar. 
                        				
                       
                     				
                     - Switch back to 
                        				  Program1.cbl in the COBOL Editor. 
                        				  
                        
You can see that the generated query code now appears in 
                           					 Program1.cbl. 
                           				  
                        
 
                        				
                       
                     				
                     - Click 
                        				  Save (
) to save the program file. Do not close the COBOL Editor.