Detail View 2007

Datum

04.03.2007

 

Keywords

Add COBOL support for a new compiler option SQLCCSID.

up
davor
weiter

DB2 ist ein Produkt der
IBM Corporation. Bitte
Copyright-  und Trademark-Hinweise beachten!

Add COBOL support for a new compiler option SQLCCSID.

PK31411 UK20084 available 06/11/30 (F611)


COBOL SUPPORT FOR NEW COMPILER OPTION SQLCCSID


Summary Page
APAR Identifier:  PK31411     Last Changed:     06/12/01
Symptom:    NEWFUNC     Status:     CLOSED UR1
Severity:   4     Date Closed:      06/11/28
Component:  5655G5300   Duplicate of:
Reported Release:       340   Fixed Release:
Component Name:   ENT COBOL FOR Z   Special Notice:
Customer Name:          Customer #:       9999998 99
Current Target Date:    07/11/15    Flags:
SCP:
Platform:
Status Detail:                SHIPMENT
'
Fix Page
PE PTF List:
PTF List:   Release 340   : UK20084 available 06/11/30 (F611)

Parent APAR:

Child APAR List:
'
Submitter Page
Error.
Description:      Add COBOL support for a new compiler option SQLCCSID.


Local Fix:
Responder Page
Problem
Summary:
****************************************************************
* USERS AFFECTED: Enterprise COBOL users that compile          *
*                 COBOL-DB2 applications with the DB2          *
*                 coprocessor (SQL compiler option).           *
****************************************************************
* PROBLEM DESCRIPTION: Users may experience problems with      *
*                      code page coordination between COBOL    *
*                      and DB2, when moving from the DB2       *
*                      precompiler to the DB2 coprocessor.     *
*                      For example, SQL errors may arise from  *
*                      applications that access DB2 string     *
*                      data with the FOR BIT DATA subtype, or  *
*                      that use databases containing data that *
*                      is not correctly encoded per the CCSID  *
*                      specified for the database.             *
****************************************************************
* RECOMMENDATION: Apply the provided PTF.                      *
****************************************************************
With the DB2 coprocessor, a COBOL-determined code page CCSID is associated with most character string host variables.  This CCSID is used when processing these host variables in SQL statements as well as when these variables appear in COBOL statements.  For SQL statements, this COBOL-determined code page CCSID overrides the CCSID that would have been implied by DB2 external mechanisms and defaults.  This CCSID association mechanism is needed for new applications that use Enterprise COBOL and DB2 features for globalized application programming.
However this new mechanism may result in different application behavior than was obtained using the DB2 precompiler, and cause difficulties migrating existing applications from the DB2 precompiler to the DB2 coprocessor.

Problem
Conclusion:
Temporary Fix:
Comments:     A new COBOL compiler option SQLCCSID/NOSQLCCSID and updated
COBOL publications are introduced with this enhancement PTF.
The new option gives users a choice of approaches for code page CCSID coordination between COBOL and DB2, when the DB2 coprocessor is used.
  The SQLCCSID option provides the new coordinated code page CCSID handling between COBOL and DB2.  With this option, application behavior is identical to that obtained with the DB2 coprocessor today, prior to this PTF.
  With the NOSQLCCSID option, the CCSID that is specified in the COBOL CODEPAGE() compiler option is used only for processing COBOL statements within the COBOL program; that CCSID is not used for processing SQL statements.  Instead, DB2 assumes in processing SQL statements that host variable data values are encoded according to the CCSID or CCSIDs that are specified through DB2 external mechanisms and defaults.
  The NOSQLCCSID option is recommended for applications that require the highest compatibility with the behavior of the DB2 precompiler.
  The Enterprise COBOL Programming Guide, Migration Guide, and Customization Guide are updated with documentation of the new compiler option and with recommended programming techniques using these options.
  This APAR text has a subset of the documentation updates. The complete documentation updates for this APAR can be found at http://www.ibm.com/software/awdtools/cobol/zos
