• Keine Ergebnisse gefunden

The EXEC Card

Im Dokument HAL/S-FC USER’S MANUAL (Seite 24-27)

2.4 Introduction to JCL

2.4.2 The EXEC Card

Each job you submit to the operating system must be identified with a name on a JOB card prior to anything else. This specifies that requests for action by the system are now going to be made which are logically separate from those preceding the JOB card. But the JOB card does not inform the computer what it specifically is being asked to do. This is the function of the EXEC card, which indicates which program is actually to be run.

Every job consists of one or more job steps; each of these steps requires an EXEC card to define it. A straight compilation of a HAL/S program consists of only one step, the running of a program called MONITOR which invokes the compiler and interfaces between it and the operating system. If, however, you wished to compile and link edit a program, two EXEC cards would be required - a call to the compiler (MONITOR) and a call to run the link editor (LINK101).

To do a compilation, for example, the EXEC card might be coded as follows:

//HAL EXEC PGM=MONITOR,REGION=350K,TIME=1, // PARM=‘LIST,SYMBOLS=500’

As with the JOB card, the keyword HAL immediately following the (compulsory) double slash is a name: this jobstep will be called HAL (although the job itself, as defined on the JOB card, may have a different name). The name is not required unless reference to this

step will be made in a later step - which is often the case in jobs consisting of more than one related step (e.g., compilation, link-editing, and execution). Each name given to a step in a job should be unique for that job.

After the name a blank is coded, followed by the operator EXEC to identify this as an EXEC card, and then another blank. Again, this structure is followed in all JCL cards.

The first parameter on an EXEC card must specify the task that is to be performed. This task will either be the running of a program or the calling of a catalogued procedure. A program consists simply of a block of executable code, ready for execution by the system; a catalogued procedure, on the other hand, is a block of JCL, which itself will include an EXEC card. The user’s JCL, that is, can call up a catalogued block of JCL, which in turn calls some program to be run. It is this which allows HAL/S compilations, for example, to be run with a minimum of user-supplied JCL. Instead of invoking the actual compiler (MONITOR), the JCL can call a catalogued procedure (HALFC, for instance) where all the complicated JCL for a compilation has been stored, which in turn calls (on its EXEC card) MONITOR.

If a program is to be run, the parameter coded must be PGM=<name of program>; in the example, the program MONITOR is being called. If a catalogued procedure is to be called one may code either PROC=<name of procedure>, or, alternatively, the name of the procedure alone. That is

//STEP1 EXEC PROC=HALFC and //STEP1 EXEC HALFC

are both legal, and are identical in effect: the catalogued procedure named HALFC is invoked.

The REGION and TIME parameters, like those used in the JOB card, specify the maximum amount of main storage and the time limit for the execution of the task

invoked. But whereas the parameters on the JOB card give overall limits that cannot be exceeded by any step in the entire job (which may consist of several steps, and hence several EXEC cards), parameters on the EXEC card specify only limits on the particular step being defined. If you want to specify different region sizes for each step, no

REGION parameter should be coded on the overall JOB card, because this causes the REGION parameter on any EXEC cards to be ignored. Here a storage size of 350K and a time limit of one minute are specified.

The programs and catalogued procedures invoked by a job step may, in many cases, permit or require arguments or parameters to be passed to them. These parameters may set initial values or specify options to be employed. For instance, the HAL/S

compiler can have any of a large number of options specified to it, identifying the size of the various tables it will construct, describing the level of explicitness of the messages it emits, or instructing it to output dumps and traces. Parameters are passed to programs, as well as to catalogued procedures, by coding the PARM= parameter, with the right hand side of the equal sign consisting of the parameters to be passed, all contained within single quotes. In the example given, the HAL/S compiler is instructed to emit an

HAL/S-FC User’s Manual USA003090 32.0/17.0

2-10 November 2005

assembly list after Phase 2, and is told that space must be left for 500 symbols in the symbol table, rather than the default 200. (Section 5.1 specifies all of the available compiler options.)

In a job consisting of more than one step, it may occur that errors detected in an early step may make execution of a later step undesirable or even impossible. For example, if the job you are submitting consists of a three-step request to compile, link-edit, and execute a HAL/S program, and during compilation several serious errors in your source program are discovered, then you do not really want link-editing or execution to be attempted; any such attempt could only be expensive and fruitless. It is possible in JCL to make execution of a jobstep conditional upon successful execution of an earlier jobstep, with the criteria of “success” being user-defined. This is done using the COND parameter on the EXEC card, as follows.

Every program and procedure, when completed, produces a “condition code” which is simply an integer number indicating the outcome of the step. The COND parameter specifies an arithmetic comparison involving the condition code; if the comparison succeeds (is true) then execution of the step being defined is bypassed. The format of the COND parameter is COND=(n, comparison operator, jobstep), “n” may be any integer number; “comparison operator” is one of “GT” (greater than), “GE” (greater than or equal to), “EQ” (equal to), “NE” (not equal to), “LT” (less than), or “LE” (less than or equal to). “Jobstep”, which is optional, indicates by name which previous EXEC card is being referred to. Thus, e.g., if COND = (4, NE, STEP1) is coded on an EXEC card, that step will only be executed if the condition code produced by the earlier step named STEP1 were not equal to 4. If the “jobstep” parameter is not coded, then the comparison is made with all condition codes produced by all earlier steps.

The HAL/S compiler produces condition codes of 0, 4, 8, 12, or 16, depending on the severity of any errors discovered in the source program. Error severities will be discussed in Section 3.3; suffice it to say, however, that if any code greater than 0 is produced, link editing and execution should almost certainly not take place. Therefore, JCL for the link-edit step, for instance, should always have the COND parameter coded.

If the compilation step were named HAL, as in the previous example, the link-edit step might be coded as follows:

//LKED EXEC PGM=LINK101,REGION=100K,COND=(0,LT,HAL)

This would indicate that the LINK101 program should not be executed if 0 were less than the condition code produced by the step HAL (i.e., the compilation).

Im Dokument HAL/S-FC USER’S MANUAL (Seite 24-27)