Skip to content

Embedded HS

Mike Bergsma edited this page Aug 1, 2014 · 1 revision

Overview

HS code can be embedded within the PROMIS(TM) token input stream, or in PROMIS(TM) script files. HS is triggered on and off by the sequence of "##" encountered in the PROMIS(TM) token input stream. Since HS intercepts the PROMIS(TM) token input stream before being used by PROMIS(TM), it can supply tokens back to the PROMIS(TM) program shell to execute. In this manner, HS can control the execution of the PROMIS(TM) application.

The following example illustrates a useful technique of performing a PROMIS(TM) function to display the recipe for the current lot.

! Start of normal PROMIS script file...
.
.
! Load and define a HS method.
##
DISP_RECIPE() {
   /* Out of lot tracking, display active recipe, 
    * then back to lot tracking 
    */
   result = pexec("q man mai lis r n " $actl.recpId + " ,,n y q op");
   return ;
}
##
! Back to normal PROMIS script mode.
! Track-into script
into
! Prompt for lotid
@
eqpid
.
.
! Execute HS to display the recipe
## DISP_RECIPE() ; ##
.
.

The main advantage of using HS in the PROMIS(tm) environment is its (read-only) access to PROMIS(tm) database and tracking information.

Accessing the PROMIS(tm) Database

All PROMIS(tm) database variables are available. To access a variable, you must first execute the pget method to read in a database record for the database file of interest. Thereafter, any variable defined in the database record can be accessed by simply specifying the record field name of the variable. For example:

/* Get the ACTL record for the lotid contained
 * in the lotid
 */
pget ( "actl.lotid", "eq", lotid  ) ;

/* Check to see if the process name begins
 * with "BCA"
 */
if ( strext ( actl.procname, 0, 3 ) == "BCA" ) {
   /* .
      .
      . */
}

To search sequentially through a PROMIS(tm) file, use the pget method to get the first record in the sequence, then use the pnext method to get subsequent records in the file. Both primary and secondary keys can be used. For example:

/* Get the latest TRES record for the dcop*/
ret = pget ( "tres.treskey", "ge", dcop  ) ;

/* Search backwards through records */
while ( ret && tres.dcop == dcop ) {
   /* .
      .
      . */
   /* Get next record */
   ret = pnext ( "tres.treskey" ) ;
}

For PROMIS(tm) database fields that are arrays, they must be accessed by enclosing the variable in single quotes. For example:

upperLimit = 'test.di(1).uprlim' ;

The dereference operator must be used to access the ith component of such a variable. For example:

uprlimvar = "test.di(" + index + ").uprlim" ;
upperLimit = *uprlimvar ;

Accessing Tracking database variables.

Many of the PROMIS(tm) tracking functions place the PROMIS(tm) database records for ACTL, TRES, and TEST in a common area buffer. These variables can be access by specifying the variable with a "$" preceding the record field name. For example:

put ( "Currently tracking" + $actl.lotid ) ;

Be careful not to access these variables unless you are currently executing or have just finished executing a PROMIS(tm) tracking function. These variables are only reliable under these strict conditions.

Accessing Tracking parameter variables.

In the same manner as tracking database variables are accessed, the tracking parameters contained in the common area ACTL, RECP, and TEST records can be accessed. Parameters are accessed by specifying the parameter name, which are always preceded by a "$" symbol. For example:

put ( "Value of $recipe is " + $recipe ) ;

Be careful not to access parameters unless you are currently executing or have just finished executing a PROMIS(tm) tracking function. Parameters are only reliable under these strict conditions.

PROMIS(tm) functions can be executed using the pexec method, or by temporarily disabling HS using the "##" sequence, executing some PROMIS(tm) tokens, then re-enabling HS with another "##" sequence.

If you are executing a normal PROMIS(tm) script and you just want to get a supply a value to a PROMIS(tm) function, a good method would be as follows:

! Normal PROMIS script
!
! Passive attach to location, use value pulled from
! database.
##
/* Get receive location for active part 102.2.4.12 */
pget ( "part.activekey", "eq", "A102.2.4.12" ) ;
pexec ( "quit oper pass " + part.locationId ) ;
##

PROMIS(tm) database and tracking variable names are case-insensitive, unlike standard HS variables

Clone this wiki locally