....
/************************************************************/
/** (c) Copyright Velocity Software, Inc. 1990,1994 */
/************************************************************/
/* */
/* ESAMAP/VMPAF Extract File Data Extraction Procedure */
/* */
/* Usage: ESAPAFEF return mode variables */
/* */
/* where return is STACK or the output file name, */
/* mode is the mode of a read/write disk, */
/* and variables lists the variables to be extracted */
/* in the form */
/* fname.ftype.variable [...] */
/* */
/* This procedure is invoked by VMPAF and is not intended */
/* for direct end-user use. */
/* */
/************************************************************/
Parse Upper Arg route fmode varlist
Parse Var varlist fname'.'ftype'.'.
fileid = fname ftype '*'
Address Command 'ESTATE' fileid
If RC > 0 Then Do
Say "File '"fileid"' not found on disk."
Exit 28
End
Address Command 'EXECIO 1 DISKR' fileid '(VAR VARIABLES FINIS'
If RC > 0 Then Do
Say "Error" RC "reading file '"fileid"' from disk."
Exit RC
End
'MAKEBUF'
buffer = RC
Queue varlist
Parse Var variables fn'.'ft'.'.
prefix = fn'.'ft
fields = ''
Do While varlist <> ''
Parse Var varlist .'.'.'.'variable varlist
If variable = 'TOD' Then variable = 'STOPTIME'
If variable = 'INTERVAL' Then variable = 'SECONDS'
field = FIND(variables,prefix'.'variable)
fields = fields field
End
nf = WORDS(fields)
'EXECIO * DISKR' fileid 2 '( STEM DATA. FINIS'
r = RC
If RC > 0 Then Do
Say "Error" RC "reading file '"fileid"' from disk."
'DROPBUF' buffer
Exit r
End
Do d = 1 To data.0
record = ''
Do f = 1 To nf
w = WORD(fields,f)
If w > 0
Then record = record || WORD(data.d,w) || ' '
Else record = record || '1E72 '
End
Queue record
End
If route <> 'STACK'
Then Do
'EXECIO' (data.0 + 1) 'DISKW' route 'WORK' fmode '( FINIS'
r = RC
If RC > 0 Then Do
Say "Error" RC "writing file '"route "WORK" fmode"'" ,
"on disk."
End
'DROPBUF' buffer
End
Exit r
Don't miss Velocity Software's Performance Seminars
Check our calendar for workshops and other events.