IBM PC COBOL/CICS/DB2 Compile Probs 
Author Message
 IBM PC COBOL/CICS/DB2 Compile Probs

Am using UDB DB2 V5.2, Visualage COBOL 2.2 and CICS 3.1 and
could really appreciate some help with the following problem
having to do with the SQLCA.

A.
In a COBOL/CICS/DB2 program TES1 I have the following code:

       WORKING-STORAGE SECTION.

       01  FILLER.
           05 WS-THIS-PROG                PIC  X(008) VALUE 'TES1   '.
           05 WS-THIS-TRID                PIC  X(004) VALUE 'SASD'.

           EXEC SQL INCLUDE SQLCA END-EXEC.

           EXEC SQL BEGIN DECLARE SECTION END-EXEC.

******************************************************************
      * DCLGEN TABLE(TES1DATA)                                        
      *        LIBRARY(T9660GH.A.GS(SWSCOND))                        
      *        ACTION(REPLACE)                                        
      *        LANGUAGE(COBOL)                                        
      *        APOST                                                  
      * ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS  

******************************************************************
           EXEC SQL DECLARE TES1DATA TABLE
           ( EMPLOYEE_NUMBER                CHAR(5) NOT NULL,
             HIRE_DATE                      DATE NOT NULL,
             etc.

B.
The following PREP command delivered the following good results:

E:\conrad\temtest>DB2 PREP TES1.SQB BINDFILE LANGLEVEL SAA1 TARGET
IBMCOB OUTPUT TES1.CCP

LINE    MESSAGES FOR TES1.SQB ------
--------------------------------------------------------------------
        SQL0060W  The "COBOL" precompiler is in progress.
        SQL0091W  Precompilation or binding was ended with "0"
                  errors and "0" warnings.

C.
The resulting TES1.CCP file finished up with code as follows:

       WORKING-STORAGE SECTION.

       01  SQLDA-ID pic 9(4) comp-5.
       01  SQLDSIZE pic 9(4) comp-5.
       01  SQL-STMT-ID pic 9(4) comp-5.
       01  SQLVAR-INDEX pic 9(4) comp-5.
       01  SQL-DATA-TYPE pic 9(4) comp-5.
       01  SQL-HOST-VAR-LENGTH pic 9(9) comp-5.
       01  SQL-LITERAL1 pic X(19).
       01  SQL-LITERAL2 pic X(19).
       01  SQL-LITERAL3 pic X(19).
       01  SQL-CALL-TYPE pic 9(4) comp-5.
       01  SQL-SECTIONUMBER pic 9(4) comp-5.
       01  SQL-INPUT-SQLDA-ID pic 9(4) comp-5.
       01  SQL-OUTPUT-SQLDA-ID pic 9(4) comp-5.

       01  FILLER.
           05 WS-THIS-PROG                PIC  X(008) VALUE 'TES1   '.
           05 WS-THIS-TRID                PIC  X(004) VALUE 'SASD'.

      *EXEC SQL INCLUDE SQLCA END-EXEC
      * SQL Communication Area - SQLCA
       COPY "sqlca.cbl".

      *EXEC SQL BEGIN DECLARE SECTION END-EXEC.

******************************************************************
      * DCLGEN TABLE(TES1DATA)                                        
      *        LIBRARY(T9660GH.A.GS(SWSCOND))                        
      *        ACTION(REPLACE)                                        
      etc.

***************
* Questions   *
***************
1. To do with the COPY "sqlca.cbl" statement. When I installed DB2
   such a file did not appear. When I did a CICS translator run
   I got the message:

       ERROR *FAA0117E Copy book "sqlca.cbl".CBL not found

   Where do I find it? Was it supposed to be part of the package?

2. Are the 01 SQL statements shown above, always generated?

3. Is there no DCLGEN utility with UDB?

Many thanks in advance.



Sat, 13 Apr 2002 03:00:00 GMT  
 IBM PC COBOL/CICS/DB2 Compile Probs
The SQLLIB.CBL should come with your copy of DB2, it is located under
SQLLIB\INCLUDE\COBOL_A or SQLLIB\INCLUDE\COBOL_i or SQLLIB\INCLUDE\COBOL_mf,
so it can be used with any of those versions of Cobol.

To my knowledge, the SQL statements are always generated.

Unfortunately DCLGEN does not come with the product.

Hope this answers your questions.

Quote:

>Am using UDB DB2 V5.2, Visualage COBOL 2.2 and CICS 3.1 and
>could really appreciate some help with the following problem
>having to do with the SQLCA.

>A.
>In a COBOL/CICS/DB2 program TES1 I have the following code:

>       WORKING-STORAGE SECTION.

>       01  FILLER.
>           05 WS-THIS-PROG                PIC  X(008) VALUE 'TES1   '.
>           05 WS-THIS-TRID                PIC  X(004) VALUE 'SASD'.

>           EXEC SQL INCLUDE SQLCA END-EXEC.

>           EXEC SQL BEGIN DECLARE SECTION END-EXEC.

>******************************************************************
>      * DCLGEN TABLE(TES1DATA)
>      *        LIBRARY(T9660GH.A.GS(SWSCOND))
>      *        ACTION(REPLACE)
>      *        LANGUAGE(COBOL)
>      *        APOST
>      * ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS

>******************************************************************
>           EXEC SQL DECLARE TES1DATA TABLE
>           ( EMPLOYEE_NUMBER                CHAR(5) NOT NULL,
>             HIRE_DATE                      DATE NOT NULL,
>             etc.

>B.
>The following PREP command delivered the following good results:

>E:\conrad\temtest>DB2 PREP TES1.SQB BINDFILE LANGLEVEL SAA1 TARGET
>IBMCOB OUTPUT TES1.CCP

>LINE    MESSAGES FOR TES1.SQB ------
>--------------------------------------------------------------------
>        SQL0060W  The "COBOL" precompiler is in progress.
>        SQL0091W  Precompilation or binding was ended with "0"
>                  errors and "0" warnings.

>C.
>The resulting TES1.CCP file finished up with code as follows:

>       WORKING-STORAGE SECTION.

>       01  SQLDA-ID pic 9(4) comp-5.
>       01  SQLDSIZE pic 9(4) comp-5.
>       01  SQL-STMT-ID pic 9(4) comp-5.
>       01  SQLVAR-INDEX pic 9(4) comp-5.
>       01  SQL-DATA-TYPE pic 9(4) comp-5.
>       01  SQL-HOST-VAR-LENGTH pic 9(9) comp-5.
>       01  SQL-LITERAL1 pic X(19).
>       01  SQL-LITERAL2 pic X(19).
>       01  SQL-LITERAL3 pic X(19).
>       01  SQL-CALL-TYPE pic 9(4) comp-5.
>       01  SQL-SECTIONUMBER pic 9(4) comp-5.
>       01  SQL-INPUT-SQLDA-ID pic 9(4) comp-5.
>       01  SQL-OUTPUT-SQLDA-ID pic 9(4) comp-5.

>       01  FILLER.
>           05 WS-THIS-PROG                PIC  X(008) VALUE 'TES1   '.
>           05 WS-THIS-TRID                PIC  X(004) VALUE 'SASD'.

>      *EXEC SQL INCLUDE SQLCA END-EXEC
>      * SQL Communication Area - SQLCA
>       COPY "sqlca.cbl".

>      *EXEC SQL BEGIN DECLARE SECTION END-EXEC.

>******************************************************************
>      * DCLGEN TABLE(TES1DATA)
>      *        LIBRARY(T9660GH.A.GS(SWSCOND))
>      *        ACTION(REPLACE)
>      etc.

>***************
>* Questions   *
>***************
>1. To do with the COPY "sqlca.cbl" statement. When I installed DB2
>   such a file did not appear. When I did a CICS translator run
>   I got the message:

>       ERROR *FAA0117E Copy book "sqlca.cbl".CBL not found

>   Where do I find it? Was it supposed to be part of the package?

>2. Are the 01 SQL statements shown above, always generated?

>3. Is there no DCLGEN utility with UDB?

>Many thanks in advance.



Sun, 14 Apr 2002 03:00:00 GMT  
 IBM PC COBOL/CICS/DB2 Compile Probs

Quote:

>Am using UDB DB2 V5.2, Visualage COBOL 2.2 and CICS 3.1 and
>could really appreciate some help with the following problem
>having to do with the SQLCA.

>A.
>In a COBOL/CICS/DB2 program TES1 I have the following code:

>       WORKING-STORAGE SECTION.

>       01  FILLER.
>           05 WS-THIS-PROG                PIC  X(008) VALUE 'TES1   '.
>           05 WS-THIS-TRID                PIC  X(004) VALUE 'SASD'.

>           EXEC SQL INCLUDE SQLCA END-EXEC.

>           EXEC SQL BEGIN DECLARE SECTION END-EXEC.

>******************************************************************
>      * DCLGEN TABLE(TES1DATA)                                        
>      *        LIBRARY(T9660GH.A.GS(SWSCOND))                        
>      *        ACTION(REPLACE)                                        
>      *        LANGUAGE(COBOL)                                        
>      *        APOST                                                  
>      * ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS  

>******************************************************************
>           EXEC SQL DECLARE TES1DATA TABLE
>           ( EMPLOYEE_NUMBER                CHAR(5) NOT NULL,
>             HIRE_DATE                      DATE NOT NULL,
>             etc.

>B.
>The following PREP command delivered the following good results:

>E:\conrad\temtest>DB2 PREP TES1.SQB BINDFILE LANGLEVEL SAA1 TARGET
>IBMCOB OUTPUT TES1.CCP

>LINE    MESSAGES FOR TES1.SQB ------
>--------------------------------------------------------------------
>        SQL0060W  The "COBOL" precompiler is in progress.
>        SQL0091W  Precompilation or binding was ended with "0"
>                  errors and "0" warnings.

>C.
>The resulting TES1.CCP file finished up with code as follows:

>       WORKING-STORAGE SECTION.

>       01  SQLDA-ID pic 9(4) comp-5.
>       01  SQLDSIZE pic 9(4) comp-5.
>       01  SQL-STMT-ID pic 9(4) comp-5.
>       01  SQLVAR-INDEX pic 9(4) comp-5.
>       01  SQL-DATA-TYPE pic 9(4) comp-5.
>       01  SQL-HOST-VAR-LENGTH pic 9(9) comp-5.
>       01  SQL-LITERAL1 pic X(19).
>       01  SQL-LITERAL2 pic X(19).
>       01  SQL-LITERAL3 pic X(19).
>       01  SQL-CALL-TYPE pic 9(4) comp-5.
>       01  SQL-SECTIONUMBER pic 9(4) comp-5.
>       01  SQL-INPUT-SQLDA-ID pic 9(4) comp-5.
>       01  SQL-OUTPUT-SQLDA-ID pic 9(4) comp-5.

>       01  FILLER.
>           05 WS-THIS-PROG                PIC  X(008) VALUE 'TES1   '.
>           05 WS-THIS-TRID                PIC  X(004) VALUE 'SASD'.

>      *EXEC SQL INCLUDE SQLCA END-EXEC
>      * SQL Communication Area - SQLCA
>       COPY "sqlca.cbl".

>      *EXEC SQL BEGIN DECLARE SECTION END-EXEC.

>******************************************************************
>      * DCLGEN TABLE(TES1DATA)                                        
>      *        LIBRARY(T9660GH.A.GS(SWSCOND))                        
>      *        ACTION(REPLACE)                                        
>      etc.

>***************
>* Questions   *
>***************
>1. To do with the COPY "sqlca.cbl" statement. When I installed DB2
>   such a file did not appear. When I did a CICS translator run
>   I got the message:

>       ERROR *FAA0117E Copy book "sqlca.cbl".CBL not found

>   Where do I find it? Was it supposed to be part of the package?

You must include the directory d:\SQLLIB\INCLUDE\COBOL_A into the search path.  Best place
to do so is is in the CICSENV.CMD commad file:  Here the relevant part of mine:

 SET SQLLIB=G:\SQLLIB
 SET CICSCOBOL=IBM
 rem
 rem IBM VisualAge for COBOL settings:
 rem
 SET COBPATH=%COBPATH%;%CICSDRV%\%CICSHLD%\USRBIN
 rem
 SET SYSLIB=%CICSDRV%\%CICSHLD%\TOOLS\COBOL\COPYBOOK;%SYSLIB%
 SET SYSLIB=%CICSDRV%\%CICSHLD%\TOOLS\COBOL\SAMPLES\COPYBOOK;%SYSLIB%
 SET SYSLIB=%CASEGEN%\COPY;%SQLLIB%\INCLUDE\COBOL_A;%SYSLIB%
 SET SYSLIB=%CASESRV%\COPY;%SYSLIB%
 SET SYSLIB=..\COPYBOOK;.\;%SYSLIB%
 rem
 rem CICS Cobol settings:
 rem     SET CICSCOBWORK=uservalue
 SET CICSCOBCOPY=%CICSDRV%\%CICSHLD%\TOOLS\COBOL\COPYBOOK;%CICSCOBCOPY%
 SET CICSCOBCOPY=%CICSDRV%\%CICSHLD%\TOOLS\COBOL\SAMPLES\COPYBOOK;%CICSCOBCOPY%
 SET CICSCOBCOPY=%CASEGEN%\COPY;%SQLLIB%\INCLUDE\COBOL_A;%CICSCOBCOPY%
 SET CICSCOBCOPY=%CASESRV%\COPY;%CICSCOBCOPY%
 SET CICSCOBCOPY=..\COPYBOOK;.\;%CICSCOBCOPY%
 SET CICSCOBOPTS=-qnosequence -qlib -qtrunc(bin) -Qnooptimize

Quote:

>2. Are the 01 SQL statements shown above, always generated?

Yes

Quote:
>3. Is there no DCLGEN utility with UDB?

Yes.  But I have included a DCLGEN for COBOL using REXX
/* REXX Command Procedure *********************************************/
/*                                                                    */
/* Name: DCLGEN.REX                                                   */
/*                                                                    */
/* Type: REXX command procedure                                       */
/*                                                                    */
/* Desc: Create COBOL Copy book from DB2 table definitions            */
/*                                                                    */
/* (C): Volker Bandke, BSP GmbH                                       */
/*                                                                    */
/**********************************************************************/
Call Parse_Args translate(ARG(1))         /* get the invocation parms */
                                          /* Load support modules     */
If RxFuncQuery('SQLDBS') <> 0 Then
    rcy=RxFuncAdd('SQLDBS','SQLAR','SQLDBS')
If RxFuncQuery('SQLEXEC') <> 0 Then
    rcy = RxFuncAdd('SQLEXEC','SQLAR','SQLEXEC')

call SQLDBS "START Database Manager"      /* start dbm if needed      */
if (SQLCA.SQLCODE <> -1026 & SQLCA.SQLCODE <> 0) then
  signal DB2Error
CALL SQLEXEC "Connect to "DatabaseName    /* connect to database      */

Creator = TRANSLATE("Volker")

Say
Say 'Creating DCLGEN: 'Creator'.'TableName
Say
Say 'Requested:'
if CommentsRequested then
   Say '           Comments'
else
   Say '           NO Comments'
if NullIndicatorsRequested then
   Say '           Null Indicators'
else
   Say '           NO Null Indicators'
if EXECSQLRequested then
   Say '           EXEC SQL'
else
   Say '           NO EXEC SQL'
if RedefinesRequested then
   Say '           Redefines'
else
   Say '           NO Redefines'
if DisplayRequested then
   Say '           Display of DCLGEN'
Say 'Writing DCLGEN to 'FileName
Say

CatalogCreator = 'SYSIBM'

SqlStatement = "select remarks, colcount",
               " from "CatalogCreator".systables",
               " where name = '"tablename"'",
               "   and creator = '"creator"'"

Call DeclareCursor SqlStatement

do while (fetch_statement() = 0)
   TableRemark = Data.Remarks
   TableColumns = Data.ColCount
end /* Do */

if symbol('data.remarks') = 'LIT' then do
   Say 'Table not found...'
   exit
end /* If */

SqlStatement = "select name, colno, coltype, length, scale, nulls, remarks",
               " from "CatalogCreator".sysCOLUMNS",
               " where tbname = '"tablename"'",
               "   and tbcreator = '"creator"'",
               " order by colno"

Call DeclareCursor SqlStatement

Header.1 = copies(' ',6)copies('*',65)
Header.2 = copies(' ',6)left('* Date Generated:'Date(),64)'*'
Header.3 = copies(' ',6)left('* DCLGEN Table('TableName')',64)'*'
Header.4 = copies(' ',6)left('*        Library('FileName')',64)'*'
k = 4
If CommentsRequested then do
   k=k+1
   Header.k = copies(' ',6)left('*        Comments',64)'*'
end  /* Do */
If RedefinesRequested then do
   k=k+1
   Header.k = copies(' ',6)left('*        Redefines',64)'*'
end  /* Do */
If NullIndicatorsRequested then do
   k=k+1
   Header.k = copies(' ',6)left('*        Null Indicators',64)'*'
end  /* Do */
If EXECSQLRequested then do
   k=k+1
   Header.k = copies(' ',6)left('*        EXEC SQL',64)'*'
end  /* Do */
k=k+1
Header.k = copies(' ',6)left('* ... is the DCLGEN command that made the following
statements',64)'*'
k=k+1
Header.k = copies(' ',6)copies('*',65)
Header.0 = k

EXECSQL.1 = copies(' ',11)'EXEC SQL DECLARE 'TableName' TABLE'
j = 1
FirstEXECSQL = j + 1 /* This number is needed in statement after loop. add 1 to last
EXECSQL Statment */

DCLGEN.1 = copies(' ',6)copies('*',65)
DCLGEN.2 = copies(' ',6)'* COBOL declaration for table ',
         ||left(TableName,18)copies(' ',16)'*'
DCLGEN.3 = copies(' ',6)'* 'left(TableRemark,61)' *'
DCLGEN.4 = copies(' ',6)copies('*',65)
DCLGEN.5 = copies(' ',7)'01 DCL'TableName'.'

do i=6 by 1 while (fetch_statement() = 0)
   j=j+1
   Comment1.i = copies(' ',6)'** 'data.remarks
   if Data.Nulls = 'Y' then
      Comment2.i = copies(' ',6)'** Nulls=Yes'
   DCLGEN.i = copies(' ',11)'05 'left(translate(Data.Name,'-','_'),26)' PIC '
   EXECSQL.j = copies(' ',13)||left(data.Name,31)
   say 'DATA.name='DATA.name
   say 'DATA.coltype='DATA.coltype
   select
      when DATA.coltype='CHAR' then do
         DCLGEN.i = DCLGEN.i||'X('Data.Length').'
         EXECSQL.j = EXECSQL.j||Data.ColType'('Data.Length')'
      end
      when DATA.coltype='VARCHAR' then do
         DCLGEN.i = copies(' ',11)'05 'left(translate(Data.Name,'-','_')'.',26)
         i = i+1
         DCLGEN.i = copies(' ',14)'49 ',
          ||left(translate(Data.Name,'-','_')'-LEN',26)' PIC S9(4) BINARY.'
         i = i+1
         DCLGEN.i = copies(' ',14)'49 ',
          ||left(translate(Data.Name,'-','_')'-TEXT',26)' PIC X('Data.Length').'
         EXECSQL.j = EXECSQL.j||Data.ColType'('Data.Length')'
      end /* When */
      when Data.coltype='DATE' then do
         DCLGEN.i = DCLGEN.i||'X(10).'
         EXECSQL.j = EXECSQL.j||Data.ColType
         If RedefinesRequested then do
            i = i+1
            DCLGEN.i = copies(' ',11)'05 RD-',
             ||left(translate(Data.Name,'-','_'),26)' REDEFINES ',
             ||left(translate(Data.Name,'-','_')'.',26)
            i = i+1
...

read more »



Sun, 14 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Compiling CICS / DB2 programs on IBM VisualAGE COBOL v2.2

2. IBM Mainframe - COBOL,IMS/DB/DC,CICS,DB2 immediate openings

3. ** DB2, CICS, IBM, COBOL, PL1 Positions Avialable

4. Cobol Developers (IBM/DB2/CICS) with at least 3 years APS experience

5. Microfocus Cobol, CICS OS/2, and IBM DB2/2

6. Needed: IBM COBOL - Mainframe CICS and DB2 Programmer/Analysts

7. IBM Mainframe - COBOL,IMS/DB/DC,CICS,DB2 immediate openings

8. ** DB2, CICS, IBM, COBOL, PL1 Positions Avialable

9. COBOL/CICS for the IBM PC

10. COBOL / CICS or COBOL / DB2 Programmers - Baltimore MD

11. MVS Cobol/Cobol II CICS VSAM DB2 IDEAL Datacom Consultant available

12. Seeking experienced COBOL PROGRAMMER with CICS, JCL, DB2, VSAM, IDMS, IMS, COBOL - Cleveland, OH

 

 
Powered by phpBB® Forum Software