Finding newly created objects

140 pts.
Tags:
AS/400 Query
DSPOBJD
Physical File
I am trying to define a query to find any newly created objects ona daily basis. I have scheduled a job to run daily that creates a file to display all DSPOBJD which outputs into a physical file. I now want to query this file to find anything created on the previous day (the job runs overnight). Any suggestions please? Gordon Ross
ASKED: November 4, 2008  4:36 PM
UPDATED: November 7, 2008  9:00 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

You can define a field for yesterday’s date as a result field, then reformat the creation date :-

<pre>
Field Expression
YESTERDAY CHAR(CURRENT(DATE) – 1 DAYS)

CREATED SUBSTR(ODCDAT, 5, 2) || ‘/’ ||
SUBSTR(ODCDAT, 1, 2) || ‘/’ ||
SUBSTR(ODCDAT, 3, 2)
</pre>

(Afraid this doesn’t show very well in the editor here, but the CHARxxx and the SUBSTRxxx all belong in the Expression columns)

I’ve reformatted the creation date (ODCDAT) to be in YYMMDD format using SUBSTR (substring) and || (concatenate) – you may have to change this slightly depending on the *DATFMT of your system.

Then just select the records where CREATED = YESTERDAY.

Regards,

Martin Gilbert.

Not sure if this applies since I don’t have an AS/400 to test but I believe when you run DSPOBJD and save to a file, it will create a file with one field per record. If so, you will need to create another physical file via PDM or SQL in order to CPYF from your initial file into the one with fields – including a field for DATE of course. Then you use Query400 and do what Martin suggests to reformat the date field for querying. The output of this query can be copied to text in the IFS and emailed to you daily as an attachment which I think is the easiest way to keep track of this kind of thing.

Let me know if this helps at all.

Best regards,
Nicholas Hart
IT Consultant

DSPOBJD output is not one field per record – it is externally (DDS) described with separate fields.

Regards,

Martin Gilbert.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Gross
    Many thanks for your suggestions, I'll give them a try. One of my colleagues has suggested SQL as an alternative as well. Gordon Ross
    140 pointsBadges:
    report
  • mcl
    Security Auditing.. You need to turn it on. GO SECTOOLS. Use option #11 to see what you have now. Use option #10 to change that. You want to have audit control to have at least *AUDLVL and you want the audit values to have *CREATE. These two values can also be set up through the system values QAUDCTL and QAUDLVL You can use option 22 to generate a simple report to a spooled file. You want journal entry type "CO" (Create Object). You can also set this up as a batch job - use option 20 for the batch reports and then sub option 41 to set it up as a scheduled job. I believe the default is to check only the currently attached journal receiver. Unfortunately, this only creates a spooled file - you'll have to copy that to a PF if you want to run any queries and such. But, it will tell you about any object created (except in QTEMP). Keep an eye on your audit journals if you start turning on auditing - they can grow pretty fast on a busy system. Oh yeah - you'll need to have *AUDIT special authority to at least set it up - maybe also need it to access the audit journal.
    2,740 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following