I do what Gary is suggesting; using SYSCOLUMN field information to build the output on the fly.
Something like this:
DECIMAL(Trim(Translate(Hex(Substr(ENTRY_DATA,2,1)),'-','DF0123456789')) Concat Insert(Replace(Replace(Hex(Substr(ENTRY_DATA,1,2)),'F',''),'D',''),4,0,'.'),3,0) As LOCATION,
DECIMAL(Trim(Translate(Hex(Substr(ENTRY_DATA,7,1)),'-','DF0123456789')) Concat Insert(Replace(Replace(Hex(Substr(ENTRY_DATA,3,5)),'F',''),'D',''),10,0,'.'),9,0) As ACCT,
to extract packed(3,0) and packed(9,0) fields at the beginning of the file entry data being retrieved.
Jim
________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxx> on behalf of Matt Olson <Matt.Olson@xxxxxxxx>
Sent: Tuesday, September 11, 2018 11:55 AM
To: Midrange Systems Technical Discussion
Subject: Viewing packed decimal field as a string
Folks,
When you are viewing journal data in the ENTRY_DATA field and it contains packed decimal information how do you get the decimal data to be represented as a string so you can read it rather then hexadecimal/binary gibberish (shows up as boxes in my attempt to convert it using this: cast( cast(entry_data as varchar(32000) for bit data) as varchar(32000) ccsid 37))?
Example here (plug in your own file name that has a packed field and own journal name and receiver as needed):
SELECT ENTRY_TIMESTAMP, "CURRENT_USER",
cast( cast(entry_data as varchar(32000) for bit data) as varchar(32000) ccsid 37)
,
X.* FROM TABLE ( QSYS2.Display_Journal(
'PUTlibrarynameHERE', --Journal Library
'PUTjournalnameHERE', -- Journal Name
CAST(NULL as VARCHAR(10)),
'*CURCHAIN', -- Receiver library and name
CAST(NULL AS TIMESTAMP), -- Starting timestamp Example: CURRENT TIMESTAMP - 7 DAYS,
CAST(null as DECIMAL(21,0)), -- Starting sequence number
'*ALL', -- Journal codes (R, F)
'*ALL', -- Journal entries (PT, DL, UP, SV, etc)
'PUTlibrarynameHERE','PUTfilenameHERE','*FILE','*ALL', -- Object library, Object name, Object type, Object member
'', -- User
'', -- Job
'', -- Program
CAST(NULL AS VARCHAR(10)),
'*CURCHAIN',
CAST(NULL AS TIMESTAMP),
CAST(NULL AS DECIMAL(21,0))
) ) AS x ORDER BY entry_timestamp DESC
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.