115 pts.
 Cleanup, STRCLNUP
How would you schedule Cleanup to automatically run every Sunday at 3am? Not every day at 3am.

Software/Hardware used:
iSeries v5.4
ASKED: September 30, 2009  1:28 PM
UPDATED: June 6, 2010  8:29 AM

Answer Wiki:
Create CL programs to do it. 1) Saturday afternoon, schedule to run a CL program containing a) ENDCLNUP b) CHGCLNUP STRTIME(03:00:00) c) STRCLNUP OPTION(*SCHED) 2) Sunday afternoon, schedule to run a CL program containing a) ENDCLNUP b) CHGCLNUP STRTIME(*NONE) c) STRCLNUP OPTION(*SCHED) Since CHGCLNUP controls when cleanup is to run and your only options are TIME, *SAME, and *SCDPWROFF, I think this would be a good way to automatically schedule cleanup to run on Sundays at 3 am. Thanks all…..
Last Wiki Answer Submitted:  October 5, 2009  9:30 pm  by  CharlieBrowne   32,785 pts.
All Answer Wiki Contributors:  CharlieBrowne   32,785 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I tried that.. It did not work
The below Job did not do anything at all.

Display Job Schedule Entry Details

Job: STRCLNUP Entry number: 000753 Status: SAV

Last attempted submission:
Status . . . . . . . . . . . : Job successfully submitted.

Date . . . . . . . . . . . . : 09/13/09
Time . . . . . . . . . . . . : 03:00:00
Last successful submission:
Job . . . . . . . . . . . . : STRCLNUP
User . . . . . . . . . . . : WISEMAST
Number . . . . . . . . . . : 896331
Date . . . . . . . . . . . . : 09/13/09
Time . . . . . . . . . . . . : 03:00:00
Schedule day . . . . . . . . . : *SUN
Schedule time . . . . . . . . : 03:00:00
Frequency . . . . . . . . . . : *ONCE
Recovery action . . . . . . . : *NOSBM
Next submit date . . . . . . . :
Save . . . . . . . . . . . . . : *YES
Command . . . . . . . . . . . : STRCLNUP OPTION(*IMMED)
Job queue . . . . . . . . . . : *JOBD
Library . . . . . . . . . . :
Job queue status . . . . . . . :
Job description . . . . . . . : *USRPRF
Library . . . . . . . . . . :
Scheduled by . . . . . . . . . : JDW
User profile . . . . . . . . . : WISEMAST
Message queue . . . . . . . . : QSYSOPR
Library . . . . . . . . . . : QSYS
Text . . . . . . . . . . . . . : This is to run Cleanup

Press Enter to continue.

F3=Exit F6=Display last successful submission F12=Cancel

 115 pts.

 

What did your joblog tell you?
Have you ever run this before?
If so, what did it do>

 32,785 pts.

 

The Display Job Schedule Entry Details shows the job was submitted at 3:00.
Check the joblog for that job for any possible errors in the jobscde setup (user, jobd, etc.)
Also view the history log with DSPLOG for 9/13 at 3:00AM to view if it ran any cleanup functions at all.

 5,665 pts.

 

Here is what I found in the job log

Job 896331/WISEMAST/STRCLNUP submitted for job schedule entry STRCLNUP number 000753.
Job 896331/WISEMAST/STRCLNUP started on 09/13/09 at 03:00:00 in subsystem QBATCH in QSYS. Job entered system on 09/13/09 at 03:00:00
Job 896331/WISEMAST/STRCLNUP ended on 09/13/09 at 03:00:00; 1 seconds used; end code 0.
Job 896331/WISEMAST/STRCLNUP completed normally on 09/13/09 at 03:00:00.

This only ran for 1 second and I do not see anything pertaining to cleanup.
I do not see anything like:
Cleanup of job logs and other system output started
User cleanup program started
Cleanup of operator and work station messages started
Cleanup of system journals and system logs started

 115 pts.

 

It appears the scheduler submitted the job but the cleanup did not run.
Try this:
Put jobq QCTL on hold as this is the default for the cleanup job to be submitted. CHGCLNUP to verify.
WRKJOBSCDE and take option 10 to submit the STRCLNUP job immediately.
Verify the job is in the QCTL jobq. If it is not there is your problem.
If it is, CHGJOB for the cleanup to produce a joblog regardless of its end code (4 00 *SECLVL)
Release QTCL jobq and monitor its progress.

 5,665 pts.

 

I can only run this on a Sunday, because of time restraints…

I changed Job Queue from *JOBD to QCTL and User Profile from WISEMAST to QPGMR
I think Cleanup will run now…. What do you think?

Display Job Schedule Entry Details

Job: STRCLNUP Entry number: 000753 Status: SCD

Last attempted submission:
Status . . . . . . . . . . . : Job successfully submitted.