================================================================
Enterprise COBOL for z/OS Programming Guide, SC27-1412-4.
Chapter 17, "COMPILER OPTIONS" is updated with the following new
section:
  SQLCCSID

  Use the "SQLCCSID" compiler option to control whether the
  "CODEPAGE" compiler option will influence the processing of
  SQL statements in your COBOL programs.

                               .-SQLCCSID---.
  SQLCCSID OPTION SYNTAX:   >--+------------+------------><
                               '-NOSQLCCSID-'
  Default is: "SQLCCSID"
  Abbreviations are: "SQLC"|"NOSQLC"

  The "SQLCCSID" option has an effect only when you use the
  integrated DB2 coprocessor ("SQL" compiler option).
Chapter 21, "PROGRAMMING FOR A DB2 ENVIRONMENT" has the following new sections:
  COBOL AND DB2 CCSID DETERMINATION

  All DB2 string data other than BLOB, BINARY, and
  VARBINARY data has an associated encoding scheme and a coded
  character set ID (CCSID). This is true for fixed-length and
  variable-length character strings, fixed-length and
  variable-length graphic character strings, CLOB host
  variables, and DBCLOB host variables.

  When you use the integrated DB2 coprocessor, the determination
  of the code page CCSID that will be associated with the string
  host variables used in SQL statement processing depends on the
  setting of the COBOL "SQLCCSID" option, on the programming
  techniques used, and on various DB2 configuration options.

  When you use the "SQL" and "SQLCCSID" COBOL compiler options,
  the CCSID nnnnn that is specified in the "CODEPAGE" compiler
  option, or that is determined from the COBOL data type of a
  host variable, is communicated automatically from COBOL to
  DB2. DB2 associates the COBOL CCSID with host variables,
  overriding the CCSID that would otherwise be implied by DB2
  external mechanisms and defaults. This associated CCSID is
  used for the processing of the SQL statements that reference
  host variables.

  When you use the "SQL" and "NOSQLCCSID" compiler options, the
  CCSID nnnnn that is specified in the "CODEPAGE" compiler
  option is used only for processing COBOL statements within
  the COBOL program; that CCSID is not used for the processing
  of SQL statements. Instead, DB2 assumes in processing SQL
  statements that host variable data values are encoded
  according to the CCSID or CCSIDs that are specified through
  DB2 external mechanisms and defaults.

  CODE-PAGE DETERMINATION FOR STRING HOST VARIABLES IN SQL
  STATEMENTS

  When you use the integrated DB2 coprocessor ("SQL" compiler
  option), the code page for processing string host variables in
  SQL statements is determined as shown below, in descending
  order of precedence.
  o   A host variable that has "USAGE NATIONAL" is always
      processed by DB2 using CCSID 1200 (Unicode UTF-16). For
      example:
        01  hostvariable pic n(10) usage national.
  o   An alphanumeric host variable that has an explicit "FOR
      BIT DATA" declaration is set by DB2 to CCSID 66535,
      which indicates that the variable does not represent
      encoded characters. For example:
        EXEC SQL DECLARE hostvariable VARIABLE FOR BIT DATA
        END-EXEC
  o   A BLOB, BINARY, or VARBINARY host variable has no CCSID
      association.  These string types do not represent encoded
      characters.
  o   A host variable for which you specify an explicit CCSID
      override in the SQLDA is processed with that CCSID.
  o   A host variable that you specify in a declaration with an
      explicit CCSID is processed with that CCSID. For example:
        EXEC SQL DECLARE hostvariable VARIABLE CCSID nnnnn
        END-EXEC
  o   An alphanumeric host variable, if the "SQLCCSID" compiler
      option is in effect, is processed with the CCSID nnnnn
      from the "CODEPAGE" compiler option.
  o   A DBCS host variable, if the "SQLCCSID" option is in
      effect, is processed with the mapped value mmmmm, which is
      the pure DBCS CCSID component of the mixed (MBCS) CCSID
      nnnnn from the "CODEPAGE(nnnnn)" compiler option.
  o   An alphanumeric or DBCS host variable, if the "NOSQLCCSID"
      option is in effect, is processed with the CCSID from the
      DB2 ENCODING bind option, if specified, or from the
      APPLICATION ENCODING set in DSNHDECP through the DB2
      installation panel DSNTIPF.

  PROGRAMMING WITH THE SQLCCSID OR NOSQLCCSID OPTION

  In general, the "SQLCCSID" option is recommended for new
  applications that use the integrated DB2 coprocessor, and as a
  long-term direction for existing applications. The
  "NOSQLCCSID" option is recommended as a mechanism for
  migrating existing precompiler-based applications to use the
  integrated DB2 coprocessor.

  The "SQLCCSID" option is recommended for COBOL-DB2
  applications that have any of these characteristics:
  o   Use COBOL Unicode support
  o   Use other COBOL syntax that is indirectly sensitive to
      CCSID encoding, such as XML support or object-oriented
      syntax for Java interoperability
  o   Process character data that is encoded in a CCSID that is
      different from the default CCSID assumed by DB2

  The "NOSQLCCSID" option is recommended for applications that
  require the highest compatibility with the behavior of the DB2
  precompiler.

  For applications that use COBOL alphanumeric data items as
  host variables interacting with DB2 string data that is
  defined with the "FOR BIT DATA" subtype, you must either:
  o   Use the "NOSQLCCSID" compiler option
  o   Specify explicit "FOR BIT DATA" declarations for those
      host variables, for example:
        EXEC SQL DECLARE hostvariable VARIABLE FOR BIT DATA
        END-EXEC
