UFH Introduction

    USP's ufh capability was invented by Martin L. Smith in 1991. This user's guide is a paraphrase of Martin's original which was first published in 1992. If you have any questions about the language implementation or features and your local USP guru can't help, feel free to contact Martin at:


      Martin L. Smith
      New England Research, Inc.
      (802) 296-2401
      martin@ner.com

    By itself ufh does virtually nothing. Coupled with an instruction script [usually termed a ufh script] supplied by the user it can do practially anything.

    ufh reads data in USP format from stdin and writes data in USP format to stdout. In between it reads a control script, compiles the script and operates on the datastream that is passing through. The syntax for execution is:


      ufh
      ufh_script < datain > dataout

    for disk file file access or


      USP process | ufh ufh_script | USP process

    for pipe usage. ufh scripts are made up of a user selected set of the following functions:


      func Begin()
      func OnLineHeader()
      func OnTrace()
      func End()

    A very simple script to count the number of records and traces in a USP dataset would look like:


      func Begin() /* initialize a couple of counters */
        {
        RecNum = 1;
        Traces = 1;
        }

      func OnLineHeader() /* read and output the line header */
        {
        output(LH);
        }

      func OnTrace() /* if trace count modulus 481 increase record counter by one */
        {
        output(Tr); /* read and output traces */

        if ( ( Traces%481 ) == 0 ) {
          ++RecNum; }
        Traces++;

        }

      func End() /* print out the results */
        {
        print ( "Number of Records in Dataset = ",RecNum,"\n");
        print ( "Total Number of Traces in Dataset = ",Traces,"\n");
        }


      Note the C like syntax. If you are not a programmer do not let this scare you. We have a large archive of ufh scripts that have been used over the years. A cursory examination of any of these will make it pretty obvious how to use the tool.

      It is not necessary to use all functions in the script. For instance if you do not need to initialize anything and do not which to see any post processing reporting you could skip the Begin and End functions.


    BACK Return to UFH Tutorial.