OpenVMS remove expired licences from LMF

If your renewing your OpenVMS PAK’s you will need to remove the expired licences.

I found a nice DCL script for this :-
LMF clean up

Hear is the DCL script :-

$! File: LMF_CLEANUP.COM
$!
$! Procedure to remove expired keys from the LMF database.
$!
$! Use this at your own risk!
$!
$! 25-Nov-2001	J. Malmberg	Original
$!
$!===========================================================================
$!
$pid = f$getjpi("","PID")
$temp_file = "sys$scratch:lmf_cleanup_''pid'.temp"
$on control_y then goto all_exit
$!
$! Backup the LMF database in case of oops
$!-----------------------------------------
$copy/log lmf$license: sys$scratch:lmf_backup.ldb
$write sys$output "lmf$license backed up to sys$scratch:lmf_backup.ldb"
$write sys$Output "You can delete this file after verifying the cleanup."
$!
$! Dump out the LMF records
$!-------------------------
$if f$search(temp_file) .nes. "" then delete 'temp_file';*
$license list/full/out='temp_file'
$!
$today = f$cvtime("","COMPARISON","DATE")
$pak_issuer = ""
$!
$open/read/end=loop_end tf 'temp_file'
$loop:
$   read tf line_in/error=loop_end
$   line_in = f$edit(line_in,"COMPRESS,TRIM,UPCASE")
$   key = f$edit(f$element(0, " ", f$element(0, ":", line_in)),"TRIM")
$   value = f$edit(f$element(1, ":", line_in),"TRIM")
$   if key .eqs. "ISSUER"
$   then
$	pak_issuer = value
$	pak_authorization = ""
$	pak_product = ""
$	pak_producer = ""
$	pak_term = ""
$   endif
$   if key .eqs. "AUTHORIZATION" then pak_authorization = value
$   if key .eqs. "PRODUCT" then pak_product = value
$   if key .eqs. "PRODUCER" then pak_producer = value
$   if key .eqs. "PAK"
$   then
$!	write sys$output "''pak_product', Date= ''value'"
$       if value .eqs. "(NONE)" then goto loop
$	pak_term = f$cvtime(value,"COMPARISON","DATE")
$!	show sym pak_term
$!	show sym today
$	if pak_term .lts. today
$	then
$	    write sys$output "Deleting License = ''pak_product', Date= ''value'"
$	    license delete 'pak_product'/auth='pak_authorization'-
			/producer='pak_producer'
$	endif
$   endif
$   goto loop
$loop_end:
$!
$! Clean up and exit
$!----------------------
$all_exit:
$if f$trnlnm("tf", "LNM$PROCESS_TABLE", "SUPERVISOR") .nes. ""
$then
$   close tf
$endif
$!if f$search(temp_file) .nes. "" then delete 'temp_file';*
$exit


Past this into a new file and execute it. If you get a message about unrecognized verb that's ok.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: