100 pts.
 AS/400 Query
How can I Define a query to run only Monday thru Friday not using WRKJOBSCDE (we have a customised WRKQRY) scheduler and doesn't have an option to input the schedule day e.g. *Mon *Tues =, etc....I'll like to see if any one knows how to Define the query using the DEFINE RESULTS FIELDS e.g. YESTERDAY TODAY - 4 day but, for a week using only MON,TUE,WED,FRI only. thanks

Software/Hardware used:
ASKED: January 13, 2009  10:57 PM
UPDATED: January 16, 2009  4:00 PM

Answer Wiki:
Create a CL to run the query, make a job schedule entry to run the CL on Monday - Friday.
Last Wiki Answer Submitted:  January 16, 2009  4:00 pm  by  taekwondo   90 pts.
All Answer Wiki Contributors:  taekwondo   90 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

Not an answer — but ..
I don’t think so.
You could use something like you’ve described to eliminate the selection of all rows on Saturday and Sunday but the query would still run and create a spool file with headings (or an empty physical file if you’re selected file output)

If you’re scheduler could call a CL program, then the CL could evaluate the day and only run the query on selected days.

Phil

 44,200 pts.

 

I don’t understand what having a customized WRKQRY command has to do with WRKJOBSCDE. What happens when you use the WRKJOBSCDE command? Does the job run only once or does it run every day? If it runs every day, then try the following:

Create a CL that checks the day of the week. If it is between Monday and Friday, run the query. Let it run every day.

PGM

DCL VAR(&WEEKDAYNAM) TYPE(*CHAR) LEN(4) VALUE(‘ ‘)

RTVSYSVAL SYSVAL(QDAYOFWEEK) RTNVAR(&WEEKDAYNAM)

IF COND(&WEEKDAYNAM = ‘*MON’ *OR &WEEKDAYNAM = +
‘*TUE’ *OR &WEEKDAYNAM = ‘*WED’ *OR +
&WEEKDAYNAM = ‘*THR’ *OR &WEEKDAYNAM = +
‘*FRI’) THEN(RUNQRY QRY(MYQUERY))

ENDPGM

Other wise you can use the SBMJOB command to schedule the job to run on a specific date and time for each date you want the job to run.

 5,830 pts.