DB read and initializing values

 1 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
Chesca
Veteran Member
Posts: 490
Veteran Member
    coming from the mainframe world and SQL, I would initialize DB fields by initializing the declagen. How is it done in 4GL? 
               MOVE LPMST-TEM-COMPANY        TO DB-COMPANY.
               MOVE LPMST-TEM-EMPLOYEE       TO DB-EMPLOYEE.
               MOVE LPMST-TEM-PLAN           TO DB-PLAN.
               MOVE LPMST-TEM-EMPLOYEE-GROUP TO DB-EMPLOYEE-GROUP.
               MOVE LPMST-TEM-POSITION       TO DB-POSITION.
               MOVE 5                        TO WS-DB-BEG-RNG.
               MOVE SPACES                   TO FILTER-STRING.
               MOVE "(TTR-TRAN-TYPE = '21')" TO FILTER-STRING.
               PERFORM 890-CREATE-FILTER.
               PERFORM 850-FILTER-BEGRNG-TTRSET1.
               PERFORM
                   UNTIL (TAEMPTRANS-KNOTFOUND)
    Ari
    Veteran Member
    Posts: 49
    Veteran Member
      I assume you mean a DCLGEN. (Table schema used by Mainframe COBOL programs that work against a database. Usually DB2).
      In Lawson the DCLGEN is essentially taken care of by defining the Table(File) in dbdef. Blddbdict is then run to produce an interim Data Dictionary. Dbreog is then run to make the dictionary permanent and to build any tables in the Database that are needed.
      When a COBOL program that was built with the Case\4GL tool is compiled the COBOL record descriptions are created in the source code from the dbdef definitions. Move statements are the same as any standard COBOL. The Lawson Case\4GL is ultimately compiled to Microfocus Net Express Cobol. If you want to put some value in a Database Table Column you would just move it to the Database Table Column Name that has been defined in dbdef. When the record is read or written to the Database it just goes through an API Routine that uses the Data Dictionary for data type translation to an OLE-DB Driver to the database.