


The following procedure describes how to access your COBOL data from Microsoft Word 97, the word processing component of Microsoft Office 97. Another procedure has been provided for users of Word 2000 (the version that comes witih Microsoft Office 2000.If you have a different version of Word, follow whichever procedure you desire. Even though your steps may be slightly different, the concepts will be largely the same.
To access data from Word 97:
1. Start Word for Windows.
2. Open the document into which you want to insert data.
3. Select Mail Merge from the Tools menu.
4. In the Mail Merge Helper dialog box, under "Main Document," click Create and select Form Letters.
5. To insert data into the active window in Word, select Active Window in the dialog box that appears. You are then returned to the Mail Merge Helper dialog box.
6. Under "Data Source," click Get Data, and select Open Data Source.
7. Click MS Query in the Open Data Source dialog box. (If you do not have an MS Query button, you may need to install MS Query on your machine.)
This starts MS Query and opens the Choose Data Source dialog box.
If you want to use MS Query's "Query Wizard" to create your SQL query, leave the "Use Query Wizard" check box selected. Refer to MS Query's online documentation for instructions on using the Query Wizard.
For simplicity, clear the Query Wizard.
8. Select the DSN that corresponds to the data source you want to access and click OK. If you want to use the sample DSN that comes with AcuODBC, select AcuODBC Datasource.
If you do not see your DSN listed, do one of the following:
9. In the Add Tables dialog box, select the table or tables to add to your Word document, and then click Add.
10. Close the box when you're done. For each table you selected, a list box appears on the MS Query screen. This list box lists all of the columns in the associated table.
11. Double-click each column that you want to read into your Word document, and that column appears on the screen, as in the following example. If you want to add all columns, double-click the "*" at the top of the list box. If you prefer, you can populate the table by clicking the SQL button and entering and executing an SQL query. See Step 12.
12. To enter an SQL statement, click SQL.
In the SQL dialog box, type the SQL command you want to execute. Click OK when you're done. (For a description of the SQL commands supported by AcuODBC, refer to section 5.3, "SQL Syntax Supported by AcuODBC".)
14. Close the active dialog box in Word. Notice that new mail merge buttons are added to the toolbar.
15. Place the cursor in your document where you want to insert the data. Click Insert Merge Field to see a pull down list of table columns. These are the columns that you selected in MS Query.
16. Select the merge field of interest. The control characters for this field are placed in your document.
17. To display the exact data in this field, click <<ABC>>.
18. Finish your document as you normally would. Whenever you want to insert a COBOL data field, click Insert Merge Field once again and select the appropriate field. To move to the next, previous, first, or last record in the table, click the corresponding button on the toolbar
For more instructions on using Word's mail merge feature, refer to your Microsoft documentation.