765 pts.
 Call a program and send parameters in WRKJOBSCDE
I want to schedule a job to run. It needs to call the program and send 20 parameters. Is this a good way to do through Job Schedular on the AS400?

Software/Hardware used:
ASKED: January 14, 2011  3:52 PM
UPDATED: January 18, 2011  3:47 PM

Answer Wiki:
With this more information, then yes, it is a good idea to but it on the scheduler. The more manual steps we can eliminate the better off we all are.
Last Wiki Answer Submitted:  January 14, 2011  7:21 pm  by  CharlieBrowne   32,915 pts.
All Answer Wiki Contributors:  CharlieBrowne   32,915 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


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


 

Can you be more specific?
Are you saying PROGAM A is going to be on the scheduler and will be submitting PROGRAM B, and PROGRAM B will have 20 parameters?
Or Are you say PROGRAM A will be on the scheduler and when it gets submitted, it needs to have 20 parameters?
Are the values always the same for the parms or are they always determined on the fly?

 32,915 pts.

 

Call PGM A with 20 Parameters that are the same except for endDate
that would be the system date.

So instead of always going into the menu, selecting the program, and keying the parameters as a user does every hour, I want to just put that on the schedular to call PGM A every hour and pass the parameters.

Then no need for the users to do this every hour…

 765 pts.

 

so it would be something like:

CALL PGM(MyLib/MyPgm) PARM(‘parm1′ ‘parm2′………………………………………. ‘parm20′)

so my only other question then is the parms I pass have to have the field names?

there are some fields I do not need to enter that is why I am thinking how will the parm know which one it is for….

 765 pts.

 

If PROGAM A which is receiving these 20 parms is coded so some are optional, then you do not need to pass them all; only the ones you use.
An easy way to figure out what you job schedule entry should look like to to see what is happening today.
If the menu option that people are using submits a job,
put that JOBQ on hold
submit the job
do a WRKJOBQ of the Q you put on hold
take option 5 on the job just submitted
take option 10 to display the joblog
* Now you will see exactly what is going to run. You can do a cut & paste of that call and put it in the job scheduler entry.
+++++
Remember to RLSJOBQ when your done and cancel the job from the Q if ou do not need it.

 32,915 pts.

 

You can do a cut & paste of that call and put it in the job scheduler entry.

Note that if “endDate that would be the system date” is needed, the scheduler entry may need to be for a new program that calls PGMA but with system date substituted for the parameter.

Also:

…as a user does every hour…

Scheduling “every hour” may require multiple schedule entries in the standard scheduler.

Tom

 108,280 pts.

 

Check ADDJOBSCDE Add job schedule entry. You can submit a job with a schedule date and time on the SBMJOB Command instead of adding entries to the job scheduler.
If the job can determine if is from the menu or scheduled then the system date can be provided for the scheduled job when it executes. The scheduled job can possibly submit the next scheduled run.
You might consider a “never ending job” subsystem that Wakes up and processes this job.

You need to submit each Parm the program expects, one by one, matching type and length. You can provide “default” values for the Parms like blanks, zeros, or 99999 but your program must tolerate what you send and provide the correct results.
Consider writing a CLP without Parms that provides the “standard” Parms needed ie:
Newpgm: PGM
CALL HOURLY PARM(‘AAA’ ‘BBBBB’ ‘CCCCCCC’ …… ‘TTTTTTT’)
ENDPGM

 695 pts.

 

The CLP sounds like the way to go.

Thanks all

 765 pts.