Date . . . . . . . . . . . . : 09/13/09
Time . . . . . . . . . . . . : 03:00:00
Last successful submission:
Job . . . . . . . . . . . . : STRCLNUP
User . . . . . . . . . . . : WISEMAST
Number . . . . . . . . . . : 896331
Date . . . . . . . . . . . . : 09/13/09
Time . . . . . . . . . . . . : 03:00:00
Schedule day . . . . . . . . . : *SUN
Schedule time . . . . . . . . : 03:00:00
Frequency . . . . . . . . . . : *ONCE
Recovery action . . . . . . . : *NOSBM
Next submit date . . . . . . . : 10/04/09
Save . . . . . . . . . . . . . : *YES
Command . . . . . . . . . . . : STRCLNUP OPTION(*IMMED)
Job queue . . . . . . . . . . : QCTL
Library . . . . . . . . . . : QSYS
Job queue status . . . . . . . : RLS/SBS
Job description . . . . . . . : *USRPRF
Library . . . . . . . . . . :
Scheduled by . . . . . . . . . : JWILSON
User profile . . . . . . . . . : QPGMR
Message queue . . . . . . . . : QSYSOPR
Library . . . . . . . . . . : QSYS
Text . . . . . . . . . . . . . : This is to run Cleanup

 115 pts.

 

That may do it if the user profile did not have authority to run cleanup or authority to something in the jobd. Good Luck!

 5,665 pts.

 

You can place the jobq QCTL on hold just to see if it does submit then cancel the job option 4.
You could also change all the parms in CHGCLNUP to *KEEP (take a print screen first) and let the job run to test.

 5,665 pts.

 

OK… This is what I have found out.

I tried changing everything to *KEEP in CHGCLNUP then kicking off the job.
I got the same results, the scheduler submitted the job but Cleanup did not run.

I then started looking into the CHGCLNUP option ” Time cleanup starts each day”

Change Cleanup (CHGCLNUP)
Type choices, press Enter.
Allow cleanup . . . . . . . . . *YES *SAME, *YES, *NO
Time cleanup starts each day . . *NONE Time, *SAME, *SCDPWROFF…
Number of days to keep:
User messages . . . . . . . . *KEEP 1-366, *KEEP, *SAME
System and workstation msgs . *KEEP 1-366, *KEEP, *SAME
Critical system messages . . . *KEEP 1-366, *KEEP, *SAME
Job logs and system output . . *KEEP 1-366, *KEEP, *SAME
System journals and logs . . . *KEEP 1-366, *KEEP, *SAME
Job queue . . . . . . . . . . . QCTL Name, *SAME
Library . . . . . . . . . . . *LIBL Name, *LIBL, *CURLIB

Additional Parameters

Office calendar items . . . . *KEEP 1-366, *KEEP, *SAME
Run priority . . . . . . . . . . 55 1-99, *KEEP, *SAME

Bottom
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display
F24=More keys

Looking at the help for this option, it says.
*NONE
No cleanup start time is scheduled. The cleanup batch
jobs are not submitted.

Well know… The cleanup jobs are not submitted?

If I put 03:00:00 in CHGCLNUP then it will be running every day…
How do I get this to run Only on Sundays at 3am?

 115 pts.

 

I’m curious, why would it hurt to run it every day? Teach me something new.

 925 pts.

 

We are trying to run it when the system resources are more available.

Can this be done?

 115 pts.

 

Yes, you can write a litlle CL pgm to perform the following:

CHGCLNUP and enter a time well past the 03:00AM start time you want
STRCLNUP OPTION(*IMMED) to submit immediately
DLYJOB and enter the time it takes to complete the cleanup plus 5 mintues (The lazy way out or add more code to monitor the susbsystem for end of job)
ENDCLNUP
CHGCLNUP back to the time of *NONE

Of course add the usual error msg handling routines, etc.

 5,665 pts.

 

Whatis23,

I woke up this morning dreaming something along those same lines.
As a co-worker just told me… Man I need to get a life…lol

I will let you know what I come up with, if I go any further trying to get cleanup to automatically run once a week.

 115 pts.

 

Ahah dreaming of work…never a good thing. Dreaming of actually working? Priceless!

 5,665 pts.

 

The problem is that you said Frequency *ONCE instead of *WEEKLY so it only ran once on 9/13. Change the frequency to WEEKLY and becasue you have *SUN only for the schedule day, it will only run on Sunday at the time you listed.

Lovemyi

 2,310 pts.

 

Whatis32,

I think you pretty much nailed it. Create CL programs to do it.

1) Saturday afternoon, schedule to run a CL program containing
a) ENDCLNUP
b) CHGCLNUP STRTIME(03:00:00)
c) STRCLNUP OPTION(*SCHED)

2) Sunday afternoon, schedule to run a CL program containing
a) ENDCLNUP
b) CHGCLNUP STRTIME(*NONE)
c) STRCLNUP OPTION(*SCHED)

Since CHGCLNUP controls when cleanup is to run and your only options are TIME, *SAME, and *SCDPWROFF, I think this would be a good way to automatically schedule cleanup to run on Sundays at 3 am.

Thanks all…..

 115 pts.

 

Great, glad to hear it’s working.

 5,665 pts.

 

It seems that if resources are so tight that ‘Cleanup’ can’t run but once a week, you should run cleanup more often to free up resources. That is, the situation seems self-contradictory. Has there been an actual problem that this is getting around?

Tom

 107,765 pts.

 
Job: STRCLNUP Entry number: 000753 Status: SCD

Last attempted submission:
Status . . . . . . . . . . . : Job successfully submitted.

Date . . . . . . . . . . . . : 09/13/09
Time . . . . . . . . . . . . : 03:00:00

BTW, you don’t want your CL program to run from the scheduler at 3:00 AM if it’s going set the cleanup start time to 3:00 AM. By the instant the scheduler starts your CL program, it will already be too late for cleanup to start.

Have your job scheduled to run at 2:55 AM.

Tom

 107,765 pts.