Detail View 2005

Datum

08.04.2005

MM/DD/YYYY

Keywords

How can I find the program name in Version 8 new-function mode?

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


How can I find the program name in Version 8 new-function mode?

Problem
For RDIPROGN, the DB2 Version 8 precompiler generates a value similar the following value:
DC XL8'524C5853414D5020'

We are having difficulty interpreting this value when mapped into the RDIPRGNF, RDIPRGNP, and RDIPRGN2 fields respectively of the Version 8 RDI:

RDIPROGN DS CL8 NAME OF PROGRAM (preV8)
ORG RDIPROGN OVERLAY FOR V8 LONG PROGRAM NAME RDIPRGNF DS CL2 X'524C' Alignment for PROGRAM NAME PTR RDIPRGNP DS XL4 X'5853414D' PTR TO Long PROGRAM NAME (V8)
RDIPRGN2 DS CL2 X'5020' Alignment for PROGRAM NAME PTR


Cause
We can obtain the program name from RDIPROGN only in cases where the RDI structure was generated by DB2® precompilers up to Version 7. In these cases, the RDIPROGN field at offset +6 into the RDI contains the program name. For example:

  EXEC SQL OPEN CSR
  B     *+32
  DC    H'40',X'0000',H'50'
  DC    CL8'DCA8IVP ',XL8'1773AFD91B53B368',H'1'
  DC    H'59,3'

In contrast, the RDI structure that is generated by the DB2 Version 8 precompiler does not contain a program name at offset +6 into the RDI. For
example:

  EXEC SQL OPEN CSR
  B     *+56
  DC    H'64',X'0000',H'50'
  DC    XL8'4443413849565020'
  DC    XL8'1771CA5A0F73AFD8',H'1'
  DC    H'1208,3,0,59',10H'0'
The value XL8'4443413849565020' is not the program name CL8'DCA8IVP'. Also, the DIPRGNP field does not contain a valid (usable) pointer to a long program name structure.

Solution
RDIPROGN is in Unicode. DB2 Version 8 uses the hex representation of the
UTF-8 characters for the program name. Thus, the hex representation does show your program name:

  EXEC SQL OPEN CSR
   B     *+56
   DC    H'64',X'0000',H'50'
   DC    XL8'4443413849565020' <----
   DC    XL8'1771CA5A0F73AFD8',H'1'
   DC    H'1208,3,0,59',10H'0'           '4443413849565020' is the hex
representation of the UTF-8 characters 'DCA8IVP '


Additional information:
If the program name includes any of the national characters (@, #, $), the program name is in EBCDIC instead of UTF-8. In this case, EBCDIC is used, because the national characters might expand to more than one UTF-8 byte when translated, and the name shouldn't exceed 8 bytes.

The CCSID of the program name is specified in the RDICCSID field that is defined in the DSNXRDI.COPY file. The structures that the precompiler generates in the host language do not have the same names as the fields in the DSNXRDI.COPY file, and the names are different in the different host languages. So, for example, you won't find a field named RDIPROGN or RDICCSID in a precompiled PL/I, COBOL, C/C++, Fortran, or Assembler program.

If the precompiler is run in Version 8 compatibility mode (NEWFUN(NO)), the program name is in EBCDIC:


 *   EXEC SQL SELECT C1,C1 INTO :L1:I1, :L2:I2 FROM T1
           WHERE C3 = :HV1
     B     *+32
     DC    H'40',X'4400',H'30'
     DC    XL8'C1E2D4E3C5E2E340'   <--- program name in EBCDIC
     DC    XL8'1773D76717B9C271',H'1'
     DC    H'60,231'


In New Function Mode (NEWFUN(YES)), in Assembler, you need to look at the
SQLSTNM7 field (which in Version 7 was the statement number, but in Version
8 new-function mode is the UTF-8 CCSID of the program name, or zero if it is EBCDIC). For example, in the following generated Assembler code, the assignment of the CCSID of the program name (which is 1208 in my example, which is the UTF-8 CCSID) is marked:


*   EXEC SQL SELECT C1,C1 INTO :L1:I1, :L2:I2 FROM T1
           WHERE C3 = :HV1
     B     *+56
     DC    H'64',X'4400',H'30'
     DC    XL8'41534D5445535420' <- program name ASMTEST in UTF-8
     DC    XL8'1773D73B12904C22',H'1'
     DC    H'1208,231,0,60',10H'0' <-- 1st halfword is '1208' = UTF-8

If the name is generated in EBCDIC, it looks like the following:

 *   EXEC SQL SELECT C1,C1 INTO :L1:I1, :L2:I2 FROM T1
           WHERE C3 = :HV1
     B     *+56
     DC    H'64',X'4400',H'30'
     DC    XL8'C1E25BE3C5E2E340' <-- program name ASMTEST in EBCDIC
     DC    XL8'1773D755027DD12B',H'1'
     DC    H'0,231,0,60',10H'0' <--- 1st halfword = '0', which causes DB2
to use the EBCDIC CCSID defined on the installation panel.


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

With kind regards
Michael Dewert, Software GroupTechnical Sales DB2

© Gernot Ruban