A load library contains programs ready to be executed. 一個加載庫存里面包含著那些準備被調用的程序。
A load library can be any of the following: 加載庫可以是下面幾種類型
- System library 系統庫
- Private library 私有庫
- Temporary library. 臨時庫
System library 系統庫
Unless a job or step specifies a private library, the system searches for a program in the system libraries when you code: 假如你沒有在編碼的時候指明一個私有庫, 系統默認在系統庫里面尋找這個程序進行調用。 //stepname EXEC PGM=program-name
The system looks in the libraries for a member with a name or alias that is the same as the specified program-name. The most-used system library is SYS1.LINKLIB, which contains executable programs that have been processed by the linkage editor. 系統會根據你提供的程序的名字或者是別名尋找所需要的程序,而最常用的系統庫是SYS1.LINKLIB,他包含了那些已經被連接和編譯的程序。
Private library 私有庫
Each executable, user-written program is a member of a private library. To tell the system that a program is in a private library, the DD statement defining that library can be coded in one of the following ways: 每一個可執行,用戶自己編寫的程序都是私有庫的一個成員,要告訴系統怎么調用這個私有庫的程序,可以使用DD語句,方式有如下幾種:
- With a DD statement with the ddname JOBLIB after the JOB statement, and before the first EXEC statement in the job.
在EXEC語句的之前,JOB語句之后,用DD語句加上ddname 來編碼 - If the library is going to be used in only one step, with a DD statement with the ddname STEPLIB in the step.
假如這個庫只在一個作業步中使用,那么可以使用在這個作業部上用 DD語句加上ddname STEPLI 進行編碼
To execute a program from a private library, code: 調用一個私有庫的程序,編碼如下 //stepname EXEC PGM=program-name
When you code JOBLIB or STEPLIB, the system searches for the program to be executed in the library defined by the JOBLIB or STEPLIB DD statement before searching in the system libraries. 當你編寫了JOBLIB 或者 STEPLIB,那么系統就會優先搜索那些定義在JOBLIB或者STEPLIB的DD語句的庫的同名程序進行調用,假如找不到,系統就會在系統庫里面去找
If an earlier DD statement in the job defines the program as a member of a private library, refer to that DD statement to execute the program: 假如用DD語句在JOB的之前的定義了一個私有庫,那么就可以用下面的這種方式調用之前定義了的庫的程序。
//stepname EXEC PGM=*.stepname.ddname
Private libraries are particularly useful for programs used too seldom to be needed in a system library. For example, programs that prepare quarterly sales tax reports are good candidates for a private library. 私有庫在實際使用上是非常有用的,而系統庫是很少被使用,例如,用于季度銷售稅報告的程序就是一個很好的例子。
Temporary library 臨時庫
Temporary libraries are partitioned data sets created to store a program until it is used in a later step of the same job. A temporary library is created and deleted within a job.
臨時庫是一個用于存儲程序的分區數據集,這個數據集直到同名作業完成后被銷毀,一個臨時庫是由一個作業來創建或者被刪除。
When testing a newly written program, a temporary library is particularly useful for storing the load module from the linkage editor until it is executed by a later job step. Because the module will not be needed by other jobs until it is fully tested, it should not be stored in a private library or a system library.
In Figure 1, the LKED step creates a temporary library called &&LOADMOD on the SYSLMOD DD statement. In the GO step, we refer back to the same temporary data set by coding: 當我們在測試一個新編寫的程序的時候,臨時數據集十分有用,它用于存儲來自于連接編輯器的加載模塊直至被后面的作業步執行,因為這個模塊在其他作業被測試完成時候就不需要了,因此,它不應該被存為私有庫或者是系統庫,在下面的圖1中嗎,LKED作業步就創建了一個叫做&&LOADMOD的臨時庫在名為SYSLMOD的DD語句中,在GO作業步中,我們就引用了這個臨時庫,代碼如下 //GO EXEC PGM=*.LKED.SYSLMOD,....
Figure 1. Compile, link-edit, and execute JCL//USUAL JOB A2317P,'COMPLGO'
//ASM EXEC PGM=IEV90,REGION=256K, EXECUTES ASSEMBLER
// PARM=(OBJECT,NODECK,'LINECOUNT=50')
//SYSPRINT DD SYSOUT=*,DCB=BLKSIZE=3509 PRINT THE ASSEMBLY LISTING
//SYSPUNCH DD SYSOUT=B PUNCH THE ASSEMBLY LISTING
//SYSLIB DD DSNAME=SYS1.MACLIB,DISP=SHR THE MACRO LIBRARY
//SYSUT1 DD DSNAME=&&SYSUT1,UNIT=SYSDA, A WORK DATA SET
// SPACE=(CYL,(10,1))
//SYSLIN DD DSNAME=&&OBJECT,UNIT=SYSDA, THE OUTPUT OBJECT DECK
// SPACE=(TRK,(10,2)),DCB=BLKSIZE=3120,DISP=(,PASS)
//SYSIN DD * inline SOURCE CODE
.
.
code
.
/*
//LKED EXEC PGM=HEWL, EXECUTES LINKAGE EDITOR
// PARM='XREF,LIST,LET',COND=(8,LE,ASM)
//SYSPRINT DD SYSOUT=* LINKEDIT MAP PRINTOUT
//SYSLIN DD DSNAME=&&OBJECT,DISP=(OLD,DELETE) INPUT OBJECT DECK
//SYSUT1 DD DSNAME=&&SYSUT1,UNIT=SYSDA, A WORK DATA SET
// SPACE=(CYL,(10,1))
//SYSLMOD DD DSNAME=&&LOADMOD,UNIT=SYSDA, THE OUTPUT LOAD MODULE
// DISP=(MOD,PASS),SPACE=(1024,(50,20,1))
//GO EXEC PGM=*.LKED.SYSLMOD,TIME=(,30), EXECUTES THE PROGRAM
// COND=((8,LE,ASM),(8,LE,LKED))
//SYSUDUMP DD SYSOUT=* IF FAILS, DUMP LISTING
//SYSPRINT DD SYSOUT=*, OUTPUT LISTING
// DCB=(RECFM=FBA,LRECL=121)
//OUTPUT DD SYSOUT=A, PROGRAM DATA OUTPUT
// DCB=(LRECL=100,BLKSIZE=3000,RECFM=FBA)
//INPUT DD * PROGRAM DATA INPUT
.
.
data
.
/*
//
|