Lesson 3 Creating and Streaming a Job File [ Using the 900 Series HP 3000: Advanced Skills Module 3: Batch Processing ] MPE/iX 5.0 Documentation
Using the 900 Series HP 3000: Advanced Skills Module 3: Batch Processing
Lesson 3 Creating and Streaming a Job File
Introduction
Lesson 3 presents the following MPE/iX job-related tasks:
* create a job file according to specifications
* stream the job so that it runs at a scheduled time, day, or date
* suspend, resume, and alter a job
* Abort a job.
Up to this point you have worked with existing job files, examining them
and modifying them. You will now create your own job files to perform
specific tasks. Later in this lesson, you will actually stream the job
files that you created and look at the results.
Teaching exercise 3-3:creating a job file.
You've had the chance to examine and modify a job file. Now, you will
step through an exercise that shows you how to create job files.
As you follow along, make sure that you are logged on as USERx.ACCTx in
the CLASS group, where X = your student number.
You will be creating two job files
according to specifications. These jobs will be streamed at a later
time.
1. The job files will reside in the CLASS group and ACCTx account.
You must replace the X to specify your account, user, and group
passwords in the job files.
Each job has the name specified in capital letters. The disk file
name and the name of the job (specified in the JOB command) are
the same.
Example:
File name = JOB1
Job line in file = !JOB JOB1
2. Both jobs have the same general function:
* Run the editor to modify a file called MYFILE, and keep it
under a new name, MYFILEM.
* List the contents of the modified file offline (for
deferred printing).
* Exit the editor and print a message telling the user the
that job is done.
Figure 3-2. Modifying a File
3. Both jobs assume that the current jobfence is 7 and the outfence
is 7. Any job with an output priority of 3 to 5, inclusive, will
print after hours, when most of the employees have gone home.
4. Create JOB1 according to the following "skeletal" job file
so that it performs the specified functions.
_________________________________________________________________
NOTE Each letter refers to a function listed below the "skeletal"
job file. The first three lines are the editor comments.
They do not belong in any job file you create.
_________________________________________________________________
<<**************************>>
<<*FILE JOB1 >>
<<**************************>>
a,b !
!COMMENT JOB1 MODIFIES AND PRINTS MYFILE
!CONTINUE
c !EDITOR
d T MYFILE.CLASS.ACCTx
e C "a" to "*A*" IN 1/4000
C "b" to "*B*" IN 1/4000
C "c" to "*C*" IN 1/4000
C "d" to "*D*" IN 1/4000
C "e" to "*E*" IN 1/4000
C "f" to "*F*" IN 1/4000
C "g" to "*G*" IN 1/4000
C "h" to "*H*" IN 1/4000
f KEEP MYFILEM.CLASS.ACCTx;YES
g L ALL,OFFLINE
h EXIT
i !
j !
5. In your JOB1 file, complete lines a, b, d, e, f, g, h, i, and j of
JOB1 to do the following:
a. Specify an input priority high enough to guarantee that the
job runs immediately. This means that the input priority
must be above the current JOBFENCE (7).
b. Suppress the printing of the job listing on the printer
(LP). This means that the OUTCLASS priority (1) is less
than the current OUTFENCE (7). Ensure that the job will
restart in the event of a system halt.
c. Start the editor.
d. Text in a file called MYFILE.
e. Use the CHANGE command to change the letters: a through h
to *A* through *H* in lines 1 to 4000 of the file.
f. Keep the modified file under the name MYFILEM.
g. List the modified file offline.
h. Exit the editor.
i. Tell the user that the job is done.
j. End the job.
6. You should now have a job file that looks like the JOB1 file in
the following illustration.
Figure 3-3. JOB1 File
7. Using your JOB2 file, create JOB2 according to the "skeletal" job
file below so that it performs the specified functions.
_________________________________________________________________
NOTE Each letter refers to a function listed below the "skeletal"
job file. The first three lines beginning with << are the
editor comments. They do not belong in any job file you
create.
_________________________________________________________________
<<**************************>>
<<*FILE JOB2 >>
<<**************************>>
a,b !
!COMMENT JOB2 MODIFIES AND PRINTS MYFILEM
!CONTINUE
c !
d T MYFILEM.CLASS.ACCTx
e C "*A*" TO "a" in 1/4000
C "*B*" TO "b" in 1/4000
C "*C*" TO "c" in 1/4000
C "*D*" TO "d" in 1/4000
C "*E*" TO "e" in 1/4000
C "*F*" TO "f" in 1/4000
C "*G*" TO "g" in 1/4000
C "*H*" TO "h" in 1/4000
f K MYFILE.CLASS.ACCTx;YES
g L ALL,OFFLINE
h EXIT
i !
j !
8. Complete lines a, b, c, d, e, g, h, i, and j of JOB2 to do the
following:
a. Specify an input priority that guarantees that the job runs
now.
This means that the input priority (9) is above the current
JOBFENCE (7).
b. Suppress the printing of the error/job listing on the
printer
(LP). This means that the OUTCLASS priority (5) is less
than the current OUTFENCE (7). Ensure that the job will
restart in the event of a system halt.
c. Run the editor.
d. Text in a file called MYFILEM.
e. Use the CHANGE command to change the letters: *A* through
*H* to a through h in lines 1 to 4000 of the file.
f. Keep the modified file under the name MYFILE.
g. List the modified file offline.
h. Exit the editor.
i. Tell the user that the job is done.
j. End the job.
9. You should now have a job file that looks like this:
Figure 3-4. JOB2 File
********** End of Exercise 3-3 **********
Streaming a job
Now that you have had the chance to create job files on your own, let's
learn what you can do to get those jobs to execute. The process of doing
this is called streaming a job. This is accomplished with the STREAM
command. The STREAM command has options that allow you to actually
specify the time and date that you wish a job to run.
NOTE Before you stream a job, check the job file to make sure that the
user and account passwords are correct. You can use the
LISTUSER...;PASS or LISTACCT...;PASS commands to do so. (You must
have SM capability.)
Type this simple version of the STREAM command using the JOB1 file:
STREAM JOB1
You will notice that the job number (#Jxxx) appears on the screen. Note
this number.
JOB1 immediately enters the job queue and executes when system resources
are available. It will execute exactly as specified in the job file, as
if you were entering the commands contained within it at the terminal.
--------------------------------------------------------------------------------------------
| |
| Q3-24 Do a SHOWJOB to verify that the job is processing. What is the job's state? |
| |
| |
--------------------------------------------------------------------------------------------
Now suppose that you wish the job to execute late at night at a
particular time when system resources are more available.
Please enter the following STREAM
command to specify an exact time for your job to run after hours (specify
a time at least one hour later than the current time):
STREAM JOB1; AT=03:00
In the example above, the job will run at 3:00 A.M. It will print several
copies of a previous lesson later in the early morning.
--------------------------------------------------------------------------------------------
| |
| Q3-25 Do a SHOWJOB to check the job state. What is it? |
| |
--------------------------------------------------------------------------------------------
There are several other options that you can specify with the STREAM
command:
STREAM jobname;AT= Lets you specify a time to run the job.
;DAY= Lets you specify a day to run the job.
;DATE= Lets you specify a date to run the job.
;IN= Lets you specify a relative time, day, or date to
run the job (for example, two hours from now, or two
days from now).
See the following figure for examples of the various options. These
options are explained in depth in the MPE/iX Commands Reference Manual
Volumes 1 and 2 (32650-90003 and 32650-90364) and in the Help facility,
under the STREAM command.
Figure 3-5. STREAM Command Options
If you specify a job start at 3:00 PM (15:00) and it is now 3:01 PM, your
job will start at 3:00 PM the next day.
For a greater understanding of these
options, study the following examples:
1. Assume it is now 8:00 P.M. Suppose that you want JOBFILE to run at
midnight, 10 days from now. What STREAM command do you enter?
STREAM JOBFILE IN=+10,+4
2. Suppose that you want a JOBFILE to run today, three hours after
you submit it. What STREAM command do you enter?
STREAM JOBFILE;IN=,+3
Match the descriptions in the following table with the correct STREAM
command. (Assume it is Sunday, August 1, 1989, at 6:00 A.M., and jobs
are currently executing on the system.)
Q3-26
-------------------------------------------------------------------------------------------
| |
| Command Description |
| |
-------------------------------------------------------------------------------------------
| |
| 1. STREAM JOBFILE a. Job will run on Monday, at 10:00 |
| P.M. |
| |
| 2. STREAM JOBFILE b. Job will run on August 9, at 8:00 |
| ;AT=8:00 P.M. |
| |
| 3. STREAM JOBFILE c. Job will run today, at 8:00 A.M. |
| ;AT=20:00 |
| |
| 4. STREAM JOBFILE d. Job will run immediately. |
| ;IN=,+8 |
| |
| 5. STREAM JOBFILE e. Job will run on August 9, at the |
| ;IN=+1,+8 same time you execute the STREAM |
| command today. |
| |
| 6. STREAM JOBFILE f. Job will run today, 8 hours from |
| ;DATE=08/09/89 now. |
| ;AT=20:00 |
| |
| 7. STREAM JOBFILE g. Job will run today, at 8:00 P.M. |
| ;DAY=MONDAY |
| ;AT=22:00 |
| |
| 8. STREAM JOBFILE h. Job will run tomorrow, 8 hours |
| ;DATE=08/09/89 from now. |
| |
| |
-------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
| |
| Q3-27 If you specify a day or date, but no time in the STREAM command, at what |
| time will the job execute? |
| |
--------------------------------------------------------------------------------------------
Aborting a job
After you enter the STREAM command, you may decide that you do not wish
the job to execute. This may happen if you discover a text error in a
file that you were planning to format, or in a program you were planning
to run. In this case, you should abort the job. The following command
does this:
ABORTJOB #J[jobnumber]
NOTE You can abort a job only if it is your job, and if the system
operator has set JOBSECURITY to LOW (or the operator issues the
ALLOW command so that you can issue ABORTJOB.) Be aware that if you
have several logons to the same account, a job submitted by one
logon cannot be aborted when using another logon.
Determine whether JOB1 has finished executing.
If it has not, use ABORTJOB #Jjobnumber.
The job number should be the one you noted earlier. If the job has
already completed, enter the following command.
STREAM JOB1
Note the resulting job number that displays after you enter the command.
Verify that the job is processing by entering the following command (note
the job number):
SHOWJOB
Now abort the job using the job number and do a SHOWJOB again to verify
that the job no longer exists.
NOTE Sometimes ABORTJOB takes a few seconds to abort a job.
Consequently, you may have time to execute a SHOWJOB and see your
job still listed. Do not be surprised if that happens. ABORTJOB
will abort your job.
The processed part of the job still prints out (whatever part of it was
processed) even if you use ABORTJOB. In the next lesson you will learn
how to prevent this from happening.
--------------------------------------------------------------------------------------------
| |
| Q3-28 When you do a SHOWJOB #Jxxx, what message do you see after the job has been |
| aborted? |
| |
| Q3-29 Imagine that it is now 9:00 P.M. At 8:00 P.M. you entered the following |
| STREAM command: |
| |
| STREAM JOB1;AT=00:00 |
| |
| You have changed your mind and wish to abort the job. At what time is the |
| job supposed to run? How would you abort it (since the job is not yet |
| running)? |
| |
--------------------------------------------------------------------------------------------
Suspending a job
Occasionally, after streaming a job, you may decide that the system
resources are such that it will take too long to run the job (perhaps
many other jobs are also running simultaneously and the CPU has to swap
between them all). Rather than aborting your job and then restreaming it
later, you can suspend it with the BREAKJOB command and resume it with
the RESUMEJOB command:
BREAKJOB #Jjobnumber
RESUMEJOB #Jjobnumber
Take Care A job may involve accessing databases or files that become
locked during access. If you do a BREAKJOB while executing
such a job, you run the risk of preventing others from
accessing those databases or files. This is due to the fact
that while your job is suspended, the locks remain on the
databases or files that were previously being accessed. This
can have detrimental effects on other users. Please be aware
of the function of a job before you suspend or abort it.
By doing this, you do not lose any of the job processing you have
accomplished. Plus, you do not lose your place in the job processing
queue. All that happens is that system resources are freed to process
other jobs ahead of you (so that less "swapping" has to occur). Once you
see that those jobs are done, you can resume your job with the RESUMEJOB
command. Jobs that are suspended are listed as being in the SUSP state
when you do a SHOWJOB.
Figure 3-6. Resuming or Aborting Jobs
NOTE You can suspend a job only if it is your job and the system
operator has set JOBSECURITY to LOW (or the operator issues the
ALLOW command so that you can issue BREAKJOB).
--------------------------------------------------------------------------------------------
| |
| Q3-30 To test the BREAKJOB command, please STREAM JOB1. Allow the job to process |
| by waiting about 10-15 seconds. Then enter the BREAKJOB command. Do a |
| SHOWJOB to verify that the job has been suspended. What is the status of |
| that job? |
| |
| To use BREAKJOB successfully, you may have to wait more or less than the |
| 10-15 seconds, depending on the system load. |
| |
| Q3-31 Now resume the job with the RESUMEJOB command and check its status with |
| SHOWJOB. What is its status? |
| |
--------------------------------------------------------------------------------------------
Altering a job
If a job is in INTRO, WAIT or SCHED state (has not run yet), you can
alter its input priority or output device with the ALTJOB command:
ALTJOB #Jjobnumber [;INPRI=input_priority][;OUTDEV=device_name]
Make sure that JOB1 has completed. If it is still running, abort it.
Now, test the ALTJOB command by restreaming JOB1:
STREAM JOB1
Note the job number.
Try to change the input priority to 13. What happens? You'll find that
you cannot ALTJOB because the job is currently in the EXEC state. You
must be in the INTRO, WAIT, or SCHED state.
To terminate JOB1, abort
it:
ABORTJOB #Jxxx
Now, return to the editor and modify the JOB1 file so that the input
priority is reduced to 1. Keep the file and restream JOB1:
STREAM JOB1
NOTE You can alter a job only if it is your job and the system operator
has set JOBSECURITY to LOW (or the operator issues the ALLOW
command so that you can ALTJOB).
--------------------------------------------------------------------------------------------
| |
| Q3-32 Do a SHOWJOB to check JOB1's current state. What is it? |
| |
| Q3-33 Again, alter the input priority, this time to 9. Check on JOB1's state |
| again. What is it now? |
| |
--------------------------------------------------------------------------------------------
Finally, abort the job so that it neither continues processing, nor
prints (remember, it only has an output priority of 5, which defers
printing).
ABORTJOB #Jxxx
Using ALTJOB is a good way to ensure that a job runs, even if initially
you set the input priority to a very low number. Also, suspending the
job prevents it from continuing and from printing. In the next lesson,
you'll learn how to purge the spool files that remain from suspended jobs
that you no longer wish to resume.
NOTE Make sure to use the editor once more to modify JOB1. Change the
input priority in the INPRI line to a value that is high enough to
guarantee that the job runs.
Lesson summary
1. The STREAM command uses the following options to schedule jobs:
The ;AT option specifies an absolute time (hour:minute:second).
The ;DATE option specifies an absolute date (month/day/year).
The ;DAY option specifies a day of the week.
The ;IN option specifies a relative day or time (day,hour,minute).
2. The following commands control job execution:
* The BREAKJOB command suspends a job.
* The RESUMEJOB command resumes a suspended job.
* The ALTJOB command alters the input priority or the device
or device class of a scheduled or waiting job (does not
work on a suspended job).
* The ABORTJOB command aborts a job.
MPE/iX 5.0 Documentation