search cancel

Gen - Incorrect Column-Name in generated SQL

book

Article ID: 238890

calendar_today

Updated On:

Products

Gen Gen - Host Encyclopedia Gen - Run Time Distributed Gen - Workstation Toolset

Issue/Introduction

The key of the situation is a many-many relation between TYPE-DOCUMENT and DOCUMENT.  Some action blocks read for example another entity MESURAGE, which is linked to a unique DOCUMENT.  A second statement in the action block reads a linked TYPE-DOCUMENT, through the relation table.

Gen8X generates incorrect SQL source-code, with a wrong name of the identifier column of TYP-DOCUMENT.
In Gen76, the code generated was correct.

 

The "bad" source-code is in cobol-directory, with the line
           WHERE ( :FK-DOCUM-NUM-003EF = R_DOCUM_TYPED02."NUMERO" )
which should be
           WHERE ( :FK-DOCUM-NUM-003EF = R_DOCUM_TYPED02."FK_DOCUM_NUMERO" )

 

Environment

Release : 8.6

Component : Gen Generators

Resolution

1. Re-work the READ for a more desirable permanent solution.

+- READ document 
 |       mesurage 
 |        WHERE DESIRED document est_archivee_sous DESIRED mesurage 
 |        AND DESIRED mesurage numero IS EQUAL TO "1234" 
 +- WHEN successful 
 |  |  +- READ typedoc 
 |  |        WHERE DESIRED typedoc typise CURRENT document 
 |  +- WHEN successful 
 |  +- WHEN not found
 |  +--
 +- WHEN not found
 +--

2. A work-around is to set an environment variable, GENLTOPT and set it to 'N'. That would be true for the Toolset and CSE generation and is only needed for action bocks having the problem.  If using the Host Ency to generate code then run the GENLTOPT Clist to set the variable to N.

https://knowledge.broadcom.com/external/article/4059/ca-gen-ora00904-invalid-identifier-error.html