Expiration Date Calculations

Document ID : KB000027999
Last Modified Date : 14/02/2018
Show Technical Document Details

Question:

How does CA 1 determine when to scratch a tape?

Environment:

All releases of CA 1.

Answer:

Real time processing (creation of a tape):

When a secondary file is created on a tape the expiration date of that file is compared to the expiration date in the volume (first file) record. If the secondary file (DSNB) expiration date is numerically higher than the volume expiration, the higher date is moved into the volume record and becomes the new expiration date for the tape. NOTE: KEYWORDS are always numerically higher than a Julian date due to the 'century' value of 99.

When using real-time RDS processing the RDS (retention data set), is read into storage during the start of TMSINIT. The RDS rules are processed at file close. The new EXPDT value will replace the EXPDT for that file if the RDS bit is on in the record. If a secondary file (DSNB) is being processed CA 1 will check the EXPDT of the volume and if the new EXPDT is higher it will be propagated to the volume record.

When using the real-time RDS and you have the option, MIXEXP set to DISALLOW CA 1 will allow you to write the file, but at close it will cause the job to abend if the updated EXPDT is still considered to be mixed.

Batch/manual Updates:

If the volume record is updated via ISPF/TIQ, or TMSUPDTE - the new EXPDT date will be used for the volume and no check is made against the DSNB records. The assumption is that if you are manually updating the volume record, you know what value you want for the entire tape.

TMSEXPDT can update the EXPDT of a DSNB. If the EXPDT of the DSNB is higher that what is currently on the volume CA 1 will propagate the new EXPDT value to the volume.

TMSUDSNB and ISPF can be used to update the EXPDT of a DSNB and we will not propagate the EXPDT to the volume if it is higher than what is currently on the volume.

Expiring/scratching tapes:

TMSCYCLE:
TMSCYCLE does not look at secondary files. If you have stacked files on a tape with different cycle retentions, the volume will have the highest number of cycles but the retention will be applied against the first file.

Example:
File 1 DSN.A EXPDT=CYCLE/003
File 2 DSN.B EXPDT=CYCLE/002
File 3 DSN.C EXPDT=CYCLE/005

At this point the EXPDT of CYCLE/005 will be propagated to File 1 (the volume record) TMSCYCLE will expire the tape when five more cycles of DSN.A have been created as the first file on other tapes.

TMSCTLG:
TMSCTLG will only look at volumes with an EXPDT of CATALOG. It will do a LOCATE to see if the first file on the tape is still on the OS catalog. If the return code indicates that the data set is no longer cataloged, the program will go through the DSNB chain and do a LOCATE for each secondary file under CATALOG control. The tape will maintain an EXPDT value of CATALOG as long as any file under catalog control is still on the OS catalog.

When all files on the tape under catalog control have been uncataloged, the program will then look for the highest EXPDT on the files that were not under catalog control. TMSCTLG will expire the tape by changing the EXPDT value of the volume to the highest of:

  1. the system date + the R9 value in the options
  2. the expiration date of any DSNB not under catalog control
Example 1:
System date is 2007/240, R9=0
File 1 DSN.A EXPDT=CATALOG
File 2 DSN.B EXPDT=2007/130
File 3 DSN.C EXPDT=CATALOG
File 4 DSN.D EXPDT=2007/310
If files DSN.A and DSN.C are no longer cataloged when TMSCTLG runs, the EXPDT value in the volume will be changed to 2007/310.
Example 2:
System date is 2007/240, R9=0
File 1 DSN.A EXPDT=CATALOG
File 2 DSN.B  EXPDT=2007/130
File 3 DSN.C EXPDT=CATALOG
File 4 DSN.D EXPDT=2007/210
If files DSN.A and DSN.C are no longer cataloged when TMSCTLG runs the EXPDT value in the volume will be changed to 2007/240 and the tape will be eligible for TMSCLEAN to scratch.
Example 3:
System date is 2007/240, R9=3
File 1 DSN.A EXPDT=CATALOG
File 2 DSN.B EXPDT=2007/130
File 3 DSN.C EXPDT=CATALOG
File 4 DSN.D EXPDT=2007/210
If files DSN.A and DSN.C are no longer cataloged when TMSCTLG runs, the EXPDT value in the volume will be 2007/243, today's date + R9 value of 3.

TMSCLEAN:
TMSCLEAN only looks at the volume record to determine when a tape should be scratched. The program looks for EXPDT values of today's date or a date in the past or LDATE/ddd. For the tapes with a LDATE/ddd it will compare today's date with the last used date (LDATE) to verify if the requested number of days has past since the tapes last use. If they have passed then the tape is scratched.

If OCTLG is set to NO then TMSCLEAN does the same processing for tapes under CATALOG control as the old TMSCTLG program. TMSCLEAN does not do the LOCATE as TMSCTLG but uses the OSC bit in FLAG4 for the volume and FLAG1 for a DSNB to determine if the data set is still cataloged.
If OCTLG is set to NO, and SCRCAT is set to YES (the default) then the processing is the same as TMSCTLG.
If OCTLG is set to NO, and SCRCAT is set to GDG or NO the processing changes for tapes that are not under catalog control. If it is set to GDG then TMSCLEAN will not scratch a tape if it contains a GDG data set that is still on an OS catalog. If it is NO then TMSCLEAN will not scratch a tape if any data set on the tape is still on an OS catalog.

CA 1 will keep track of how many times the file is cataloged. When you uncatalog the data set this count is reduce by one. A tape under catalog control will have to have the OSC bit off and the CTLGCNT = 0 before it will be scratched. This CTLGCNT field was introduced for those clients that do not share their OS catalogs and need to have a data set cataloged on more than one catalog and do not what the tape scratched until it is not cataloged on any system.