Re: Can I override the table my program looks at?
Posted in 1994
Topics: Installation, Setup & Upgrades, Connectivity: ESQL/C, 4GL & Embedded SQL, Platform-Specific Issues
In article <Csy5zx.twu@pcss.com> bdixon@pcss.com (Bill Dixon) writes:
>We are using a case tool (source code generator) that generates MF
>COBOL code with embedded SQL that accesses an Informix database. We
>have run into a problem that we do not know how to solve, especially
>since we CANNOT modify the COBOL source code without losing our
>changes the next time we regenerate our code.
>
>Here is the scenario: We have a program (PROG1) that accesses
>several database tables (TABLE1, TABLE2 & TABLE3) and creates a
>report. This program was generated by the case tool, and works
>correctly. However, now we want to create a duplicate of TABLE1
>(TABLE1A), modify the data in it with another program (PROG2), and
>run PROG1 against TABLE1A, TABLE2 & TABLE3. We also need to be able
>to run PROG1 against the original tables.
>
.
.
>P.S. Our environment is:
> IBM RS/6000, model 230
> AIX 3.2.4 (although we could upgrade to 3.2.5 if need be)
> MF COBOL 3.1
> Informix SE 5.?
>
>--
>Bill Dixon
This might not apply to what you do or how the case tool works, but
I'll toss it in just in case.
Using Esql/C we have many cases in which we create dynamic SQL such as
sprintf (buf, "select * from %s", tabname);
Then execute buf. You can get a lot fancier than this, that's just an
example. I just finished a program that takes a flat file as input. In the
flat file are the names of tables and columns to examine. The same code
ends up running against hundreds of different tables with different
schemas.
I don't know what your COBOL with embedded SQL looks like but if you could
replace lines such as:
SELECT * FROM TABLE1;
with COBOL's version of
sprintf (buf, "select * from %s", tabname);
<do-steps-needed-to-declare-and-exec> buf;
you'd be there.
If all else fails ditch COBOL and use 'C'. On UNIX with 'C' at least you'll
have fighting chance. ;-) ;-)
Look in your Informix/COBOL book (if there is such a thing) for dynamic SQL.
Good luck,
JP
--
-------------------------------------------------------------------------------
Jean-Pierre Trevisani
Project Leader Geac-CLSI Inc.
320 Nevada Street