Skip to content

Page 1

ND 10536 COBOL GENERATOR

INTRODUCTION

COB-GEN is a utility program for generating source code for COBOL'S PROCEDURE DIVISION.

COB-GEN generates source code for:

  1. screen input/output,
  2. screen input validation
  3. reports

The COBOL programmer's productivity can be greatly increased with this simple method for COBOL source code generation.

Using the COB-GEN utility removes the most tedious and error-prone tasks for COBOL programmers, letting them concentrate on the logic of the program.

Fewer errors occur when using COB-GEN in comparison to writing all the source code directly in COBOL.

The result is brief, efficient and well structured programs.

AREAS OF USE

  • Programming of COBOL
    • screen input/output in transaction systems
    • reports in on-line and batch systems

The simplified COB-GEN working sequence is:

  1. Draw the PICTURES and/or REPORT layouts using an editor (e.g. NOTIS-WP).

  2. Add commands for general functions and for associating COBOL variable names with the fields in the REPORT/PICTURE.

  3. Process the files to get COBOL source code for screen input/output and/or reports.

  4. COPY the COBOL SECTIONS produced in step 3 into the COBOL program’s PROCEDURE DIVISION using the COBOL verb COPY.

FEATURES

  • Generates COBOL source code for COBOL’s PROCEDURE DIVISION.
  • The COBOL source code generated by COB-GEN runs on all ND computers.
  • The basis for the generated COBOL source code is a form description file.
  • Editing of form layouts (screen/report drawing) as they shall look when the program is run using a full screen editor (e.g. NOTIS-WP or PED). The form layouts are stored in form description files.
  • One of the description file mentioned above may contain descriptions of many FORMS/REPORTS.
  • The screen picture may be of any size, smaller than or equal to the size of the screen, and you may place the form wherever you want running on the screen.
  • Optional framing of each form.
  • Different forms can be overlayed on the screen.
  • Specification of legal range(s)/value(s) for each field.
  • Protection of specific fields against input (display fields).
  • Optional individual display modes for each field (e.g. inverse video) for improved user interface.
  • COBOL source code can be inserted before and after input to each field.
  • User specified control procedures before and after each field.
  • When executing the generated COBOL code, the cursor can be automatically moved between the fields, as directed by the operator with the cursor control keys or the CR key.
  • Multi-level HELP facility.

10536-7000-1284


Page 2

Product Description

A PICTURE (or REPORT) definition is made up of:

  • A @PICTURE or @REPORT command naming the form.
  • A series of commands giving the general capabilities of the form (eg. the size)
  • A «form drawing»
  • A series of field statement groups specifying the COBOL variable name corresponding to each field, the display modes for each field, etc.

What Does the Code Generated by COB-GEN Do?

In on-line and report programs, common tasks are accepting and checking terminal DATA INPUT, DISPLAYING DATA on the screen and writing reports.

Using COB-GEN, a single COBOL PERFORM statement in your program is required to activate the code generated by COB-GEN.

COB-GEN generates the code for these picture-name and report sections, based on your specifications.

Picture-Name Sections

Each picture-name section will do the following when its code is executed:

  • Write the picture on the screen with leading texts and fields for the input/output.
  • Clear all data fields in the picture, or displayed data depending on your specification
  • Accept data from the terminal operator. The user has complete cursor control when entering data if the sequence of fields to be read is not defined within the picture specification.
  • Before data has been entered into a field, the following steps can be taken automatically:
    • Display HELP information by pressing the HELP key. It is recommended to let this information be COB-GEN pictures as well, and to utilize the AUTO-ERASE and RE-DISPLAY facilities.
    • Perform a user-defined paragraph/section by pressing one of the function keys (F1-F16)
  • After data has been entered into a field, the following steps can be taken automatically before moving to the next field:
    • check ranges/legal values with automatic display if an illegal value is entered
    • check the consistency by performing another paragraph/section in your program or
    • perform one of several sections depending on the input value entered.
  • If errors are found in the input, another request for input may be made automatically, until a valid value for the field is entered.
  • Some fields must have a value entered. The operator cannot leave such a field until a legal value has been entered.
  • For some key fields, it may be specified that a value must be entered before all the others. This value cannot be changed once it has been entered. The fields are locked while checks/actions are performed on other fields, making consistency checks of dependent fields possible.
  • After you have filled in the last field of the picture, or pushed the EXIT or CANCEL key, the program exits from the picture-name section, and control returns to your part of the program.
  • A global system variable will hold information on how a field was left, ie., with CR, EXIT, CANCEL, etc.

Report Section

If you use the command @REPORT to naming the picture, instead of @PICTURE, you will have the picture written to a file instead of to the screen when executing the code. This picture cannot accept input from the terminal operator, as its purpose is to print a report containing the values of the variables connected to its fields. Several COB-GEN reports may be placed within one physical print page.


Page 3

Code Generation Example

To translate your picture specifications, start the COB-GEN program and fill in the form below. You have full cursor control when filling in the parameters to COB-GEN.

C O B - G E N

Version 10536
Input file NEW-SYSTEM:PICT
List file SCRATCH:LIST
Result file NEW-SYSTEM:PROC

Pictures Defined

  • PIC-PERSONDATA: Picture
  • PIC-MESSAGES: Picture 2 Errors
  • SUMMARY: Report

Error Messages

  • 15 @SIZE 10 2T: % Defines start of picture
    • Argument is not numeric
  • 112 @LINS: LOOKUP INDEXED: There is no free field in this line

Screen picture during execution

A Simple Description File Example

@PICTURE <TELEPHONE,I>   % Picture/Form name, input
@IN-FRAME                % Draw a frame round the form
@SIZE 6 * 35             % Size of form is 6 lines by 35 columns
@POSITION 9 22           % Positioning of the upper left corner of the form on the VDU
@START                   % Start form layout
Telephone Numbers

Name.. ..........................  @1 % @1 is a line identifier

Number $$$                     @2
Room.. $$                      @3
@END                            % End of forms layout

@1 PERSON-NAME                  % Name of the COBOL variable
< Must, Control=FIND-NAME >     % in the form line identified by @1 is PERSON-NAME.
                                % This field must be given a value, and the value
                                % is checked in the user-defined paragraph/section
                                % FIND-NAME.

@2 PERSON-NUMBER

@3 ROOM-NUMBER                  % legal values from 10 to 88
<RANGE 10:88>                   % inclusive

Prerequisites

COBOL compiler release F, or later

Documentation

  • COB-GEN Reference Manual: ND-60.171
  • COBOL Reference Manual: ND-60.144