Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

5.3.7 Notes on Writing Event Procedures

  1. PROGRAM-STATUS
    Use the special register PROGRAM-STATUS with caution. The value of PROGRAM-STATUS is changed whenever a control property is set or whenever a method is used.

  2. Data definition in the WORKING-STORAGE section
    To avoid a "USER WORD 'data name' UNDEFINED" error at compile time, the GLOBAL statement must be used to define data in the WORKING-STORAGE, CONSTANT and FILE sections of the form. This is because data defined in these sections are used throughout the program, not just in specific procedures.

  3. The COMMON attribute
    Common procedures are treated like internal programs. For this reason, you must use the COMMON attribute with the PROGRAM clause to describe common procedures within a form.

  4. User-defined words
    No user-defined word can begin with the letters 'POW-' or 'POWER-' when using PowerCOBOL.

  5. The CHANGE event of an Edit control
    The CHANGE event of the Edit control is invoked for each character input to the control, not for the entire string. For instance, if the input character contains four characters, the change event procedure will be invoked four times, once for each character.

  6. The COBOL85 presentation file
    Make the procedure that handles the presentation file a common procedure and make sure that the focus on the presentation file is not interrupted once the OPEN statement is issued and before the END statement is issued.

  7. Ending a procedure
    Never use the STOP RUN statement to close a PowerCOBOL application. It will end the program without removing the open resources from memory.

  8. An infinite loop in a procedure
    An infinite loop is a set of commands that repeat indefinitely. For example, if a string is set to have a POW-TEXT property within a CHANGE event, the CHANGE event will repeat again and again. In that case, the application usually exits abnormally because of a 'stack violation' error. Alternatively, you can select the CLOSE command from the COBOL control menu. Restart Windows to free up the resources left in memory.

  9. INCLUDE files
    Use as few INCLUDE files as possible because of the impact they have on debugging and compiling.

  10. Using '&' in text or in a title
    Because the '&' has a special meaning, (it indicates a shortcut key), it must be 'escaped' to display it in a text or title. Type '&&' to make the '&' symbol display in the following controls; labels, push buttons, radio buttons, check buttons, group boxes, function keys, and bitmap buttons. For example, to display 'NAME & ADDRESS' use:

    MOVE "NAME && ADDRESS" TO POW-TEXT OF LABEL1.