Hi All,
Trying to retrieve data from QSYS2.DISPLAY_JOURNAL using below SQL. It works fine, except that GroupNumber, which is a numeric (Packed) field. It does not show the actual value, instead with special characters. May I know how can I convert it into numeric, in this SQL? Thanks!
SELECT
SEQUENCE_NUMBER, journal_code, journal_entry_type,
-- entry_data field split in the original file fields
CAST(cast(substring(entry_data, 1, 1) as char(1) for bit data) as CHAR(1) CCSID 1141) as Active,
CAST(cast(substring(entry_data, 2, 1) as char(1) for bit data) as CHAR(1) CCSID 1141) as DefaultValue,
CAST(cast(substring(entry_data, 3, 15) as char(15) for bit data) as CHAR(15) CCSID 1141) as Index,
CAST(cast(substring(entry_data, 18, 10) as char(10) for bit data) as CHAR(10) CCSID 1141) as Code,
CAST(cast(substring(entry_data, 28, 3) as char(3) for bit data) as CHAR(3) CCSID 1141) as GroupNumber,
CAST(cast(substring(entry_data, 33, 100) as char(100) for bit data) as CHAR(100) CCSID 1141) as Value
FROM TABLE (
QSYS2.DISPLAY_JOURNAL( 'JOURNALS', 'PRODJRN', OBJECT_NAME=>'CONTACT',
STARTING_RECEIVER_NAME => '*CURAVLCHN',
OBJECT_LIBRARY=>'MYLIB',
OBJECT_OBJTYPE=>'*FILE',
OBJECT_MEMBER=>'CONTACT',
JOURNAL_ENTRY_TYPES =>'DL'));
------------------------------
Prakash Shanmugam
------------------------------
#SQL