Content Assist is an Eclipse feature that provides context-sensitive proposals for typing COBOL code in the editor. In Visual COBOL, Content Assist is available for both native and managed COBOL.
You can change your preferences for Content Assist from within the IDE in Window > Preferences > Micro Focus > COBOL > Editor > Content Assist and specify options such as the case of the inserted words, whether to show the proposal lists or insert single proposals automatically, or whether proposals should be added in overwrite mode or as insertions. See Configuring Content Assist for COBOL for more details.
The following describes the writing assistance that Content Assist provides in native COBOL.
Content Assist enables you to write syntactically correct code, to complete words quickly and to look up available elements.
Content Assist only offers assistance for the data items that are in scope based on the current position of the cursor.
The following list summarizes how proposal lists work:
For example, proposal lists only show COBOL verbs in the Procedure Division section and not in the Working-Storage section, and the verbs are only relevant to native code. For files with FIXED or VARIABLE source format, proposals are only available in the writing area.
By default, Content Assist opens a proposal list that only shows the relevant COBOL keywords and identifiers. To view if there are any code templates that could be inserted at the current position of the cursor, you need to press Ctrl+Space once more.
If a copybook is opened in the editor in the context of a program, the proposal lists in the copybook include the variables as defined in the program.
You need to choose a copybook from the list for Content Assist to insert after the COPY statement. After the copybook is inserted, the proposals list that appears gives you the option of terminating the statement with a period (.) or continuing it with one of the clauses IN, OF, REPLACING or SUPPRESS.
By default, proposals for COPY statements only include the copybooks that are found in the directories specified on the Dependency Paths tab on the Micro Focus > Build Path page in the project's properties and also includes copybooks from the active dependency paths of any projects referenced by your project, but you can change this so that the proposals also include system copybooks. System copybooks are ones that are not included in the project but are included using the COBCPY environment variable before starting Eclipse. To include the system copybooks, change the Content Assist preferences from Tools > Options > Text Editor > Micro Focus COBOL > Content Assist.
Consider the example of a program that defines two group items - StudentRecord and TeacherRecord. Both group items include a number of PIC X elementary items with the same names - for example, FirstName, Surname, Phone and so on. In such a case, Content Assist qualifies the elementary items as follows:
The proposals list that pops-up includes COBOL keywords, the group items defined in your program, and the elementary items that are present in both group items.
Content Assist has helped you specify the exact elementary item to use in your code:
move Surname of StudentRecord to...
In JVM COBOL, Content Assist shows proposals that include any methods, fields, properties, types and so on that are available when you declare items or type an object name followed by a double colon or an opening bracket in the Procedure Division.
You can choose an item from the list to complete the code rather than typing it yourself.
The following are examples of where Content Assist pops up:
As you type a package name, Content Assist shows all the types within that package name. For example, when you type:
invoke exception-object::