In article <[log in to unmask]>, [log in to unmask] wrote:
> 1. Is there a way that an executing MPE/iX command file can determine its
> name (file-name, group, account)?
>
> 2. Can I perform I/O on a file within a loop and read successive records? I
> tried a WHILE loop but I keep reading the same record:
>
> SETVAR COUNTER 1
> WHILE COUNTER < FINFO ("file","EOF) DO
> INPUT variable<file
> do something else
> SETVAR COUNTER COUNTER + 1
> ENDWHILE
>
> I think I know how to do this within MPEX using its FILE I/O FUNCTIONS,
but
> I'd rather do it at the MPE/iX level.
>
> 3. How could I have constructed a search within LaserRom/PC to have answered
> these questions?
>
> Thanks,
>
> Leonard Berkowitz
> RIAG (Warren, Gorham & Lamont)
> 617-292-8349 (E. D. T.!!!)
1. You can use the "!-1" command to assign the last command executed by
the CI to a variable (example, first line of cmd file is: SETVAR
cmdFileName "!-1"); you should parse the string bound to 'cmdFileName' to
determine the group and account --using !hpaccount and !hpgroup as/if
needed; your code should look for "XEQ" string as well (just in case).
2. One technique to use is to copy the file you wish to read into a
'temp' message file first and then read from the message file. Something
like:
...use FINFO to get file attributes for 'file'
...store them in variables like recSize, fileBlk, ...
...build WRKTMP as a message file in the temp domain using correct file
... attributes from above (!recSize, !fileBlk etc...)
...do a file equate to set access to append for this 'temp', 'msg' file
...use FCOPY to copy what is in 'file' into 'WRKTMP' using the
... back-ref name in your file equate and then do something like what
... you had above (send output of FCOPY to $NULL):
WHILE (FINFO("WRKTMP", "EOF") > 0) DO
INPUT cmdFile_currRec < WRKTMP
...parse the string "!cmdFile_currRec" for your info
...do something else
ENDWHILE
There are other techinques too; see references below. I don't have my
command files with me, otherwise I'd paste one in...hope you can follow
the pesudo code above...
3. Not sure. I don't think this is in the standard HP3K documentation!?
References:
-----------
Bailie, J. Interact, March 1994 "MPE/iX Command File Tips and Techniques"
pp. 51-63.
Martinez, R. Interact, November 1992 "Creating Command Files with the
Command Interpreter" pp. 26-39.
Dunlop, J. Interact, November 1992 "CI Programming in MPE XL/iX or What
the Manuals Don't Say" pp. 78-89.
-----------
Hope this is what you needed.
Stan Miller
MetaLogic Software Labs, Inc.
St. Paul, MN 55123
|