Annoyingly this isn't the quick work around I'd hoped for because the
cur.description list contains other column type information I use to apply
formatting to the spreadsheet cells.
Eg:
for item in cur.description:
... print(item)
...
['UNIQUE_ID', DBAPITypeObject({'INT', 'INTEGER', 'SMALLINT'}), 11, 11, 10,
0, False]
['CREATED_TIMESTAMP', DBAPITypeObject({'TIMESTAMP'}), 26, 26, 26, 6, False]
['CREATED_PROGRAM', DBAPITypeObject({'VARCHAR', 'CHAR', 'CHAR VARYING',
'CHARACTER VARYING', 'STRING', 'CHARACTER'}), 10, 10, 10, 0, False]
['THIRD_PARTY_ID', DBAPITypeObject({'NUM', 'NUMERIC', 'DECIMAL', 'DEC'}),
7, 7, 5, 0, False]
['MSG_STATUS', DBAPITypeObject({'VARCHAR', 'CHAR', 'CHAR VARYING',
'CHARACTER VARYING', 'STRING', 'CHARACTER'}), 1, 1, 1, 0, False]
['REQUEST_TEXT', DBAPITypeObject({'DBCLOB', 'CHARACTER LARGE OBJECT', 'CHAR
LARGE OBJECT', 'CLOB'}), 2097152, 2097152, 2097152, 0, False]
For the scenario I'm describing where the column name contains a £, the
cur.description list is completely unusable - as soon as you access it in
any way it throws an exception.
Back to the column itself - the one with the £, it is kind of interesting:
Here is the field in question - on an old legacy file defined in DDS:
A CMAPR£ 13P 2 TEXT('APPROVED ORDER TOTAL£')
The source physical file has CCSID of 285.
DSPFFD shows:
Field Level Information
Data Field Buffer Buffer Field Column
Field Type Length Length Position Usage Heading
CMAPR£ PACKED 13 2 7 812 Both CMAPR£
Field text . . . . . . . . . . . . . . . : APPROVED ORDER TOTAL£
Looking at Syscolumns:
--------------------------------------------
COLUMN_NAME CMAPR$
COLUMN_HEADING CMAPR£
CCSID <null>
COLUMN_TEXT APPROVED ORDER TOTAL£
SYSTEM_COLUMN_NAME CMAPR$
I appreciate that I'm looking at this in my IBMi greenscreen job where my
values are:
Language identifier . . . . . . . . . . . . . . . : ENG
Country or region identifier . . . . . . . . . . : GB
Coded character set identifier . . . . . . . . . : 285
Default coded character set identifier . . . . . : 285
but it's interesting to see the difference between COLUMN_NAME,
SYSTEM_COLUMN_NAME (with the $) and COLUMN_HEADING with the £.
I know that in EBCDIC CCSID 285 the £ symbol is 5B and in EBCDIC CCSID 37
5B is the $ symbol.
I'd assume that the COLUMN_NAME showing as CMAPR$ is not simply an
incorrect assumption about CCSIDs but something more deliberate.
I'm not quite sure of the correct mechanism to get this addressed - PMR or
github issue etc but if someone could point in the right direction I could
look to do that
thanks and regards,
Craig
As an Amazon Associate we earn from qualifying purchases.