| The DSN parameter is used to specify the name of the dataset. Datasets can be temporary or permanent. Temp datasets are created and deleted within the Batch Job, whereas permanent datasets are retained. Let us see an example which uses an input data set TRGD56.INPUT and an output dataset TRGD56.OUTPUT.
| //TRGD56 | JOB | A123,QUASAR,CLASS=A,NOTIFY=&SYSUID | | //STEP01 | EXEC | PGM=IEBGENR | | //INDD | DD | DSN=TRGD56.INPUT | | //OUTDD | DD | DSN=TRGD56.OUTPUT | Here, IEBGENR is the Program LOAD to be executed. This is System-defined program. The input data records to this program are read from the Input Dataset TRGD56.INPUT. The output data records from the program are written to the Output Dataset TRGD56.OUTPUT. Note that the first level of the qualifier in the dataset name tells you the region in which you are working. For example, in the above case, T in TRGD56 indicates that, you are working in the Testing Region. D is used in Development, P in Production.
|
| The DISP parameter is used to specify the disposition of a dataset. Disposition helps you tell the MVS O/S what to do with the datasets, in the scenario that the Batch Job successfully executes, or the Batch Job abnormally terminates. For example, if we consider Output Dataset TRGD56.OUTPUT. Suppose, our program IEBGENR reads input record one-by-one sequentially from Input Dataset TRGD56.INPUT, does some processing on the input record, to produce output record, and writes the output record to the Output Dataset TRGD56.OUTPUT. Suppose there are 1000 input records to be processed in the dataset TRGD56.INPUT. Each record is processed one-by-one and stored in the Output Dataset. Suppose the Batch Job runs successfully, then we want our Output Dataset to be retained, so that we can see the results and use them later ahead. However, suppose if the Batch Job encounters an error at Record no. 599, and stops processing. Then, what should be done with the Output Dataset? Do you really need to keep the Output Dataset TRGD56.OUTPUT or you want to delete it? These options can be specified using the DISP parameter. The DISP Parameter has the following syntax - DISP(current-status,normal-disposition,abnormal-disposition) The current status indicates whether the dataset is to be created newly, or it pre-exists. If the dataset already exists, do we need to only read from the dataset, or modify(update) to the dataset? The current-status can take any of the following options : NEW,OLD,MOD,SHR.
| NEW | NEW is used, when the dataset has to be newly created. Suppose you write a Batch Job to run a PROC with the following DISP(NEW,CATLG,DELETE) Run 1 – It runs successfully. Run 2 – Abnormal Termination(ABEND). Dataset already exists(it has been catalogued). | | OLD | OLD is used, when the dataset already exists. Generally, OLD is used, when job-step(Program LOAD) requires exclusive access to the dataset. When, you use DISP=OLD on a dataset, it reserves the dataset, no other Batch Job can use the dataset. | | SHR | It permits old datasets to be shared. It is identical to OLD, except for the fact that several Batch Jobs can read the dataset concurrently. | | MOD | Generally, when we want to append data to the end of a PS(Sequential) Dataset, we use DISP=MOD. If the dataset does not exist, it changes DISP=MOD to DISP=NEW. | The normal-disposition parameter comes into picture, when a job-step is successfully executed. The normal-disposition can take any of the following options : DELETE,CATLG,UNCATLG,KEEP,PASS.
| DELETE | The dataset must be deleted. | | CATLG | The dataset must be catalogued. System Catalog is nothing but an index of all datasets of the system. It records the name and volume of the device on which the dataset resides. | | UNCATLG | The dataset must be removed from the System Catalog. | | KEEP | We would like to retain the dataset. | | PASS | The dataset must be passed to subsequent job-steps in the Batch Job. | The abnormal-disposition parameter comes into picture, when the Batch Job abnormally terminates(ABENDs). It can take the following options : DELETE,CATLG,UNCATLG,KEEP.
|
0 comments:
Post a Comment