Hi,
I have a program which works fine with the EBCIDIC DB2 database, and I would like to use the same program with a UNICODE DB2 database.
Is there anything specific I will need to do in a cobol program when using a UNICODE DB2 database?
I ask this because I get a -302 error when I run the program. The SQL which gives this error is as below. I am using Low and High values in the query, are they any different in a UNICODE database?
SELECT
CURRENCY_CODE ,
CCY_NAME ,
SHORT_CODE ,
STATUS ,
MAKER_ID ,
MAKER_TS
FROM
VC_CURRENCY_P
WHERE
( CURRENCY_CODE >= :CURRENCY-CODE-LOW
AND
( CURRENCY_CODE <= :CURRENCY-CODE-HIGH
AND
( CCY_NAME >= :CCY-NAME-LOW
AND
( CCY_NAME <= :CCY-NAME-HIGH
AND
( SHORT_CODE >= :SHORT-CODE-LOW
AND
( SHORT_CODE <= :SHORT-CODE-HIGH
AND
( STATUS >= :STATUS-LOW
AND
( STATUS <= :STATUS-HIGH
AND
( MAKER_ID >= :MAKER-ID-LOW
AND
( MAKER_ID <= :MAKER-ID-HIGH
AND
(
( CCY_NAME > :CCY-CCY-NAME )
)
ORDER BY
CCY_NAME ASC ;
The Low and High variables are defined in the working storage section with the same pic size as defined in the database. The values are set as LOW VALUE and HIGH VALUE respectively.
Any help is much appreciated asap since our project is getting delayed due to this issue.
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hi Sheela,
You might try setting the initial values to x'0000. . . .0000' and x'FFFF....FFFF' (for whatever the length) and see if that changes anything.
If this is seriously delaying your progress, i'd suggest
1. ensuring that each of the 5 fields is defined as a stand-alone key
2. writing 5 routines (one for each "where" field) and then doing "if" tests on the found set to discard any unwanted rows.
Depending on the activity and size of this table adding the keys may not be practical. If it is periodically added to, but those fields are rarely changed, the overhead would not be high. There would be some additional disk space required for the additonal keys.
Once you're over the "crunch", this might be revisited for a more elegant solution.
This will get more (and maybe better) replies in the DB2 forum (where i believe i saw it. . . .)
Please let me know if changing the code changes your results. If this routine is in many modules, you may want to make it a copybook.