Program Tag Options

To support automated code generation, if you choose, AcuBench places special comment tags in your COBOL source file. These tags reserve areas of your program for code generated by AcuBench. For example, if you use the Screen Designer to create a screen for your program, every time you generate code for the program, the workbench creates a COPY file that describes the screen, and a COPY statement is inserted between the copy-screen tags in your program's Screen section. You can control whether specific tag pairs are automatically generated or suppressed via the Tools > Options > Code Generator > Program Tag interface.

AcuBench tags always have the format:

*{Bench}tag-name
*{Bench}end

When working with programs that include AcuBench-generated code, always be sure to add any user-defined code outside of the {Bench} tags. Everything between the tags is deleted and re-created every time you generate the program, but code outside the tags is preserved (unless you have specifically elected otherwise in your Code Generator options).

If you were to use all of AcuBench's facilities for automatically generating code, your program could have the following set of tags in your source file (.cbl):

*{Bench}prg-comment
* Demo.cbl
* Demo.cbl is generated from C:\Sample\Demo.Psf
*{Bench}end
 IDENTIFICATION              DIVISION.
*{Bench}prgid
 PROGRAM-ID. Demo.
 AUTHOR. ljones.
 DATE-WRITTEN. Wednesday, January 04, 2006 9:54:03 AM.
 REMARKS.
*{Bench}end

Program description comments and program ID information is pulled from settings in the Project > Properties dialog.

A Special Names definition COPY file is included whenever ActiveX controls are used in a screen created in the Screen Designer:

 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SPECIAL NAMES.
*{Bench}activex-def
 COPY "MSChart.def".
 COPY "Acuclass.Def".
     .
*{Bench}end

In the example above, the program uses the MSChart ActiveX control, so AcuBench has added references to two required definition files between the activex-def {Bench} tags.

If in your Windows environment you have "," (comma) defined as the decimal symbol, a DECIMAL POINT IS COMMA statement is inserted between the decimal-point tags, which the code generator places directly after any ActiveX tags in the Special Names section.

*{Bench}decimal-point
*{Bench}end

COPY statements to include SELECT statement (.sl) COPY files generated by the File Designer are inserted between the file-control tags:

 INPUT-OUTPUT SECTION.
 FILE-CONTROL.
*{Bench}file-control
 COPY Demo.SL
*{Bench}end

COPY statements to include file descriptor (.fd) COPY files generated by the File Designer are inserted between the FILE tags:

 DATA DIVISION.
 FILE SECTION.
*{Bench}file
 COPY Demo.FD
*{Bench}end

COPY statements to include standard ACUCOBOL-GT definition (.def) COPY files are inserted between the acu-def tags:

     WORKING-STORAGE SECTION.
    *{Bench}acu-def
     COPY "acugui.def".
     COPY "acucobol.def".
     COPY "crtvars.def".
     COPY "activex.def".
     COPY "showmsg.def".
    *{Bench}end

COPY statements to include Working-Storage (.wrk) COPY files containing items defined by the graphical design tools are inserted between the copy-working tags:

    *{Bench}copy-working
     COPY Demo.wrk
    *{Bench}end

COPY statements to include external .def files are inserted between the extern-def tags:

    *{Bench}extern-def
     COPY externalfile.def
    *{Bench}end

COPY statements to include Linkage section (.lks) COPY files containing items defined in the Linkage Editor are inserted between the linkage tags:

     LINKAGE SECTION.
    *{Bench}linkage
     COPY Demo.lks
    *{Bench}end

COPY statements to include screen (.scr) COPY files created by the Screen Designer are inserted between the copy-screen tags:

     SCREEN SECTION.
    *{Bench}copy-screen
     COPY MainMenu.scr
     COPY Orders.scr
     COPY Invoices.scr
    *{Bench}end

