as500 / as500.github.io

AS500 site pages
2 stars 0 forks source link

Remove restriction for FILE to exist with DSPJRN #26

Open kskuhlman opened 4 years ago

kskuhlman commented 4 years ago

DSPJRN with the FILE parameter requires the table to exist, currently be attached to the journal, etc. This can make it difficult to dump journal transactions when the table has changed, if the analysis is being done on another server, etc.

Workaround: Two ways: (a) Leave the FILE parameter blank & dump all transactions, then go back and filter out the ones you don't need. (b) Perform journal analysis on the same system as where the transactions happen. (c) Use the Display_Journal UDTF

Proposal: If FILE is specified on DSPJRN, do not check for it's existence or any properties of it. This is just like the behavior when FILE is not provided, or when using the UDTF.

kskuhlman commented 4 years ago

UDTF example:

SELECT * 
FROM TABLE (Display_Journal('TSTLIB', 'QSQJRN')) AS x
WHERE OBJECT_TYPE IN('*FILE','*QDDS') AND SUBSTR(object,1,10) = 'TBL1' 
 AND SUBSTR(object,11,10) = 'TSTLIB' 
ORDER BY entry_timestamp
kskuhlman commented 4 years ago

We can just wrap the command & adding a CHKOBJ to it. If target doesn't exist then add a bogus 2nd file & do the DSPJRN as normal.