Automatic Code Generation

The Workspace Structure view provides a visual interface to most of AcuBench's automatic code generation facilities. Each icon in the program tree that appears in the Structure view – Screen, Report, Working Storage, Linkage Section, Event Paragraph, Data Set – can be used to open a graphical designer, which stores its code in a program structure file. When you select a program in the Structure view and select the Generate command, AcuBench opens the program structure file and uses that file to create screen, report, Working-Storage, Linkage, event, and file-handling COBOL code.

The COBOL code that AcuBench generates from the program structure file is, by default, placed into a .cbl source file and several COPY files. Tags in the source file tell AcuBench where to place generated code. The area outside of these tags is reserved for manual editing. This means that, by default, all code between the AcuBench tags is deleted and recreated every time you generate code, but code that you have added outside of the tags is preserved. The various AcuBench tags and their purposes are discussed in Program Tag Options.

Changes made to a single AcuBench designer may cause code to be generated in several COPY files. When you use the Screen Designer to add a status bar control to a graphical screen, for example, AcuBench's default code generation produces a combination of Screen Section, Working-Storage, and Procedure Division code in .scr, .wks, and .prd COPY files. Ways to customize code generation behavior and affect the naming and use of COPY files are discussed in Controlling Code Generation and Generate Document Options.

The program structure file also makes it possible for AcuBench to handle sometimes subtle interactions between the different graphical designers. When you create an entry field control in the Screen Designer, for example, AcuBench creates a Working-Storage variable to hold the contents of that field. The variable appears in the Screen Designer Property sheet for the control and in the Working-Storage Designer's graphical interface. When code is generated, Screen Section code associates the variable with the control's VALUE property and the variable definition appears in the Working-Storage Section.

If you want AcuBench to generate file-handling code, you need to create one or more data layout files, in addition to the program structure file. A data layout file is an AcuBench-specific file from which file descriptions, SELECT statements, custom extended file descriptors, and sort descriptions are created. For each data file that you plan to use with a project, you create one data layout file. Data layout files are discussed in more detail in Defining Data Files for Use in Projects and Programs.

Once you have created a data layout file at the project level, you can define data sets for each program in the project. A data set is a program-level definition specifying how an individual program will use a given data file. Based on your specifications, AcuBench uses the data set definition to determine what kind of file-handling code (OPEN, READ, and WRITE paragraphs, for example) to generate in the Procedure Division. Data sets are discussed in more detail in Using the Data Set Designer.