JCL Session 9


 LOAD MODULE

        is the executable machine language version of a source program.



 
        In order to execute a load module, it must be stored in a PDS (library).




    Create a new load module library using either JCL or TSO/ISPF 3.2


To populate the PDS with load modules:
 



MVS search SYS1.LINKLIB as the default load library when looking for programs.

To execute a program saved in a library other than SYS1.LINKLIB, direct MVS to other PDS load libraries by using STEPLIB DD and/or JOBLIB DD statement(s).


//STEPLIB DD can be used after an EXEC statement and will direct the system
to look in the DSN= library only when executing that step.

i.e.
 



//JOBLIB DD can be used after the JOB card and will direct the system to look at the
specified DSN= libraries in those steps which do not have a //STEPLIB DD statement.

i.e. //jobname JOB (etc.)
 


Load module libraries may have to be reorganized because each compile and linkedit of a program will cause replacement copies to use a new data space.


PROGRAM STATUS - a completion code number issued at a program's termination.

As each program returns control to the system, it gives the system its final program status
as a coded number.
 

The final program status number may be useful

IBM software using the following convention regarding program execution:
 
                COND CODE 0000 - program successful
                COND CODE 0004 - warning messages
                COND CODE 0008 - Serious flaws
                COND CODE 0012 - Very serious flaws
                COND CODE 0016 - Disaster


    COBOL programmers control the final status of their programs by
    moving a number to RETURN-CODE.

    If RETURN-CODE is not used in the program, the default number is zero.

i.e.
 



COND CODE - AN EXEC PARAMETER TO BYPASS STEP EXECUTION
          Why bypass a step? Why bypass any particular program?
 



FORMAT:     COND=((value,operator,stepname),(..,..,..))
 

Which steps are executed if the program at STEP010 returns a condition code of 3
and all other steps, when executed, return a condition code of 0000?
 



Special cases
 

Example
 

-------------------------------------------------------------------------------------------------------------------------------

IF/ELSE CODING RULES
 



PARM - "PARAMETER" - a value which can be input to a program.

Up to 100 bytes of information to a batch program through JCL PARM statement.



Why use PARM?

Code the PARM statment directly when executing the program directly.
ie
        //STEP020 EXEC PGM=PARMCODE,PARM='SALARIED'

To override a PARM statement on PROCs, use the pattern PARM.procstepname
ie.

                   //STEP020 EXEC PROC=COB2J,PARM.GO='HOURLY'



IDENTIFICATION DIVISION.
PROGRAM-ID. PARMCODE.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DISPLAY-NUMBER PIC ZZZ9.
LINKAGE SECTION.
01 PARM-FIELDS.
05 PARM-CHAR-COUNT PIC S9(4) COMP.
05 PARM-INPUT PIC X(100).
PROCEDURE DIVISION USING PARM-FIELDS.

IDENTIFICATION DIVISION.
PROGRAM-ID. PGMWPARM.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT GRADESI ASSIGN TO DATAIN.
SELECT GRADESO ASSIGN TO DATAOUT.
-------
LINKAGE SECTION.
01 PARMINFO.
05 PARM-LENGTH PIC S9(4) COMP.
05 PARM-DATA.
10 PARM-SCHOOL PIC X(3).
10 FILLER PIC X(97).
PROCEDURE DIVISION USING PARMINFO.

PRACTICAL JCL EXERCISE LOAD LIBARIES, PARMS, & COND
(VALUE 30 POINTS)


Necessary preparation work that should not be handed in. A. Create a load library.

B. Copy PGMWPARM into your COBOL library.
 

Change the program so that it issues a return code of 0013

if no students attending the school equal to the parm input.

The program should issue a return code of 0000 if there are

students in the school equal to the parm input.
 

C. Compile and link the altered PGMWPARM program into your load libary.

D. Create and store, in your proclib, a three step proc which will execute
 

1)     PGMWPARM in the first step, (use //STEPLIB DD reference)

        (PGMWPARM should send all output to a temporary file).

        The input is JPETLIC.CSC.CNTL(GRADES).

2)     SORT in the 2nd step, only if there is output from the first step,
          (use the COND= specification to test the result of PGMWPARM)
 
        Sort by student name of the temporary file created by PGMWPARM.
 

3)     IEBGENER in the 3rd step to print the sorted temporary file
        only if there is output from the first step and the sort step worked.
        (Use the COND= specification to test the result of PGMWPARM and SORT)
 



Work that should be handed in. Exec your PROC twice in one JOB
  The first execution should produce output because you feed
a parm that matches a school.

The second execution should not produce output because
you feed a parm that does not match a school. (this means
the sort and iebgener steps should not execute).