================================================================
Enterprise COBOL for z/OS Compiler and Runtime Migration Guide, GC27-1409-4.
Appendix K. "DB2 COPROCESSOR INTEGRATION" has the following update under "Bit data host variables":
  Coprocessor:  a COBOL alphanumeric data item can be used as a
  host variable to hold DB2 character data having subtype FOR
| BIT DATA only if:
| o You specify the NOSQLCCSID compiler option, or o An explicit EXEC
| SQL DECLARE VARIABLE statement for the host
|   variable is specified in the COBOL program. For example:
|    EXEC SQL DECLARE :HV1 VARIABLE FOR BIT DATA END-EXEC
|
| If you use the DB2 DCLGEN command to generate COBOL declarations for a
| table, you can create the EXEC SQL DECLARE statements automatically. 
| To do so, specify the DCLBIT(YES) option of the DCLGEN command.
================================================================
Enterprise COBOL for z/OS Customization Guide, GC27-1410-4.
Chapter 2, "ENTERPRISE COBOL COMPILER OPTIONS", has the following new option:
                                            -YES-
                                           |     |
  SQLCCSID Syntax:  >>-- SQLCCSID= ----------NO------><
                                    |   |
                                     -*-
  Default SQLSSCID=YES
  YES:  Indicates that the CODEPAGE compiler option setting will
  influence the processing of SQL statements within the source
  program when the integrated DB2 coprocessor (SQL compiler
  option) is used.
  NO:  Indicates that the CODEPAGE compiler option setting will
  not influence the processing of SQL statements within the
  source program when the integrated DB2 coprocessor is used.
  Only COBOL statements will be sensitive to the CCSID specified
  in the CODEPAGE option.

  Notes:
  1. The SQLCCSID option has an effect only when you use the
  integrated DB2 coprocessor (SQL compiler option).
  2. The NOSQLCCSID option is recommended for applications that
  require the highest compatibility with the behavior of the DB2
  precompiler.
  3. For details on the SQLCCSID option, see the Enterprise
  COBOL for z/OS Programming Guide.

PUBS CLOSING CODE: DEVCHNG

Modules/Macros:   COMPOPTS CSCOMM   IGYCDOPT IGYCOPI  IGYCOPT  IGYKCNTL
IGYKSTAT
IGYTSQL




P.S. Please pass my address to anyone interested in DB2 HOTLINE - thank you.

With kind regards
Michael Dewert, Software Group
DB2 Development
DB2 Information Management Software

© Gernot Ruban