From: Richard B. Gilbert [rgilbert88@comcast.net]
Sent: Wednesday, January 28, 2004 11:01 PM
To: Info-VAX@Mvb.Saic.Com
Subject: Re: Do you need F$LICENSE?

I couldn't use PIPE, this was ca. 1997 and VMS/Alpha V6.x or VMS/VAX 5.5-2.

As for using SEARCH, would you care to try it?   The tool did not seem 
well suited to the job at the time and I still have trouble visualizing 
just how it would work.

Here's what I did.  I'm sure you can duplicate the output using some 
other tools but can you do it in two days or less?  If you don't care to 
execute this mess on your own machine, this lists all the active 
licenses that DO NOT have MOD_UNITS.  When I say lists, it copies the 
output of SHOW LICENSE /FULL for each license that meets the criteria.  
It also lists the total licenses, the total active licenses, and the 
total active licenses without MOD_UNITS.

# MOD_UNITS.AWK
# Richard B. Gilbert
# 1-SEP-1997
#
# Find all active licenses in a list that:
#       a. have the string "Active", and
#       b. Do NOT have the string MOD_UNITS in the options field.
# Use LICENSE LIST /FULL /OUTPUT=XX.TMP
# EDIT /NOCOMMAND XX.TMP
#*s/---------------------------------/^L/whole
#*exit
#$ GAWK -f mod_units xx.tmp
#
#
BEGIN {
        FS="\n"         # Field separator is newline
        RS="\f"         # Record separator is <ff>
        ORS="-----------------------------------\n"
}
{++licenses}
/Active/ {
        ++active_licenses
        if ($0 !~ /MOD_UNITS/) {
        ++no_mod_units
        print $0
}}
END {
        ORS="\n"
        print licenses, " licenses"
        print active_licenses, " active_licenses"
        print no_mod_units, "licenses without MOD_UNITS"
}

and the DCL wrapper.
$! DOIT.COM
$ EDIT /EDT /NOCOMMAND 'P1'_LICENSE.LIS
s/-----------------------------------/<FF>/whole
exit
$ ASSIGN /USER 'P1'_NO_MOD_UNITS.LIS SYS$OUTPUT
$ GAWK -f mod_units 'P1'_LICENSE.LIS


I have since plagiarized this script and some of its descendants to do 
some other jobs, none quite so difficult but all somewhiat irksome to do 
with only native VMS tools.  The two days I spent have paid for 
themselves many times over.

David J. Dachtera wrote:

>"Richard B. Gilbert" wrote:
>  
>
>>Guy,
>>
>>The only time I ever needed to do anything that your F$LICENSE might
>>help with was when a former boss wanted me to find out, for each of 25
>>systems, VAX and Alpha, which licenses had the MOD_UNITS option.  I
>>wrote a gawk (Gnu awk) script to parse the output of SHOW LICENSE/FULL,
>>wrapped it in the appropriate DCL, ran it, and delivered the output to
>>my boss.  It took me the better part of two days to write and debug the
>>gawk script (I'm not fluent) but I thought it better than trying to do
>>it by hand.
>>    
>>
>
>Wow! Y'know, it might have been faster and easier to just use stuff like
>SEARCH and/or F$LOCATE(), F$ELEMENT(), and others in a DCL proc.
>
>...or even:
>
>$ PIPE -
>	LICENSE LIST/FULL | -
>	SEARCH SYS$PIPE PRODUCT,MOD_UNITS/OUT=TEMP.TMP
>$ SEARCH TEMP.TMP MOD_UNITS/WINDOW=(1,0)
>
>...would provide something terse, but informative.
>
>  
>

��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������