A Procedure Division header with a USING phrase is generated between the linkpara tags when linkage items are defined in the Linkage Editor:

    *{Bench}linkpara
     PROCEDURE DIVISION USING order-id.
    *{Bench}end

A declarative section with code to handle standard file error conditions is inserted between the declarative tags when data sets are defined with the Data Set Designer. You can also control what is generated inside the declarative tags via the Event Editor. For more information, see Associating Code with Screen Elements in Working with Screens.

    *{Bench}declarative
     DECLARATIVES.
     INPUT-ERROR SECTION.
         USE AFTER STANDARD ERROR PROCEDURE ON INPUT.
     ...
     END DECLARATIVES.
    *{Bench}end

An insertion point for user-defined code to be executed before the program's initial routine is added at the start of the Acu-Main-Logic paragraph. When Before Program code is defined in the Event Editor, AcuBench generates the necessary PERFORM statement between the tags.

    *{Bench}entry-befprg
         PERFORM Before-Orders-Program
    *{Bench}end

Code to call the program's main screen (a paragraph included in the .prd file generated by the Screen Designer) is inserted between the run-mainscr tags:

    *{Bench}run-mainscr
         PERFORM Acu-MainMenu-Routine
    *{Bench}end

COPY statements that include procedure, event, and menu (.prd, .evt, .mnu) COPY files are inserted between the copy-procedure tags:

    *{Bench}copy-procedure
     COPY Demo.prd
     COPY Demo.mnu
     COPY Demo.evt
    *{Bench}end

COPY statements to include corporate external Procedure Division COPY files are inserted between the extern-cpy tags:

    *{Bench}extern-cpy
     COPY externalcopyfile.cpy
    *{Bench}end

If you want to view or print a report, a call to the master print paragraph is inserted between these tags:

    *{Bench}reportname-masterprintpara
    *{Bench}end

Including and excluding tags

Tags are included in a new program when you generate the program the first time. If you use the Code Generator > Program Tag section of the Tools > Options interface to indicate that you do not want certain tags created, then later change your mind, the missing tags will not be added to programs that you have previously generated. You can add the tags manually, after which AcuBench will generate any corresponding code between the tags.

Tags are inserted into an existing program if you specify that AcuBench should create a program structure file when you add the program to the project. For more information about creating a program structure file when adding a program, see Creating a PSF for an Existing Program. As a general rule, the workbench inserts tags at the end of each relevant section (such as the Screen section). If the workbench cannot determine where the end of a section is, it does not insert any tags.

In addition to the typical range of tags, you can also direct the workbench to generate extern tags, which contain COPY statements for external .def and COPY files. Note that standard ACUCOBOL-GT .def and COPY file statements are generated inside acu-def and copy-procedure tags.

You can set Program Tag options as follows:

  1. Select the Program Tag category of the Code Generator options.
  2. Set the Default Tag Name check boxes for the tag pairs that you want AcuBench to generate automatically. Clear check boxes for the tag pairs you don’t want generated.

    Note that the selected tags are added to new AcuBench programs, or to programs for which a new program structure file is being created. If tags are added or removed from the list in the Tools > Options interface, no change occurs in existing AcuBench programs. If you manually add an appropriate set of tags to an existing program, the code generation facility will generate any corresponding code between those tags.

  3. Select Use External Working Storage Copy File Tag if you want the workbench to generate tags for an external COPY file. These tags are generated into the .cbl file, in the Working-Storage section, just after the {Bench}acu-def tags.

    Enter the file name in the associated Copy File List box, using the Browse button to navigate to the desired COPY file. Use the Delete and Delete All buttons to remove files from the list.

  4. Select Use External Procedure Division Copy File Tag if you want AcuBench to generate tags for a COPY file. These tags are generated in the .cbl file, in the Procedure Division, just after the {Bench}copy-procedure tags.

    Enter the COPY file name in the associated Copy File List box, using the Browse button to navigate to the desired COPY file. Use the Delete and Delete All buttons to remove files from the list.