Hi Knut,
I'd like this solution and I want use this for to access to remote federated DB ( db2 9,? linux ) via cobol program on z/os db2 v9 z/os.
Because I can install db2 luw in Unicode or ascii with standard sort order and retrieve z/os record in cobol program with right order.
Can I use this function indeed?
select *
from t1
ORDER BY COLLATION_KEY_BIT ( 1 , ‘EBCIDIC’ )
, COLLATION_KEY_BIT ( 3 , ‘EBCIDIC’ ) ……
It is better write the statement like this?
select COLLATION_KEY_BIT ( c1 , ‘EBCIDIC’ ) as c1
, COLLATION_KEY_BIT ( c3 , ‘EBCIDIC’ ) c3
, n1 as number
from t1
order by 1 , 2
In this case is the ascii/ebcdic conversion avoided on Host?
thank you very much :-)
Giorgio Salvatori
CRM application Department
SGS-BP - Italy
giorgiocelso.salvatori@sgsbp.it
Quote:
Originally Posted by stolze
What I would consider in your case is to write a UDF that converts your string to the target code page (some EBCDIC cp), and then you use this function in the ORDER BY clause:
Code:
SELECT ...
FROM ...
WHERE ...
ORDER BY str2ebcdic(text)
The function can return the first 100 or 1000 (or whichever length you need) bytes using the VARCHAR FOR BIT DATA data type. Then you won't run into any problems due to other collation sequences used by DB2; I'd have a binary comparison of the ebcdic strings.
|