Retrieving Expiration date

evelk

New Member
Is it possible to extract the expiration date from the Progress License information (e.g. _pcontrol, _control) so that our application can give a warning when the Progress license will expire within a month or so..

Regards,
Edwin van Elk
 
I don't know of a quick way of retrieving the expiration date, but I guess you could write a script to grep through the output of the showcfg util.
 
how about this

<snippet>
define temp-table ttCfg no-undo

field tLabels as char
field tValues as char.

function bufferValue returns char ( pcLabel as char ) forward.



run fillCfg.

for each ttCfg:

if bufferValue( "ProductName" ) ne ? then
display
bufferValue( "ProductName" )
bufferValue( "ExpirationDate" ).

end. /* ttCfg */



procedure fillCfg:

define var cFile as char no-undo.
run adecomm/_tmpfile.p ( "", ".cfg", output cFile ).
os-command silent value( "showcfgd > " + quoter( cFile ) ).

input from value( cFile ).

repeat:

define var cLine as char no-undo.
import unformatted cLine.

if cLine = "" then do:
release ttCfg.
next.
end. /* cLine = "" */

if not avail ttCfg then
create ttCfg.

assign
tLabels = tLabels + ( if tLabels ne "" then "," else "" )
+ replace( entry( 1, cLine, ": " ), " ", "" )

tValues = tValues + ( if tValues ne "" then chr(1) else "" )
+ trim( entry( 2, cLine, ": " ) ).

end. /* repeat */

input close. /* cFile */

os-command silent value( "del " + quoter( cFile ) ).

end procedure. /* fillCfg */



function bufferValue returns char:

define var i as int no-undo.
i = lookup( pcLabel, ttCfg.tLabels ).

if i = 0 then return ?.
return entry( i, ttCfg.tValues, chr(1) ).

end function. /* bufferValue */
</snippet>
 
Your idea is brilliant.
but for windows I need to modify your fillCfg proc. I added full pathname for showcfgd utility and added parameter for it. Here's my snippet:

PROCEDURE GetShortPathNameA EXTERNAL "kernel32.dll":
DEFINE INPUT PARAMETER pFullName AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER opShortName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pSize AS LONG NO-UNDO.
END.
/* Special function which transforms long pathnames into short ones */
FUNCTION GetShortFName RETURNS CHARACTER (pName AS CHAR):
DEFINE VARIABLE vS AS CHARACTER NO-UNDO.
DEFINE VARIABLE vLen AS INTEGER NO-UNDO.
vLen = LENGTH(pName).
vS = FILL(" ",vLen).
RUN GetShortPathNameA(pName,OUTPUT vS,vLen).
RETURN IF vS <> "" THEN TRIM(vS) ELSE pName .
END.

procedure fillCfg:
define var cFile as char no-undo.
run adecomm/_tmpfile.p ( "", ".cfg", output cFile ).
DEFINE VARIABLE vDlc AS CHARACTER NO-UNDO.
/* For windows we need to get DLC variable */
GET-KEY-VALUE SECTION "startup" KEY "DLC" VALUE vDlc.
/* Here I must use special api function to avoid long name */
os-command silent value(GetShortFName(vDLC + "\bin\showcfgd") + " " +
QUOTER(vDLC + "\progress.cfg") + "> " + quoter( cFile )).
/* I think to do so but it doesn't work?! */
/* os-command silent value(QUOTER(vDLC + "\bin\showcfgd") + " " + QUOTER(vDLC + "\progress.cfg") + "> " + quoter( cFile )). */
input from value( cFile ).
repeat:
define var cLine as char no-undo.
import unformatted cLine.
if cLine = "" then do:
release ttCfg.
next.
end. /* cLine = "" */
if not avail ttCfg then
create ttCfg.
assign
tLabels = tLabels + ( if tLabels ne "" then "," else "" )
+ replace( entry( 1, cLine, ": " ), " ", "" )
tValues = tValues + ( if tValues ne "" then chr(1) else "" )
+ trim( entry( 2, cLine, ": " ) ).
end. /* repeat */
input close. /* cFile */
/* os-command silent value( "del " + quoter( cFile ) ). */
end procedure. /* fillCfg */
 
but there's an issue with
os-command silent value(QUOTER(vDLC + "\bin\showcfgd") . What's that? Bug, feature or what? I dug my sources and detected I always use either batch processing (export commands in bat-file and then run it) or 'shortname' function.
 
it's ... gates

did anyone really think it was progress
man, the crap micrsoft pushes ...


from the command prompt
"%comspec%" /c "%dlc%\bin\showcfgd" "%dlc%\progress.cfg" > "c:\test.cfg"
gives off the same problem

but if you use double quotes
"%comspec%" /c ""%dlc%\bin\showcfgd" "%dlc%\progress.cfg" > "c:\test.cfg""
it works, apparently a parsing problem


this fixes it

<snippet>
define var cDLC as char no-undo.
get-key-value section "startup" key "dlc" value cDLC.

os-command silent value(
"~"" + quoter( cDLC + "\bin\showcfgd" )
+ " " + quoter( cDLC + "\progress.cfg" )
+ " > " + quoter( cFile ) + "~"" ).
</snippet>

don't use quoter( ) for double quotes

<quote>
If <expression> is of data type CHARACTER, internal quotes are
doubled. If the first and last byte are already quotes, then it is
assumed that the quoting has already been done, and no further
quotes are applied.
</quote>
 
Back
Top