• Keine Ergebnisse gefunden

Setting Up Temporary Work Files

Im Dokument 0 0 (Seite 130-133)

Temporary work files are used extensively by programmers to storeintermediate processing results and data that will only be used in a particular job or job step.

Depending on file characteristics and the device used, from three to five job control statements are needed in the device assignment set for each temporary work file. The WORK and TEMP JPROC calls allow you to generate any device assignment set needed for temporary work files.

The difference between the two JPROCS is that WORK sets up temporary files for one job step and deletes them at the end of the job step. TEMP sets up temporary files for

the duration of the job, deleting them at the end of the job. WORK and TEMP also generate different default file name values-we’ll explain these in a moment.

The format for WORK and TEMP is:

//[Lfdname] IWORKn1 DVC=rin,VOL= vol-ser-no BLKnnnn

lTEMI’If RESRUN

f

BLK=4000

I CYL=nn

VOL= voL-ser-no RES RUN

[EXTSP=

{}i

[SECALL= {n}1 [TYPE= {fite.tYPe}1

Suppose your assignment is to write a program that reports the grades for each student in the local school district. The program must list each student’s name, grouped by school, in descending grade order. The disk area that stores the data used to calculate the order will never be used again once the job step terminates -an ideal candidate for a temporary file created by WORK

Ignoringall optional parameters, the basic WORK JPROC call is:

II WORKn

5-2 7004 4623.000

Doing It the Easy Way -with Procedure Calls

Wherenis a number in the range 1 through 10. Up to 10 temporary work files can be set up for each job step (or job, if you’re using TEMP). If no specific device or volume is requested, the file is allocated on either SYSRES or the job’s $Y$RUN file; odd-numbered files go to SYSRES and even-odd-numbered files to $Y$RUN. So, if you want one temporary file allocated on the job’s $Y$RUN file, for the duration of the job step, you would code the following:

1/ WORK2

These job control statements would be generated:

II DVC RUN

/1 EXT ST,,1,BLK,(256,4000) If LBL $SCR2,16

/1 LFD $SCR2

We’ll discuss the generated EXT statement in conjunction with the BLK, EXTSP, and TYPE parameters. For now, it’s sufficient to know that 4000 blocks, each 256 bytes long, are allocated by default.

Thelfdname parameter of WORK and TEMP supplies a file name for the generated job control statements. It is one to eight alphanumeric characters in length. The file

identifier on the LBL statement generated by WORK is always prefixed by $SCR, which identifies job step temporary (scratch) files. The number after $SCR

corresponds tonin WORKn. If you omit thelfdnameparameter of the WORK JPROC call and code the following:

II WORK1

the generated statements are:

II LBL $SCR1 1/ LFD $SCR1

The file name in your program must also start with $SCR. In addition, you must use the same WORK JPROC call each time the program is run. If the JPROC call is changed toll WORK7, for example, the file name in your program must be changed to

$SCR7.

70044623-000 5-3

Doing It the Easy Way -with Procedure Calls

For TEMP, unlike WORK, the generated file identifier is $JOB if youomitthe lfdnameparameter. Therefore, if the file name in your program begins with $SCR, you must use thelfdnameparameter of the TEMP JPROC call, like this:

//$SCR1 TEMP 1

togenerate:

/1 LBL $JOBI /1 LFD $SCR1

If you had not used thelfdnameparameter in this example, the generated file name would have been $JOB1, which would not have matched the file name in your program.

You can have the control statements generated by WORKandTEMP listed by specifying the P option on the JOB statement. If you have spooling in your system, the control statements will be printed in the job log. Otherwise, they will be displayed on the system console.

When the job step terminates, all temporary files created by WORK are scratched.

Files created by TEMP are scratched at the end of the job.

Thelfdnameparametercanalso indicate a file’s function when using the WORK JPROC call. For example, if you code

//GRADEOUT WORK2

the generated job control statements are:

1/ DVC RUN

/1 EXT ST,,1,BLK,(256,4000) II LBL $SCR2

If LFD GRADEOUT

It is easier to remember what GRADEOUT contains than it might be to remember what $SCR2 contains.

The remaining optional parameters of the WORK and TEMP JPROC calls are

keyword parameters. if you are unsure of the rules for coding them, turn to Appendix A to refresh your memory.

5-4 70044623-000

Doing It the Easy Way -with Procedure Calls

Notes:

1. Work file labels ($JOB and $SCR) are modified to be unique for the job by

inserting a job-id after the first 4 bytes of the label. This enables all residual work files (for example, work files not scratched when an HPR occurs) to be cleared from the disk during IPL.

2. Within user JCL, work file labels (those starting with $JOB or $SCR) cannot exceed 39 characters.

Im Dokument 0 0 (Seite 130-133)