....
/************************************************************/ /** (c) Copyright Velocity Software, Inc. 1990,1994 */ /************************************************************/ /* */ /* ESAMAP/VMPAF Extract File Conversion Procedure */ /* */ /* Usage: ESAPAFCV filename [filetype [filemode]] */ /* */ /* where filename is the name of the extract data file, */ /* filetype is the type of the extract data file, */ /* and filemode is the mode of the extract data file */ /* */ /************************************************************/ Address Command Parse Upper Arg fname ftype fmode rest If rest <> '' Then Do Say 'Extraneous parameters "'rest'" ignored.' End If fname = '' Then Do Say "Format: ESAPAFCV filename [filetype [filemode]]" Exit 24 End If ftype = '' Then ftype = 'EXTRACT' If fmode = '' Then fmode = '*' fileid = fname ftype fmode symbols = 'HISTORY KEYWORDS *' 'ESTATE' fileid If RC > 0 Then Do Say "File '"fileid"' not found on disk." Exit 28 End 'MAKEBUF' bufno = RC 'LISTFILE' fileid '( ALLOC NOHEADER STACK' Parse Pull . . fmode . . records . 'DROPBUF' bufno fileid = fname ftype fmode 'EXECIO * DISKR' fileid '( FIND /*HDR/ STEM HDR.' If RC > 0 Then Do Say "Error" RC "reading file '"fileid"' from disk." Exit RC End 'ESTATE' symbols If RC > 0 Then Do Say "File '"symbols"' not found on disk." Exit RC End extract = 1 Do While RC = 0 start.extract = WORD(hdr.2,2) extract = extract + 1 'EXECIO * DISKR' fileid '( FIND /*HDR/ STEM HDR.' End start.extract = records + 1 vnamelist = fname'.'ftype'.STOPTIME' , fname'.'ftype'.SECONDS' || ' ' vvalues. = '' i = 0 v = 0 'MAKEBUF' bufno = RC Do startno = 1 To extract-1 endno = startno + 1 start = start.startno records = start.endno - start.startno - 3 vstart = v Call GetVarNames Call GetVarValues End 'EXECIO 0 DISKR' fileid '( FINIS' 'DROPBUF' bufno valtype = date || 'XE' keytype = date || 'XK' 'ERASE' fname valtype 'ERASE' fname keytype Queue '**' 'EXECIO 1 DISKW' fname keytype 'A' If RC > 0 Then Do Say "Error" RC "writing '"fname keytype "A' on disk." Exit RC End 'EXECIO' v 'DISKW' fname keytype 'A' '( FINIS STEM VNAME.' If RC > 0 Then Do Say "Error" RC "writing '"fname keytype "A' on disk." Exit RC End 'EXECIO 1 DISKW' fname valtype 'A' '( VAR VNAMELIST' If RC > 0 Then Do Say "Error" RC "writing '"fname valtype A"' on disk." Exit RC End 'EXECIO' records 'DISKW' fname valtype 'A' , '( FINIS STEM VVALUES.' If RC > 0 Then Do Say "Error" RC "writing '"fname valtype A"' on disk." Exit RC End Say "'"fname valtype "A' and '"fname keytype "A'" , "created from '"fileid"'." Exit /******************************************/ /* Obtain variable names and descriptions */ /******************************************/ GetVarNames: 'EXECIO 1 DISKR' fileid start '(VAR VNAMES' vnames = SUBWORD(vnames,4) Do While vnames <> '' Parse Var vnames vname vnames 'EXECIO * DISKR' symbols '( FIND /' || vname || '/ FINIS' If RC = 0 Then Do Parse Pull lineno . Parse Pull . 'EXECIO 1 DISKR' symbols lineno+1 '( LIFO FINIS' If RC = 0 Then Do Parse Pull "'" vdesc "'" "'" vunits "'" Select When vunits <> '' Then vunits = '(' || vunits || ')' When WORD(vdesc,1) = 'Percent' Then Do vdesc = SUBWORD(vdesc,2) vdesc = TRANSLATE(LEFT(vdesc,1)) || , SUBSTR(vdesc,2) If FIND(vdesc,'VMDBKs') > 0 , | WORD(vdesc,1) = 'Storage' Then vunits = '(Percent)' Else vunits = '(Percent of time)' End When FIND(vdesc,'per') > 0 Then Do Parse var vdesc vdesc ' per ' vword vunits = '(Number per' vword || ')' End When POS('(',vdesc) > 0 Then Do Parse var vdesc vdesc '(' vword ')' vrest If vrest <> '' Then vdesc = vdesc || vrest Else vdesc = STRIP(vdesc,'T') vunits = '(' || TRANSLATE(LEFT(vword,1)) || , SUBSTR(vword,2) || ')' End When RIGHT(vname,7) = 'SECONDS' Then vunits = '(Seconds)' When POS('I/O',vdesc) > 0 Then vunits = '(Number)' When POS('/',vdesc) > 0 Then Do Parse var vdesc vdesc '/' vword vrest If vrest <> '' Then vdesc = vdesc vrest vword = TRANSLATE(LEFT(vword,1)) || , SUBSTR(vword,2) vunits = '(Number per' vword')' End Otherwise vunits = '(Number)' End vnamelist = vnamelist || fname'.'ftype'.'vname || ' ' v = v + 1 vname.v = LEFT(vname,33) vdesc vunits End Else Do Say "No description for" vname "in '"symbols"'." End End End Return /**************************/ /* Obtain variable values */ /**************************/ GetVarValues: 'EXECIO 1 DISKR' fileid '0 ( VAR DATA' Parse Var data . etime . Do i = 1 To records Parse Var data date time vvalues If vstart = 0 Then Do If i < records Then Do 'EXECIO 1 DISKR' fileid '( VAR DATA' stime = etime Parse Var data . etime . int = (SUBSTR(etime,5,2) - SUBSTR(stime,5,2)) , + (SUBSTR(etime,3,2) - SUBSTR(stime,3,2)) * 60 , + (SUBSTR(etime,1,2) - SUBSTR(stime,1,2)) * 3600 End If i = 1 Then prevint = int vvalues = '19'date || time prevint vvalues prevint = int End vvalues.i = vvalues.i vvalues || ' ' End Return