Newsgroups: comp.databases.ingres
Date: Wed, 16 Dec 1992 10:14:25 -0500 
From: "Bruce E. Golightly" <bg0l+@andrew.cmu.edu>
Subject: Embedded forms question

I am trying to figure out a way to do something that I think is possible.

The situation is that I am working on some COBOL that will use embedded
forms. I want to be able to use different forms at run-time without
having to resort to non-compiled forms.

Here are the relevant sections of code:

           EXEC SQL BEGIN DECLARE SECTION END-EXEC.
       01 LOGO_LINE                            PIC X(78).
       01 INITIAL-SCREEN PIC S9(9) USAGE IS COMP
                                    VALUE IS EXTERNAL INITIAL-SCREEN-FORM.
       01 PASSWORD-SCREEN PIC S9(9) USAGE IS COMP
                                    VALUE IS EXTERNAL PASSWORD-SCREEN-FORM.
       01 FORM-NAMES.
          10 INITIAL-SCREEN-FORM               PIC X(32).
          10 PASSWORD-SCREEN-FORM              PIC X(32).

    .
    .
    .
    .

       P-DISPLAY-INITIALS-SCREEN SECTION.
       P-DISPLAY-INITIALS-SCREEN-010.
           EXEC SQL SELECT ACTUAL_FORM_NAME INTO :INITIAL-SCREEN-FORM
             FROM FORM_NAMES
             WHERE PROGRAM_NAME = 'TABS'
               AND PROGRAM_FORM_NAME = 'INITIAL_SCREEN' END-EXEC.
           EXEC SQL SELECT ACTUAL_FORM_NAME INTO :PASSWORD-SCREEN-FORM
             FROM FORM_NAMES
             WHERE PROGRAM_NAME = 'TABS'
               AND PROGRAM_FORM_NAME = 'PASSWORD_SCREEN' END-EXEC.
           PERFORM Z-INIT-SCR.
       P-DISPLAY-INITIALS-SCREEN-EXIT. EXIT.
    .
    .
    .
    .
       Z-INIT-SCR SECTION.
       Z-INIT-SCR-010.
           EXEC FRS SET_FRS FRS(TIMEOUT = 1) END-EXEC.
           EXEC FRS SET_FRS FRS
             (MAP(MENU1) = PF3) END-EXEC.
           EXEC FRS ADDFORM :INITIAL-SCREEN END-EXEC.
           EXEC FRS DISPLAY :INITIAL-SCREEN-FORM END-EXEC
             EXEC FRS INITIALIZE END-EXEC
               EXEC FRS BEGIN END-EXEC
                 EXEC FRS INITTABLE :INITIAL-SCREEN-FORM LOGO_LINES END-EXEC.
                 EXEC SQL DECLARE LOGO_CURSOR CURSOR FOR
                     SELECT IFNULL(LOGO_LINE, ' ')
                        FROM LOGO_LINES END-EXEC.
                  EXEC SQL OPEN LOGO_CURSOR FOR READONLY END-EXEC.
                 EXEC SQL FETCH LOGO_CURSOR INTO :LOGO_LINE END-EXEC.
                 MOVE SQLCODE TO SQLCA-STATUS.
                 PERFORM UNTIL SQLCODE NOT EQUAL 0
                   EXEC FRS LOADTABLE :INITIAL-SCREEN-FORM LOGO_LINES
                     (LOGO_LINE = :LOGO_LINE) END-EXEC
                   EXEC SQL FETCH LOGO_CURSOR INTO :LOGO_LINE END-EXEC
                   MOVE SQLCODE TO SQLCA-STATUS
                 END-PERFORM
                 EXEC FRS REDISPLAY END-EXEC.
                 EXEC FRS SLEEP 1 END-EXEC.
               EXEC FRS END END-EXEC

               EXEC FRS ACTIVATE TIMEOUT END-EXEC
                 EXEC FRS BEGIN END-EXEC
                   EXEC FRS INQUIRE_FRS
                     COLUMN :INITIAL-SCREEN-FORM LOGO_LINES
                     (:COLUMN-STATUS = INTENSITY(LOGO_LINE)) END-EXEC.
                   IF COLUMN-STATUS EQUAL 0
                     THEN
                       EXEC FRS SET_FRS
                         COLUMN :INITIAL-SCREEN-FORM LOGO_LINES
                         (INTENSITY(LOGO_LINE) = 1) END-EXEC
                     ELSE
                       EXEC FRS SET_FRS
                          COLUMN :INITIAL-SCREEN-FORM LOGO_LINES
                         (INTENSITY(LOGO_LINE) = 0) END-EXEC
                   END-IF.
                 EXEC FRS END END-EXEC


               EXEC FRS ACTIVATE MENUITEM 'CONTINUE' END-EXEC
                 EXEC FRS BEGIN END-EXEC
                   EXEC FRS BREAKDISPLAY END-EXEC.
                 EXEC FRS END END-EXEC
           EXEC FRS FINALIZE END-EXEC

       Z-INIT-SCR-END. EXIT.



ESQLCBL has no problem with this setup. Neither does the COBOL compiler.
When I link the code, however, I get a message about undefined symbols
for "INITIAL_SCREEN_FORM" and "PASSWORK_SCREEN_FORM".

Somebody here suggested I look at SQLDA as a possible solution, but the
doc I have seems to indicate that DISPLAY and INITIALIZE cannot make use
of that particular tool.

Since the package I am working on must deal with customized versions of
forms for different installation, I would really rather not have to edit
the source code to hard-code the form name into each release version. I
would much prefer to simply build the customized form, compile it, add
it to the library for the version, link and ship.

Any and all suggestions appreciated (other than don't do it in COBOL. I
really don't have a choice on that).

Thanks
Bruce

#############################################################################
                                     !                                      
Bruce E. Golightly                   !  bg0l@andrew.cmu.edu (BeeGeeZeroEl)  
Chief of Data Base Development       !  Voice - (412)268-8560
Telecommunications Group             !  Fax   - (412)268-5249               
Carnegie Mellon University           !  University Computation Center        
                                     !  4910 Forbes Ave.            
Past President, West. Pa. IUA        !  Pittsburgh PA 15213-3890
#############################################################################

Newsgroups: comp.databases.ingres