Schematic cascades
This page describes the organizational forces that limit change.  It explains how to overcome them when necessary. 

Power& tradition holding back progress
This page uses an example to illustrate how:
  • A business can gain focus from targeting key customers,
  • Business planning activities performed by the whole organization can build awareness, empowerment and coherence. 
  • A program approach can ensure strategic alignment. 
Be responsive to market dynamics
This page uses the example of HP's printer organization freeing itself from its organizational constraints to sell a printer targeted at the IBM pc user. 
The constraints are described. 
The techniques to overcome them are implied. 
Overcome reactionaries
Primary Navigation

Mechanisms to cascade schematic operations

Summary
This page discusses how
This page describes the Adaptive Web framework (AWF) test system and the agent programming framework (Smiley) that supports its operation. 
Example test system statements are included.  To begin a test a test statement is loaded into Smiley while Smiley executes on the Perl interpreter. 
Part of Smiley's Perl code focused on setting up the infrastructure is included bellow. 
The setup includes:
  • Loading the 'Meta file' specification,
  • Initializing the Slipnet, and Workspaces and loading them
  • So that the Coderack can be called. 
The Coderack, which is the focus of a separate page of the Perl frame then schedules and runs the codelets that are invoked by the test statement structures. 
Smiley
provides deployment guarantees to its
Plans are interpreted and implemented by agents.  This page discusses the properties of agents in a complex adaptive system (CAS). 
It then presents examples of agents in different CAS.  The examples include a computer program where modeling and actions are performed by software agents.  These software agents are aggregates. 
The participation of agents in flows is introduced and some implications of this are outlined. 
agent-based
applications. 
Smiley's transaction is an operation which guarantees to complete a defined set of activities or return to the initial state.  For a fee the postal service will ensure that a parcel is delivered to its recipient or will return the parcel to the sender.  To provide the service it may have to undo the act of trying to deliver the parcel with a compensating action.  Since the parcel could be lost or destroyed the service may have to return an equivalent value to the sender. 
services are reviewed
The complex interactions of codelets participating in a deployment cascade are discussed including: 
Challenges of initiation of a cascade are discussed
Tools to associate transaction protection to an operon deployed codelet are described
Special support for sub-program codelets is described.  Completion of transactional sub-programs presents special challenges
Priority and synchronization support includes:
The need to sustain resource pools is reviewed
The use of
Agents use sensors to detect events in their environment.  This page reviews how these events become signals associated with beneficial responses in a complex adaptive system (CAS).  CAS signals emerge from the Darwinian information model.  Signals can indicate decision summaries and level of uncertainty. 
signals
to coordinate siblings is described
The structural binding operon is an addressable control structure which is used in biological cells to control access to other regions of the DNA. 
for the wait and relay service is included
The codelets and supporting functions are included.
Introduction
In the living cell the DNA (DNA), a polymer composed of a chain of deoxy ribose sugars with purine or pyrimidine side chains.  DNA naturally forms into helical pairs with the side chains stacked in the center of the helix.  It is a natural form of schematic string.  The purines and pyrimidines couple so that AT and GC pairs make up the stackable items.  A code of triplets of base pairs (enabling 64 separate items to be named) has evolved which now redundantly represents each of the 20 amino-acids that are deployed into proteins, along with triplets representing the termination sequence.  Chemical modifications and histone binding (chromatin) allow cells to represent state directly on the DNA schema.  To cope with inconsistencies in the cell wide state second messenger and evolved amplification strategies are used. 
has operon is an addressable control structure which is used in biological cells to control access to other regions of the DNA. 
sequences which are targeted by various enzymatic, a protein with a structure which allows it to operate as a chemical catalyst and a control switch. 
structures.  Adaptive web framework (
This page describes the Adaptive Web framework (AWF) test system and the agent programming framework (Smiley) that supports its operation. 
Example test system statements are included.  To begin a test a test statement is loaded into Smiley while Smiley executes on the Perl interpreter. 
Part of Smiley's Perl code focused on setting up the infrastructure is included bellow. 
The setup includes:
  • Loading the 'Meta file' specification,
  • Initializing the Slipnet, and Workspaces and loading them
  • So that the Coderack can be called. 
The Coderack, which is the focus of a separate page of the Perl frame then schedules and runs the codelets that are invoked by the test statement structures. 
AWF
) provides a similar infrastructure.  Each mps
This page discusses how Smiley provides signalling to its agent-based applications. 
Alternative strategies for initiating the signalling are reviewed. 
The codelets and supporting functions are included.
signal
induces the launch of its target operon
This page describes the Smiley infrastructure that supports the associative binding of schematic strings to codelets defined in the Meta file and Slipnet. 
The infrastructure supporting the associations is introduced. 
The role of Jeff Hawkins neocortical attributes is discussed. 
Relevant Slipnet configurations are included. 
The codelets and supporting functions are included. 
associated
codelets.   However, while in the living cell such a process would induce a multiplicity of RNA (RNA), a polymer composed of a chain of ribose sugars.  It does not naturally form into a paired double helix and so is far less stable than DNA.  Chains of DNA are converted by transcription into equivalently sequenced messenger m-RNA.  RNA also provides the associations that encode the genetic code.  Transfer t-RNAs have a site that maps to the codon and match the associated amino-acid.  Stuart Kauffman argues that RNA polymers may be the precursor to our current DNA based genome and protein based enzymes.  In the adaptive web framework's (AWF) Smiley we use a similar paradigm with no proteins. 
sequences where the concentration would correspond with the likelihood of action AWF operations identified problems where all instances of a codelet would fail to compete effectively for deployment and execution.  Given AWF's repurposing of biochemical processes to solve
This page describes the Adaptive Web framework (AWF) test system and the agent programming framework (Smiley) that supports its operation. 
Example test system statements are included.  To begin a test a test statement is loaded into Smiley while Smiley executes on the Perl interpreter. 
Part of Smiley's Perl code focused on setting up the infrastructure is included bellow. 
The setup includes:
  • Loading the 'Meta file' specification,
  • Initializing the Slipnet, and Workspaces and loading them
  • So that the Coderack can be called. 
The Coderack, which is the focus of a separate page of the Perl frame then schedules and runs the codelets that are invoked by the test statement structures. 
testing problems
it was always possible that the cell system would need augmentation.  AWF's consequent use of transaction is an operation which guarantees to complete a defined set of activities or return to the initial state.  For a fee the postal service will ensure that a parcel is delivered to its recipient or will return the parcel to the sender.  To provide the service it may have to undo the act of trying to deliver the parcel with a compensating action.  Since the parcel could be lost or destroyed the service may have to return an equivalent value to the sender. 
maintenance of codelet cascades solves some of the challenges the living cell has with state operation.  The living cell does not appear to have access to a transaction based strategy.  It has evolved alternative mechanisms leveraging
Terrence Deacon explores how constraints on dynamic flows can induce emergent phenomena which can do real work.  He shows how these phenomena are sustained.  The mechanism enables the development of Darwinian competition. 
dynamic emergence of constraints
and the
This web page reviews opportunities to find and capture new niches based on studying fitness landscapes using complex adaptive system (CAS) theory. 
adjacent possible
:
Here we will look in detail at AWF's transaction based strategy.  AWF's alternative approaches that are more in line with the living cell's identified strategies include
This page describes a schematic system about abstracted neurons operating in a circuit. 
The neuronal system was designed to focus in on the cellular nature of a schematically defined neuron. 
The goals include:
  • Development of a system of cells, their differentiation and deployment into a neuron network. 
  • Abstract receptor operation must support interactions of a network of neurons and attached cells. 
THE IMPLEMENTATION IS INCOMPLETE AND ONGOING. 
The codelets and infrastructure are included. 
deployment of neuron networks


cascade control

Cascading codelets
A mechanism is provided to assist codelets (including sub-programs) in repeating their
This page discusses how Smiley provides signalling to its agent-based applications. 
Alternative strategies for initiating the signalling are reviewed. 
The codelets and supporting functions are included.
signals
, and alerting them to the operational status of the target codelets. 

For example devbuilder indirectly launches (via developmenti) the complex cascade of development activities for the application.  devbuilder sends the probe sequence '<development> <schema> <lists>' to the nucleus, a membrane bounded module in a eukaryotic cell where the DNA is encapsulated and operated on. 
.  

The dev codelet is an example of a structural codelet.  It creates an associated structural Workspace which provides context ( via the Workspace schematic sequence <development> <sequence> <integration>) for the cascade of codelets that instantiate the development process.  This context includes where the application stream is that will be integrated during this development.
Complex interactions of cascade participants
Mps signals are associated by nuclabm codelets (scout, evaluator, builder) with 'nuclear, a membrane bounded module in a eukaryotic cell where the DNA is encapsulated and operated on. 
' operons is an addressable control structure which is used in biological cells to control access to other regions of the DNA. 
.  The codelet identifies the alternative sub-groups within the operon group, and selects one based on its current salience, Douglas Hofstadter controlled the amount of attention a Workspace object in Copycat would receive from codelets via its salience.  The more descriptions, analogous to geons, an object has and the more highly activated the nodes involved therin, the more important the object is.  Modulating this tendency is any relative lack of connections from the object to the rest of the objects in the Workspace.  Salience is a dynamic number that takes into account both these factors.  In Smiley the instantaneous salience of a Workspace's objects is calculated by itsalience.  .  Hence alternatives within a group will not be guaranteed to run.  Multiple operons may match the signal.  Each is evaluated in the same way.  Deployment codelets then transfer the selected sub-schemas back to the initiator's Workspace.  A pool of transient schemata collects in the Workspace.  Each of the schemata in the pool is ready to
This page describes the adaptive web framework (AWF) Smiley agent progamming infrastructure's codelet based Copycat grouping operation. 
The requirements needed for a group to complete are described. 
The association of group completion with a Slipnet defined operon is described.  Either actions or signals result from the association. 
How a generated signal is transported to the nucleus of the cell and matched with an operon is described. 
A match with an operon can result in deployment of a schematic string to the original Workspace.  But eventually the deployed string will be destroyed. 
Smiley infrastructure amplification of the group completion operation is introduced.  This includes facilities to inhibit crowding out of offspring. 
A test file awfart04 is included. 
The group codelet and supporting functions are included. 
group complete


The deployed schemata may eventually be selected as most salient by a tgroupscout (which exists within a pool of codelets).  That selection will subsequently result in a
This page describes the adaptive web framework (AWF) Smiley agent progamming infrastructure's codelet based Copycat grouping operation. 
The requirements needed for a group to complete are described. 
The association of group completion with a Slipnet defined operon is described.  Either actions or signals result from the association. 
How a generated signal is transported to the nucleus of the cell and matched with an operon is described. 
A match with an operon can result in deployment of a schematic string to the original Workspace.  But eventually the deployed string will be destroyed. 
Smiley infrastructure amplification of the group completion operation is introduced.  This includes facilities to inhibit crowding out of offspring. 
A test file awfart04 is included. 
The group codelet and supporting functions are included. 
group complete
and initiate the submission of the associated codelets.  The schematic group completion competes for the
This page describes the Copycat Coderack. 
The details of the codelet architecture are described. 
The specialized use of the Coderack by the adaptive web framework's (AWF) Smiley is discussed. 
The codelet scheduling mechanism is discussed. 
A variety of Smiley extensions to the Coderack are reviewed. 
The Coderack infrastructure functions are included. 
Coderack
with other activities including the cascade sponsor's repeated actions to ensure control is handed over to its cascade children. 
Phosphatase like is an enzyme which catalyzes the removal of a phosphate group from a side chain of a specific protein.  When paired with a kinase that targets the same protein it gives the cell a schematically controlled switching capability. 
notgcompleted
The sponsor uses notgcompleted to remove the group completed descriptors, and so place its schemata back in the pool targeted by tgroupscouts, sometimes after introducing a delay

Once the schemata have been translated into codelets these will be queued on the Coderack waiting to gain access to the processor and perform some action.  The relative proportions, and priorities, of the codelets is key to which will gain access to the processor.  A mechanism (goal suppression) helps sponsors avoid monopolizing the Coderack unnecessarily.  However, if one of their offspring is unable to perform its actions it can ask for assistance from the cascade sponsor, masking the suppressor (imasksupp) and raising the priority of suppressed sponsor codelets (icskick).  The offspring also aim to limit deployment overhead, by notgcompleting when the
The complex adaptive system (CAS) nature of a value delivery system is first introduced.  It's a network of agents acting as relays. 

The critical nature of hub agents and the difficulty of altering an aligned network is reviewed. 

The nature of and exceptional opportunities created by platforms are discussed. 

Finally an example of aligning a VDS is presented. 
environment
inhibits their completing building.  Again to impede the offspring from monopolizing the Coderack notgcompleted will delay the offspring's next submitcodelet by groupcompletion

Goal suppression
Each cascade participant's evaluator should use ifindupri to recommend the priority to assign to the associated builder.  Each cascade participant's builder describes its view of its situation in a tagged 'goal suppression' structure by updating the backoff descriptor.  When ifindupri identifies that its caller is a cascade sponsor and a backoff descriptor is present ifindupri will propose reducing the urgency of the priority for the builder.  

If the evaluator is recommended to reduce the builder's priority, it can also respond by requesting dropsalience.  dropsalience will respond to the presence of a backoff by deploying a dropsalience descriptorlink in the sponsor, and under control of a 'semaphore'.  Note that the salience, Douglas Hofstadter controlled the amount of attention a Workspace object in Copycat would receive from codelets via its salience.  The more descriptions, analogous to geons, an object has and the more highly activated the nodes involved therin, the more important the object is.  Modulating this tendency is any relative lack of connections from the object to the rest of the objects in the Workspace.  Salience is a dynamic number that takes into account both these factors.  In Smiley the instantaneous salience of a Workspace's objects is calculated by itsalience.   of the sponsor must be calculated dynamically. 

The selection of schemata to groupcomplete by [t]groupscout also reflects the suppression feedback.  The salience strategy routine:tdgroup uses linkeddsalience to evaluate the suppression state from the descriptorlink-dropsalience backoff association.  The salience assessment of each
This page describes the Copycat Workspace. 
The specialized use of the Workspace by the adaptive web framework's (AWF) Smiley is discussed. 
How text and XML are imported into the Smiley Workspace is described. 
Telomeric aging of schematic structures is introduced. 
The internal data structure used to represent the state of each workspace object is included. 
The Workspace infrastructure functions are included. 
Workspace
object (WSO) also checks that the WSO is associated with a cascade sponsor schemata using notcsponsor

Sibling promotion
Evaluator codelets are aware of their siblings.  If they conclude that they should not submit a builder to the Coderack, because of the current application context, they can promote their siblings priorities (promotesib) as well as reinitiating the current codelet's operation after a delay (notgcompleted).  The deployment infrastructure (nsdepbuilder) checks for notgcompleted descriptors.  If these are found it is assumed that the deployed codelet has failed and is repeating its execution.  Since the deployment infrastructure is still trying to fulfill the cascade sponsor's deployment signal nsdepbuilder describes to the notgcompleting evaluator that its builder be launched with a suppressed priority, based on the assumption that the
Plans emerge in complex adaptive systems (CAS) to provide the instructions that agents use to perform actions.  The component architecture and structure of the plans is reviewed. 
schematic plan
has made the appropriate siblings available and the execution problem is due to the Coderack's ordering of execution within the sibling set.  With this strategy once the appropriate sequence of siblings has succeeded in acting the current codelet will also operate successfully and will not have required the overhead of cascade sponsor mps signalling, is an emergent capability which is used by cooperating agents to support coordination & rival agents to support control and dominance.  In eukaryotic cells signalling is used extensively.  A signal interacts with the exposed region of a receptor molecule inducing it to change shape to an activated form.  Chains of enzymes interact with the activated receptor relaying, amplifying and responding to the signal to change the state of the cell.  Many of the signalling pathways pass through the nuclear membrane and interact with the DNA to change its state.  Enzymes sensitive to the changes induced in the DNA then start to operate generating actions including sending further signals.  Cell signalling is reviewed by Helmreich.  Signalling is a fundamental aspect of CAS theory and is discussed from the abstract CAS perspective in signals and sensors.  In AWF the eukaryotic signalling architecture has been abstracted in a codelet based implementation.  To be credible signals must be hard to fake.  To be effective they must be easily detected by the target recipient. 
and the deployment infrastructure. 

However, this promotesib strategy will not be legitimate if any of the set of siblings is not present to execute because their schematic strings did not deploy successfully.  promotesib therefore checks for presence of the schematic strings of all the siblings in the operational Workspace. 
Initiation of the cascade
The interface between cascade initiators and participants is subtle.  The schematic binder complex is an example of cascading schematic operons, as well as structural schemata and associated codelets.  The binder is used in a variety of situations.  In
This page discusses how Smiley can support the start of the development phase of an agent-based application. 
Startup is an artificial operation not found in living systems.  But Smiley must do it and so we discuss an example of starting the development phase. 
With the Smiley infrastructure and the application integrated the application's development phase is reviewed.
The association of structural Workspaces for state representation is discussed. 
The aggregation of schematic associations of codelets defines a development agent.  At the application level it processes the application's schematic strings. 
The schematic nature of the data processed by the test application suggests the use of an indirect integration framework.  This supports the binding of codelets to the schematic data and detecting and responding to the control operons. 
An application polymerase complex emerges. 
The codelets and supporting functions are included. 
development
it is part of a cascade initiated by devbuilder.  The slocbuilder initially accepts the sponsorship from devbuilder.  To do this the slocbuilder must report its operation back to the devbuilder.  It does this by writing a well-known descriptor model-()->casbound to the binder structural Workspace identified by signal routine 'binderp1'.  Devbuilder also knows of this structure and detects the report.  This interface uses schematic context to bound who participates.  binderp1 is schema specific - for example for development, or mergestreams.  The sponsor, in the case of development devbuilder, arranges that the schematic strings associated with the subsequent cascade participants have a shared concept in the first position of the schematic string.  For development this concept is <development>, while for the merge streams application it is <mergestreams>

Sponsor recipient transactions
Schematic sub group defined codelets can be protected transactionally is an operation which guarantees to complete a defined set of activities or return to the initial state.  For a fee the postal service will ensure that a parcel is delivered to its recipient or will return the parcel to the sender.  To provide the service it may have to undo the act of trying to deliver the parcel with a compensating action.  Since the parcel could be lost or destroyed the service may have to return an equivalent value to the sender. 
by including <tmbinding> '{recipient }builder' </tmbinding> after the memgroup string.  The Slipnet can also be used to associate a sponsor and transactionally protected recipients by addjhlstm, but transactions should be Workspace specific so this form of specifying transactional protection is less accurate.  The sponsor has access to the completion state (findtra (transid)) of each transactionally associated (transalloc allocates a transaction management element and id (transmgrid)) recipient.  Transactionally associated signals provide the recipient codelets with a transaction id (transid).  A signalling codelet can additionally associate transaction management context (transmgr) with its deployment operon sponsor WSO, and retrieve it on subsequent codelet launch (mapnonsubtotmgrid or mapsubtotmgrid).  Until all the recipients have completed, the sponsor, or an equivalent codelet, should continue to issue the sponsoring signal. 

The linkage of the actions of the sponsor and its recipients can continue across a transaction chain.  The effect is to make the processing of the codelets in the chain inter-dependent.  In particular codelets could deadlock if two transactionally protected codelets wait for each other to complete.  This required special infrastructure for sub-programs

Schematic sub-programs
A schematic sub-program is a codelet which is dedicated to operating on a specific workspace to perform some task for its parent.  The adaptive web framework's (AWF)
This page describes the Adaptive Web framework (AWF) test system and the agent programming framework (Smiley) that supports its operation. 
Example test system statements are included.  To begin a test a test statement is loaded into Smiley while Smiley executes on the Perl interpreter. 
Part of Smiley's Perl code focused on setting up the infrastructure is included bellow. 
The setup includes:
  • Loading the 'Meta file' specification,
  • Initializing the Slipnet, and Workspaces and loading them
  • So that the Coderack can be called. 
The Coderack, which is the focus of a separate page of the Perl frame then schedules and runs the codelets that are invoked by the test statement structures. 
Smiley
provides infrastructure and state representations to allow coordination between parent codelets and their sub-programs. 

Schematic sub-programs should operate with their own schematic context and cascade control (specific Workspaces, and goal suppression).  The same infrastructure: cascadesponsor, initschcon, notgcompleted, imasksupp, icskick, ifindupri, dropsalience; references a different set of schematic cascade control structures when it is providing an inversion supporting a sub-program. 
  • A sub-program initiator, such as ivalwbuilder, creates a sub-program specific cascade control Workspace with the associative string <schema> <partconstrained>.  
  • A sub-program initiator, such as ivalwbuilder, becomes the cascadesponsor of the sub-program rather than the program it operates within. 
  • When Initschcon is requested to deploy a specific structural Workspace with the post fix schematic string <selector> <schema> it must ensure that the structure is specific sub-program relative.  For example ivalbuilder must make such a request when it processes a gowithin signal.
  • Similarly ifindupri and dropsalience must cope with sub-program initiators that are cascade sponsors.  When ivalevaluator sets the priority of ivalbuilder on the Coderack it must check the suppressor state in the sub-program suppressor Workspaces using a special interface to ifindupri
Sub-program completion within sponsor recipient transactions
It turns out that the legitimate termination of a sub-program sponsor can remove the cascade driver maintaining sponsor recipient transactions unless the sponsoring sub-program codelet detects that other sub-program instances have cascade ownership whence it issues a notgcompleted to allow them to proceed.  subpcsponsor is true in this case. 

The sub-program completion codelet bcsubpc (evaluator, builder) must also ensure that it stimulates all siblings to operate and respond complete to the sponsor.  The stimulation results from the bcsubpc codelet issuing its transaction complete, even though other participants may not have completed.  The bcsubpcbuilder then waits for the other siblings of the transaction to complete before issuing its sub-program completion descriptor.  Other sub-program sibling's evaluator's, for example ivalwevaluator, should detect the sub-program complete and launch their builders.  The builders should then use the sub-program complete indicator to complete their transactions, for example ivalbuilder
Delaying the cascade sponsor
The cascade sponsor can ensure that it is re-launched periodically to guarantee that it can signal the cascade codelets.  But if it does this too frequently this will make it a significant competitor of the cascade codelets for the Coderack's resources, so the cascade codelets have a feedback mechanism to limit the competition when cascade signalling is not necessary for their successful operation.  The codelets use a shared suppressor Workspace to adapt to the changing situation. 

When a codelet requests to become a cascadesponsor,

A call by the cascade sponsor to notgcompleted can write a {notgcompleted} descriptor to the codelet's shared suppressor structure.  This acts as a target for other agents which will either mask the {notgcompleted} indicating that the schematic group needs more cascade sponsorship, or  if no codelet fails on executing, the descriptor will be used by the deployment infrastructure (nsdepbuilder) as a
Agents use sensors to detect events in their environment.  This page reviews how these events become signals associated with beneficial responses in a complex adaptive system (CAS).  CAS signals emerge from the Darwinian information model.  Signals can indicate decision summaries and level of uncertainty. 
signal
to add a {backoff} descriptor. 
Delaying the notgcompleting cascade participant
When a participant codelet notgcompletes it may be because its evaluator decided the environment did not justify its running currently.  If it is notgcompleted, it is likely that it will group complete before other siblings that are still being deployed for the first time by the deployment infrastructure.  Rather than compete fruitlessly with the deployment system a delay is imposed by notgcomplete's adding a {delayselect} descriptor to the schematic sponsor WSO which is converted by groupbuilder into a wait in submitting the codelet to the Coderack's run queue. 
Wait and relay
The cascade participants may need to coordinate completion of some descriptions.  This is possible since codelets can wait for descriptors to complete.  A schematic string is associated with the wait and relay Workspace using initschwariwaitarelays will wait for a set of descriptors (one must be present on each of the schematic strings associated with the Workspace) to be deployed before it issues its signal.  In effect it becomes a wait and relay signal from its sponsor. 

Maintaining the cascade's resource pools
The essential supplies required to sustain the cascade are:
Indirect associations of a transaction is an operation which guarantees to complete a defined set of activities or return to the initial state.  For a fee the postal service will ensure that a parcel is delivered to its recipient or will return the parcel to the sender.  To provide the service it may have to undo the act of trying to deliver the parcel with a compensating action.  Since the parcel could be lost or destroyed the service may have to return an equivalent value to the sender. 
services manager
A transaction manager provides support to ensure the resources are independent & equivalent

The cascade dynamics are regulated by the re-actions of the participants to
Agents use sensors to detect events in their environment.  This page reviews how these events become signals associated with beneficial responses in a complex adaptive system (CAS).  CAS signals emerge from the Darwinian information model.  Signals can indicate decision summaries and level of uncertainty. 
signals
, with the aim of ensuring that the
Flows of different kinds are essential to the operation of complex adaptive systems (CAS). 
Example flows are outlined.  Constraints on flows support the emergence of the systems.  Examples of constraints are discussed. 
resource pools
do not become depleted. 

In addition the application codelets, and transient schemata, have transactional protection (transalloc), that inhibits the schemata destruction codelets (scout, evaluator, builder) and freecodelet from acting when the working set of codelets would be damaged. 

Protected codelets and schemata must be released for potential destruction once they leave the working set (freetra). 

Transaction management provides an assurance that a sponsored codelet will remain active until it executes.  As such the procedures enabling integration of codelets with transaction management are candidates for the
Plans change in complex adaptive systems (CAS) due to the action of genetic operations such as mutation, splitting and recombination.  The nature of the operations is described. 
genetic operation - inversion
:
  • gettransstate - gets the transaction manager state representation of a codelet. 
  • updatetransstate - synchronizes the state changes of an active codelet and the representation. 
However, the dynamic requirements mean that transactional protection is not sufficient on its own to ensure the maintenance of useful activity. 
Adaptation to pheromone descriptors
Within the schematic application
This page discusses how a Smiley based application the event processor test program's operational phase is structured. 
The goals of the event processor test application are described. 
The implementation strategy is outlined. 
Synchronization of Smiley setup completion and operation phase initiation is discussed. 
The association of structural Workspaces for state representation is discussed. 
An application specific codelet merge streams assert responds to the nature of the assertion.  It does not have an emergent structure.  Instead it reflects software engineering practice.  It includes:
  • Merge stream case specific
    • Modeling with sub-programs
    • Resolving of case
  • Non case assertion
The operation is setup, inhibited, initiated, and managed by iterative phase check-pointing provided by Smiley codelets. 
Schematic synchronization of parallel codelet cascades is performed structurally. 
The assert merge operon cascade is included. 
The Slipnet concept network for merge streams is included. 
The codelets and supporting functions are included. 
assert process merge
the endlistkw codelet, bcsubps codelet, bcsubpc codelet and ivalw codelet engage in adaptive cooperation, to support their mutual cascade, by minimizing the competition for infrastructure resources.  Note the process should be, but is not,
Plans emerge in complex adaptive systems (CAS) to provide the instructions that agents use to perform actions.  The component architecture and structure of the plans is reviewed. 
schematically
Plans change in complex adaptive systems (CAS) due to the action of genetic operations such as mutation, splitting and recombination.  The nature of the operations is described. 
driven


The endlistkw codelet deploys a {model} -({found})-> {endlistkwevaluator} when it reaches the end of a list, or end of substream.  The bcsubpc does likewise if it detects the end of sub stream.  bcsubps codelets will wait for this signal before becoming active. 

Once active the bcsubps codelet maintains the cascade signalling an ivalw codelet and bcsubpc codelet.  Once deployed the ivalw codelet conditionally writes a {wascompletingf1} -(subpid number)-> subpid number descriptor if it sets up an additional 'inner' sub-program.  That inner sub-program must complete before the sponsoring ivalw and its partner bcsubpc codelets can complete.  The bcsubps, which sponsored the 'outer' sub-program's ivalw codelet, looks for the {wascompletingf1} descriptor.  If found the bcsubps codelet can wait for the ivalw codelet to turn the descriptor into a {completingf1} descriptor prior to signalling this 'outer' sub-program further. 

Once inner sub-programs have been detected by the bcsubpc codelet it waits for the completion signal of the inner sub-programs.

#
    my ($pconc, $jhlsid);
# waropbindtobis

# setup the binding string for the wait and relay operon
    $Awfif::memes-> {maxoper}++; $jhlsid = 0;
    $pconc = Awfif::pconc ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnc} [$Awfif::memes-> {snnh} {waitarelay}] [0], $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnc} [$Awfif::memes-> {snnh} {waitarelay}] [1], 8, $Awfif::memes-> {currentwsbi});
    $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}
      [$pconc] = Awfif::newnlink ($Awfif::memes-> {snnh} {attrib}, Awfif::addjhlst ($Awfif::memes-> {snnh} {waitarelay}, $pconc, 1, $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$pconc], $pconc), $pconc,
                  $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$pconc]);
    &Awfif::addjhlattribs ($pconc, $Awfif::memes-> {snnh} {waitarelay}, $Awfif::memes-> {snnh} {schema}, $Awfif::memes-> {snnh} {integration}, $Awfif::memes-> {snnh} {attribr});

Functions

#<!-- start tag vbt -->
#<!-- start tag phe -->
#
sub findcounter {# find an iterator tagged descriptor
# could be different in each subprogram. In that case the transaction manager id will exist and match element 11 if rolled in or its complement if rolled out
# but the parameters subpid atelhwsoid and active should typically only be used by rolein or roleout code
# masking is conventionally supported by adding 1 to the structure
    my ($linksi, $structure, $arcounter, $tooconc, $typeconc, $subpid, $atelhwsoid, $active) = @_;#
    my ($structpresent, $linki, $transmgrid);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findcounter linksi $linksi ");
      if ( (defined ($subpid))
      && (defined ($atelhwsoid))
      && (defined ($active))
      ){
        print ("subpid $subpid atelhwsoid $atelhwsoid active $active ");
        };#if
      };#if
    $structpresent = "";
    $$arcounter = 0;
    if ((defined ($subpid)) && (defined ($atelhwsoid)) && (defined ($active))) {

      $transmgrid = mapsubtotmgrid ($atelhwsoid, $Awfif::memes-> {snnh} {rtran}, $subpid);
      $transmgrid = $transmgrid * $active;#caller should know if need to match a hidden or active counter
      };
    $linki = $linksi;#the head attribute
# all objects should have at least one descriptor - but ....
    if ($linki != 0) {# at least one descriptor for this object

      while (($linki != 0) && (!($structpresent))) {
        if ( (
          ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
          or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0))
          or (!defined ($transmgrid)) )
        && ((defined ($typeconc)) && (defined ($tooconc) ))
        ){
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [3] == $typeconc)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          && ($Awfif::workspace-> {l} [$linki] [2] == ($tooconc + $Awfif::memes-> {snnh} {wsi}))
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          }#if
        elsif ( (
          ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
          or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0))
          or (!defined ($transmgrid)) )
        && ((defined ($typeconc)) && (!defined ($tooconc) ))
        ){
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [3] == $typeconc)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          }#if
        elsif ( (
          ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
          or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0))
          or (!defined ($transmgrid)) )
        && (defined ($tooconc) )
        ) {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          && ($Awfif::workspace-> {l} [$linki] [2] == ($tooconc + $Awfif::memes-> {snnh} {wsi}))
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          }#if
        elsif (
        ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
        or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0)) #there is an inactive shell that can be updated by rolein with the transmgrid
        or (!defined ($transmgrid))
        ) {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          };#elsif
        $linki = $Awfif::workspace-> {l} [$linki] [0];
        };#while
      };# there are descriptors to check
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findcounterx arcounter $$arcounter ret ($structpresent)\n");
      };
    return $structpresent
    }# findcounter
#
#<!-- end tag phe -->
#<!-- end tag vbt -->
#<!-- start tag uts -->
#
sub listcounters {# type structure i.e. bond or group
    my ($linksi, $structure, $arlist, $typeconc) = @_;#
    my ($structpresent, $linki);
# check this workspace object for counters (iterator) and record in a list
# does not seem to be used validly
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listcounters linksi $linksi ");
      };
    $structpresent = "";
    $$arlist[0] = 0;
    $linki = $linksi;#the head attribute
# all objects should have at least one descriptor - but ....
    if ($linki != 0) {# at least one descriptor for this object

      while (($linki != 0) ) {
        if ((defined ($typeconc) ) ) {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [3] == $typeconc)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
            ){

            $structpresent = "T";
            $$arlist [++ $$arlist [0]] = $linki;
            };#if
          }#if
        else {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
            ){

            $structpresent = "T";
            $$arlist [++ $$arlist [0]] = $linki;
            };#if
          };#else
        $linki = $Awfif::workspace-> {l} [$linki] [0];
        };#while
      };# there are descriptors to check
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listcounters arlist $$arlist[0] ret ($structpresent)\n");
      };
    return $structpresent
    }# listcounters
#<!-- end tag uts -->
#<!-- start tag ctr -->
#
sub addtra {
    my ($myli, $jhls)=@_;
    my ($linki, $i);
# allocate a list element to a transaction

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addtra jhls $jhls ");
      }
    $linki = addli (\$Awfif::tral);
    $Awfif::tral-> {l}[$linki][3] = $Awfif::codelet-> {l} [$myli] [2];
    $Awfif::tral-> {i}[$linki][0] = $Awfif::jhls-> {l} [$jhls][18][0];
    if ($Awfif::memes-> {tral}++ < 0) {

      $Awfif::memes-> {tral} = 1;
      };#if
    $Awfif::tral-> {l}[$linki][4] = $Awfif::memes-> {tral};
# tral-> {l} [5] is the current subprogram codeletid to be applied in applycodelet
    if (defined ($myli) ){#for debug purposes leave a trail of sponsor schematic addresses

      $Awfif::tral-> {l} [$linki] [6] = $Awfif::codelet-> {l} [$myli] [21];
      };#if
    for ($i = 1; $i <= $Awfif::jhls-> {l} [$jhls][18][0]; $i++) {
      $Awfif::tral-> {i}[$linki][$i] = $Awfif::jhls-> {l} [$jhls][18][$i];
      $Awfif::tral-> {w}[$linki][$i] = $Awfif::memes-> {snnh} {incomplete};
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addtrax ret $linki\n");
      };# trace
    return $linki
    }; #addtra
#
#<!-- end tag ds -->
#
sub freetra {
    my ($linki)=@_;
    my ($cwsi, $atelni, $hcodelet);
# free a list element from a transaction
# checked for merged workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freetra linki $linki ");
      }
    $cwsi = $Awfif::memes-> {currentwsbi};
    &freeli ($linki, \$Awfif::tral);
    $Awfif::tral-> {i}[$linki] = undef();
    $Awfif::tral-> {w}[$linki] = undef();
    $Awfif::tral-> {l} [$linki] [3] = undef();
    $Awfif::tral-> {l} [$linki] [4] = undef();
    if (defined ($Awfif::tral-> {l} [$linki] [6]) ){

      $Awfif::tral-> {l} [$linki] [6] = undef();
      };#if
    if ((defined ($Awfif::tral-> {l} [$linki] [5])) && ($Awfif::tral-> {l} [$linki] [5] != 0)) {
# the codelet should be moved back into the free list

      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l}[$Awfif::tral-> {l} [$linki] [5]] [20];
      $atelni = awsoadr (trwsoadr ($Awfif::codelet-> {l}[$Awfif::tral-> {l} [$linki] [5]] [21], -1));
# and the schemata can be deleted
      $Awfif::wsol-> {l} [$atelni][2]
        = setupdesc ( $Awfif::memes-> {snnh} {destroyok},
            ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$Awfif::tral-> {l} [$linki] [5]] [30]),
            $Awfif::memes-> {snnh} {telomere},
            $Awfif::wsol-> {l} [$atelni][2],
            $atelni);
      $hcodelet = $Awfif::tral-> {l} [$linki] [5];
      $Awfif::tral-> {l} [$linki] [5] = mhcodelettoactltail ($Awfif::tral-> {l} [$linki] [5]);#move the codelet to the tail of the active list
      $Awfif::codelet-> {l}[$hcodelet] [34] = 0;#allow this codelet to be freed
      &freecodelet ($hcodelet, 1);
      if ($Awfif::tral-> {l} [$linki] [5] != 0) {

        &break();
        }#if
      else {

        $Awfif::tral-> {l} [$linki] [5] = undef();
        };#else
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freetrax ret $linki\n");
      };# trace
    }; #freetra
#
sub findtra {# type structure i.e. bond or group
    my ($transid, $completed, $builder, $index) = @_;#
    my ($structpresent, $linki, $i, $found, $transelement, $result);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findtra transid $transid completed ($completed) ");
      };
    $structpresent = 0;
    $result = 0;
    if (defined ($$index)) {

      $$index = 0;#indicates no index assigned not index 0
      };#if
    $linki = $Awfif::tral->{h};#the head attribute
    if ($linki != 0) {#

      while (($linki != 0) && (($structpresent == 0))) {
        if (($linki == $transid)){

          $structpresent = $linki;
          $transelement = $linki;
          $result = $linki;
          };#if
        $linki = $Awfif::tral-> {l} [$linki] [0];
        };#while
      if (($structpresent != 0) && (defined ($completed)) && ($completed)) {#if checking that transaction complete then true if no items are incomplete

        for ($i = 1; (($structpresent != 0) && ($i <= $Awfif::tral-> {i} [$structpresent] [0])); $i++) {
          if ($Awfif::tral-> {w} [$structpresent] [$i] == $Awfif::memes-> {snnh} {incomplete}) {

            $structpresent = 0;
            $result = 0;
            };#if
          };#for
        }#if
# findtrau1
      elsif (($structpresent != 0) && (defined ($completed)) && (!$completed) && (defined ($builder))) {#if checking that builder incomplete then true if matches & status incomplete

        $found = '';
        for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i} [$structpresent] [0])); $i++) {
          if ( ($Awfif::tral-> {w} [$structpresent] [$i] == $Awfif::memes-> {snnh} {incomplete})
          && ($Awfif::tral-> {i} [$structpresent] [$i] eq $builder)
          ){

            $found = 't';
            $result = $structpresent;
            if (defined ($$index)) {

              $$index = $i;
              };#if
            };#if
          };#for
        };#elsif
      };#if there are descriptors to check
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr1, $pr2);
      print ("findtrax ");
      for ($i = 1; $i <= $Awfif::tral-> {i} [$transelement] [0]; $i++) {
        $pr1 = $Awfif::tral-> {i} [$transelement] [$i];
        $pr2 = $Awfif::memes-> {snnih} {$Awfif::tral-> {w} [$transelement] [$i]};
        print ("t element $pr1 ($pr2) ");
        };#for
      if (defined ($$index)) {
        print ("index $$index ");
        };#if
      print ("ret ($result)\n");
      };
    return $result
    }# findtra
#
#<!-- start tag sia -->
#<!-- start tag scc -->
#
sub matchgsubtrans {# given a subpid and sub name string find the global subtrans (tral slice i and index) that the codelet is aiming to complete
    my ($myli, $subpid, $builder, $index, $transid) = @_;#
    my ($i, $i11, $found, $result);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchgsubtrans myli $myli subpid $subpid builder $builder ");
      if (defined ($transid)) {
        print ("transid $transid ");
        };#if
      };
    $result = 0;
    $$index = 0;#indicates no index assigned not index 0
    $found = '';
    if (($subpid > 0)
    && (builderini ($myli, $subpid, $builder) )
    ){

      for ($i11 = 1;((!$found) && ( $i11 <= $Awfif::subpl-> {l} [$subpid] [11] [0]));$i11++) {

        for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11] [$i11]] [0])) ; $i++) {
          if ($Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11] [$i11]] [$i] eq $builder) {

            $result = $Awfif::subpl-> {l} [$subpid] [11] [$i11];
            $found = 't';
            $$index = $i;
            };#if
          };#for each sub-transaction responder
        };#for check each part of the global transaction
      }#if this has subpids
    elsif ( (defined ($transid)) && ($transid > 0)
    && ($subpid > 0)
    ){#non mainline subprogram

      for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i}[$transid] [0])) ; $i++) {
        if ($Awfif::tral-> {i}[$transid] [$i] eq $builder) {

          $result = $transid;
          $found = 't';
          $$index = $i;
          };#if
        };#for each sub-transaction responder
      }#else
    elsif ( (defined ($transid)) && ($transid > 0)
    ){#main program

      for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i}[$transid] [0])) ; $i++) {
        if ($Awfif::tral-> {i}[$transid] [$i] eq $builder) {

          $result = $transid;
          $found = 't';
          $$index = $i;
          };#if
        };#for each sub-transaction responder
      };#else
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchgsubtransx index $$index ret ($result) \n");
      };
    return $result
    }# matchgsubtrans
#
sub builderini {# given a subpid and sub name string find the global subtrans (tral slice i and index) that the codelet is aiming to complete
    my ($myli, $subpid, $builder) = @_;#
    my ($i, $i11, $found, $result);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("builderini myli $myli subpid $subpid builder $builder ");
      };
    $result = 0;
    $found = '';

    for ($i11 = 1;((!$found) && ( $i11 <= $Awfif::subpl-> {l} [$subpid] [11] [0]));$i11++) {

      for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11] [$i11]] [0])) ; $i++) {
        if ($Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11] [$i11]] [$i] eq $builder) {

          $found = 't';
          };#if
        };#for each sub-transaction responder
      };#for check each part of the global transaction
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("builderinix ret ($found) \n");
      };
    return $found
    }# builderini
#
#<!-- start tag ds -resweb -->
#
sub addsamet {
    my ($myli, $activetransid, $atelhwso)=@_;
    my ($linki);
# allocate a list element to a transaction

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addsamet myli $myli activetransid($activetransid) atelhwso($atelhwso) ");
      }
    if ( !defined ($Awfif::tral-> {sameash} [$activetransid ]) ){

      $Awfif::tral-> {sameash} [$activetransid ] = 0;
      $Awfif::tral-> {sameast} [$activetransid ] = 0;
      };#if

    $linki = addli (\$Awfif::sametl, \$Awfif::tral-> {sameash}[ $activetransid ], \$Awfif::tral-> {sameast}[ $activetransid ]);
    if (($Awfif::memes-> {checkzsameas}) && ($Awfif::codelet-> {l} [$myli] [35] == 0)){&break ()};
    $Awfif::sametl-> {l} [$linki] [2] = $Awfif::codelet-> {l} [$myli] [35]; #record a reference to the new transaction
# now if there is a previous entry linked to this one which has any items set to valid copy the validity across
    if ($Awfif::sametl-> {l} [$linki][0] > 0) {

      &addtmatch ($myli, $linki, $atelhwso);
      };# if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addsametx ret $linki\n");
      };# trace
    return $linki
    }; #addsamet
#
sub freesamet {
    my ($linki, $activetransid)=@_;
    my ($cwsi);
# free a list element from a transaction
# checked for merged workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freesamet linki $linki ");
      }
    $cwsi = $Awfif::memes-> {currentwsbi};
    &freeli ($linki, \$Awfif::sametl, \$Awfif::tral-> {sameash}[ $activetransid ], \$Awfif::tral-> {sameast}[ $activetransid ]);
    $Awfif::sametl-> {l} [$linki] [2] = undef();
    $Awfif::memes-> {currentwsbi} = $cwsi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freesametx ret $linki\n");
      };# trace
    }; #freesamet
#
#<!-- end tag ds -->
#
sub bugroup1 {
    my($myli, $i, $kwp, $kwpr, $change1, $fullsalience)=@_;
    my($i2, $result, $snnind, $linki, $allcomplete, $groupspresent, $ai, $amplifier);
# Group will be a bit different. It wants to identify objects with deployed bonds
# AND group relations rather than typical salience
#
# if all groups that affect i are completed the salience of i should be 1
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      print ("bugroup1 myli = $myli, i $pr:$i kwp($kwp) kwpr($kwpr) ");
      if (defined ($fullsalience)) {
        print ("fullsalince ($fullsalience) ");
        };#if
      };
    $$change1 = '';
    $i2 = 0;
    $ai = awsoadr ($i);
# check if all the groups this wso is a part of are completed
    $allcomplete = '';
    $groupspresent = '';

    if (!($groupspresent)) {
      my ($sgdi, $gsponsor,);

      if ((fgrpd ($myli,
        $i,
        \$sgdi,
        $Awfif::memes->{snnh} {groupcategory} ))
      && ($groupspresent = 't')
      && (($gsponsor =
        fgrpsponsor ($i,
        $Awfif::workspace-> {l} [$sgdi] [3],
        $Awfif::memes-> {snnh} {groupcategory})) != 0)
      && (gcompleted ($gsponsor)
      )) {# completed group

        $allcomplete = 't';
        };#if
      };#if
# if they are don't allocate any salience
    if (($allcomplete)
    && ( (!defined($fullsalience)) or (!$fullsalience) )
    ) {

      $i2 = 1;
      }#if all complete
    else {
# see if can use cache
# bugroup1wsbf1
      if (checkwsbf ($ai, 28) == 1) {

        $i2 = $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsobug}];#*** submacrok ***#
        }#if
      else {#need to work through calculations
# setup loop for group category children & then for bond category children
        $linki = $Awfif::wsol-> {l} [$ai] [2]; #head
        while ($linki != 0) {

          $snnind = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::memes-> {snnh} {bondcategory}];
          $i2 = $i2 + gbocc ($i, $linki, $snnind, $Awfif::memes-> {strbcont});
          $snnind = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::memes-> {snnh} {groupcategory}];
          $i2 = $i2 + gbocc ($i, $linki, $snnind, $Awfif::memes-> {strbcont});
# for now I won't add this to the top down strategy

          if ($Awfif::wsol-> {l} [$ai][6] < $Awfif::memes-> {bugsmax}) {

            $i2 = $i2 + $Awfif::wsol-> {l} [$ai][6];#hopefully help squeekers
            }#if
          else {

            $i2 = $i2 + $Awfif::memes-> {bugsmax};
            };#else

          $linki = $Awfif::workspace-> {l} [$linki] [0]; #walk back from head
          }
# bugroup1ampu1
# implement any amplification

        $amplifier = ampdesc ($myli, $i);
        if ($amplifier >1) {

          $i2 = $i2 * ($amplifier * $Awfif::memes-> {ampramp});
          };#if
        };#else
# setup descriptor cache

      $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsobug}] = $i2;#*** submacrok ***#
      &setwsbf ($ai, 28, 1);
      };#else

    $result = $i2;
    if (($result <= 0) && (!$allcomplete)) {

      $result = 1;
      }

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("bugroup1 ret $result\n");
      };
    return $result
    }# bugroup1

#
sub tdgroup1 {
    my($myli, $i, $kwp, $kwpr, $change1, $fullsalience)=@_;
    my($i2, $result, $snnind, $linki, $allcomplete, $groupspresent, $ai, $amplifier, $transmgrid);
# Group will be a bit different. It wants to identify objects with deployed bonds
# AND group relations rather than typical salience
#
# if all groups that affect i are completed the salience of i should be 1
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      print ("tdgroup1 myli = $myli, i $pr:$i kwp($kwp) kwpr($kwpr) ");
      if (defined ($fullsalience)) {
        print ("fullsalince ($fullsalience) ");
        };#if
      };

    $$change1 = '';
    $i2 = 0;
    $ai = awsoadr ($i);
    if ( (defined($fullsalience)) && ($fullsalience > 0) ) {

      $transmgrid = $fullsalience;
      };#there is a specific transmgrid assigned
# check if all the groups this wso is a part of are completed

    $allcomplete = '';
    $groupspresent = '';

        if (!($groupspresent)) {
          my ($sgdi, $gsponsor,);

          if ((fgrpd ($myli, $i, \$sgdi, $Awfif::memes->{snnh}{groupcategory}))
          && ($groupspresent = 't')
          && (($gsponsor = fgrpsponsor ($i, $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory})) != 0)
          && (($$change1 = gcompleted ($gsponsor, $transmgrid)) or (linkeddsalience ($gsponsor)))
          ){# completed group

            $allcomplete = 't';
            };
          };

# if they are don't allocate any salience
    if (($allcomplete) && ((!defined($fullsalience)) or ($fullsalience < 0)) ) {

      $i2 = 1;
      }#if all complete
    else {
# see if can use cache
# tdgroup1wsbf1
      if (checkwsbf ($ai, 25) == 1) {
        $i2 = $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsotdg}];#*** submacrok ***#
        }#if
      else {#need to work through calculations
# setup loop for group category children & then for bond category children
        $linki = $Awfif::wsol-> {l} [$ai] [2]; #head

        while ($linki != 0) {

          $snnind = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::memes-> {snnh} {bondcategory}];
          $i2 = $i2 + gbocc ($i, $linki, $snnind, $Awfif::memes-> {strbcont});
          $snnind = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::memes-> {snnh} {groupcategory}];
          $i2 = $i2 + gbocc ($i, $linki, $snnind, $Awfif::memes-> {strbcont});
          $linki = $Awfif::workspace-> {l} [$linki] [0]; #walk back from head
          }
# tdgroup1ampu1
# implement any amplification

        $amplifier = ampdesc ($myli, $i);
        if ($amplifier >1) {

          $i2 = $i2 * ($amplifier * $Awfif::memes-> {ampramp});
          };#if
        };#else
# setup descriptor cache
# tdgroup1253u1
      if (checkwsbf ($ai, 25) != 3) {indicates that this wso salience must not be cached since part of the value is generated dynamically
        $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsotdg}] = $i2;#*** submacrok ***#
        &setwsbf ($ai, 25, 1);
        };#if
      };#else

    $result = $i2;
    if (($result <= 0) && (!$allcomplete)) {
      $result = 1;
      }

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tdgroup1 change1 $$change1 ret $result\n");
      };
    return $result
    }# tdgroup1

#
#<!-- start tag aso -->
#<!-- start tag uts -->
#
sub notgcompleted {
    my($myli, $gsoid, $teltwso, $esupp, $strategy, $dontamp, $stws, $issubp, $subp, $nodebug, $nodelayselect, $delayselamp, $usepooling, $notracking)=@_;
    my ($found, $linki, $gslinki, $gelinki, $agsoid, $gs, $ge, $istrategy, $cwsbi, $kwp, $kwpr);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notgcompleted gs id $gsoid ");
      if (defined ($usepooling)){
        print ("usepooling($usepooling) ");
        };#if
      };
# look for a group start or end descriptors given a specific group sponsor wso
# updated for merged workspaces
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';
    if (!ngccltct($myli )) {

      $agsoid = awsoadr ($gsoid);
      if ( $Awfif::wsol-> {l}[$agsoid][ $Awfif::memes-> {wsogcsponsor}] != 0){#*** submacrok ***#

        my ($ngcsponsor);
        $ngcsponsor =
          $Awfif::wsol-> {l}[$agsoid][ $Awfif::memes-> {wsogcsponsor}]; #*** submacrok ***#

        if (($Awfif::memes-> {notgcngcspbreak}) && ($ngcsponsor != 0) && ($Awfif::memes-> {currentwsbi} == 3)) {&break ()};
        $Awfif::wsol-> {l}[$agsoid][ $Awfif::memes-> {wsogcsponsor}] = 0;#*** submacrok ***#
        };
      &isetupdescc ($agsoid);
      $linki = $Awfif::wsol-> {l} [$agsoid][2];

# all objects should have at least one descriptor - but ....
      if ($linki != 0) {# at least one descriptor

        $gs = 0;
        $ge = 0;

        while (($linki != 0)
        && (($gs == 0)
        or ($ge == 0))
        ){

# if a group has completed reduce the salience of the group
          if (($Awfif::memes-> {snnh} {groupstart} == $Awfif::workspace-> {l} [$linki][4]) # in a key relation
          or ($Awfif::memes-> {snnh} {groupend} == $Awfif::workspace-> {l} [$linki][4])) {

            $found = 't';
            if ($Awfif::memes-> {snnh} {groupstart} == $Awfif::workspace-> {l} [$linki][4]) {

              $gs = ($Awfif::workspace-> {l} [$linki][2] - $Awfif::memes-> {snnh}{wsi});
              $gslinki = $linki;
              }#if
            else {

              $ge = ($Awfif::workspace-> {l} [$linki][2] - $Awfif::memes-> {snnh}{wsi});
              $gelinki = $linki;
              };# else
            $Awfif::workspace-> {l} [$linki][4] = $Awfif::workspace-> {l} [$linki][4] + 1;
            } # if
          elsif (($Awfif::memes-> {snnh} {wasgroupstart} == $Awfif::workspace-> {l} [$linki][4]) # in a key relation
          or ($Awfif::memes-> {snnh} {wasgroupend} == $Awfif::workspace-> {l} [$linki][4])) {

            $found = 't';
            if ($Awfif::memes-> {snnh} {wasgroupstart} == $Awfif::workspace-> {l} [$linki][4]) {

              $gs = ($Awfif::workspace-> {l} [$linki][2] - $Awfif::memes-> {snnh}{wsi});
              $gslinki = $linki;
              }#if
            else {

              $ge = ($Awfif::workspace-> {l} [$linki][2] - $Awfif::memes-> {snnh}{wsi});
              $gelinki = $linki;
              };# else
            }; # if

          $linki = $Awfif::workspace-> {l} [$linki][0];
          }; # while
        };# if

      if ($found) {
# notgctmgrampup1
        my ($ltransmgrid, $patelhwso, $activec, $from, $mask, $val);
        if ( (defined ($myli)) && ($Awfif::codelet-> {l} [$myli] [37] > 0) && ($Awfif::codelet-> {l} [$myli] [36] > 0)) {

          $ltransmgrid = $Awfif::codelet-> {l} [$myli] [37];
          $patelhwso = awsoadr (trwsoadr ($gs, -1));
          $activec = 1;
          $from = $Awfif::workspace-> {l} [$gslinki][4];
          if (getcmstate ($from) ) {

            $from--;
            };
          $mask = -1;
          $val = -1;
          &gettmgrdesc ($patelhwso, $Awfif::memes-> {snnh} {rtran}, $ltransmgrid, $from, \$mask, \$val);
          if ($mask >= 0) {
# update the gs descriptor to ensure that it matches this tranmgrid, and is active

            if ($Awfif::workspace-> {l} [$gslinki][11] != $ltransmgrid) {
# update the trans managed data if necessary to mask set

              $Awfif::workspace-> {l} [$gslinki][11] = $ltransmgrid;
              };#if
            if ($mask == 0) {

              $mask = 1;
              &updtmgrdesc ($patelhwso, $Awfif::memes-> {snnh} {rtran}, $ltransmgrid, $from, $mask, $Awfif::workspace-> {l} [$gslinki][9]);
              };#if
            }# if found an associated transaction for the gs descriptor
          else {#create a trans mgr descriptor association for gs descriptor
# update the gs descriptor to ensure that it matches this tranmgrid, and is active

            if ($Awfif::workspace-> {l} [$gslinki][11] != $ltransmgrid) {
# update the trans managed data if necessary to mask set

              $Awfif::workspace-> {l} [$gslinki][11] = $ltransmgrid;
              };#if

            $mask = 1;
            &addtmgrdesc ($patelhwso, $Awfif::memes-> {snnh} {rtran}, $ltransmgrid, $from, $mask, $Awfif::workspace-> {l} [$gslinki] [9]);
            };#else
          $from = $Awfif::workspace-> {l} [$gelinki][4];
          if (getcmstate ($from) ) {

            $from--;
            };
          $mask = -1;
          $val = -1;
          &gettmgrdesc ($patelhwso, $Awfif::memes-> {snnh} {rtran}, $ltransmgrid, $from, \$mask, \$val);
          if ($mask >= 0) {
# update the ge descriptor to ensure that it matches this tranmgrid, and is active

            if ($Awfif::workspace-> {l} [$gelinki][11] != $ltransmgrid) {
# update the trans managed data if necessary to mask set

              $Awfif::workspace-> {l} [$gelinki][11] = $ltransmgrid;
              };#if
            if ($mask == 0) {

              $mask = 1;
              &updtmgrdesc ($patelhwso, $Awfif::memes-> {snnh} {rtran}, $ltransmgrid, $from, $mask, $Awfif::workspace-> {l} [$gelinki][9]);
              };#if
            }# if found an associated transaction for the gs descriptor
          else {#create a trans mgr descriptor association for gs descriptor
# update the gs descriptor to ensure that it matches this tranmgrid, and is active

            if ($Awfif::workspace-> {l} [$gelinki][11] != $ltransmgrid) {
# update the trans managed data if necessary to mask set

              $Awfif::workspace-> {l} [$gelinki][11] = $ltransmgrid;
              };#if

            $mask = 1;
            &addtmgrdesc ($patelhwso, $Awfif::memes-> {snnh} {rtran}, $ltransmgrid, $from, $mask, $Awfif::workspace-> {l} [$gelinki] [9]);
            };#else
          };#if
# notgcudsel1
        if ( (!defined ($nodelayselect))
        || (!$nodelayselect)
        ){

          my ($ags, $counteri);
          $ags = awsoadr ($gs);
          $Awfif::wsol-> {l} [$ags][2]
            = inccounter (
              undef (),#pltype
              undef (),#pto
              $Awfif::memes-> {snnh} {delayselect}, #from
              $Awfif::wsol-> {l} [ $ags] [2],#dlinkh
# notgcutmgrdsel1
              $ags,#awso
              undef(),#synccod
              undef(),#sltype
              undef(),#spto
              $ltransmgrid,#transmgrid
              $patelhwso,#atelhwso
              $activec);#active
          &findcounter ($Awfif::wsol-> {l} [$ags][2], $Awfif::memes-> {snnh} {delayselect}, \$counteri);
# notgcdsampu1
          if ((defined ($delayselamp)) && ($delayselamp)) {

            $Awfif::workspace-> {l} [$counteri] [9] += ($Awfif::memes-> {wsi} + ($Awfif::memes-> {delayselcount} * $Awfif::memes-> {tdfsampds}));
            }#if
          else {

            $Awfif::workspace-> {l} [$counteri] [9] += ($Awfif::memes-> {wsi} + $Awfif::memes-> {delayselcount});
            };#else
          };#if
# notgcusupp1
# engage suppressor
        my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $gsws, $gswso, $agswso, $cwsbi2);
        if ( (defined ($esupp))
        && ($esupp)
        &&(ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@{$Awfif::memes-> {sactset}}, $stws, $issubp, $subp) == 1)
        ){#

          $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws, undef(), $stws, $subp);
          if ((defined ($strategy)) && ($strategy ne '')) {

            $istrategy = $strategy;
            }#if
          else {

            $istrategy = 'goalscon';
            };#else
          if ( (ifindb ($myli, 1, $istrategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@{$Awfif::memes-> {sactset}}, $gsws, $issubp, $subp) == 1)
          ){#

            $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws, $stws, $subp);
            $cwsbi2 = $Awfif::memes-> {currentwsbi};
            $Awfif::memes-> {currentwsbi} = $gsws;
            $agswso = awsoadr ($gswso);
            $Awfif::wsol-> {l} [$agswso][2]
              = inccounter (
                undef (),
                undef (),
                $Awfif::memes-> {snnh} {notgcompleted},
                $Awfif::wsol-> {l} [$agswso] [2],
                $agswso);
            $Awfif::memes-> {currentwsbi} = $cwsbi2;
            };#if goal suppressor present
          };#if
# change the status of all the wso in the group
        my ($reset38, $i, $ai, $ati);
# send activation to the gs wso

        $ai = awsoadr ($gs);
# notgcubmyli1
        $ati = awsoadr (trwsoadr ($gs, -1));
        if ( (!defined ($nodebug)) && ($Awfif::memes-> {breakmyli} == $myli) && ($Awfif::memes-> {bmbcindex} > 0) ){

          if ($Awfif::memes-> {breakmyli} == $Awfif::memes-> {breakcodelet} [$Awfif::memes-> {bmbcindex}]) {#remove only if not been replaced by submit

            &remarrent ($Awfif::memes-> {bmbcindex}, \@{$Awfif::memes-> {breakcodelet}});
            &remarrent ($Awfif::memes-> {bmbcindex}, \@{$Awfif::memes-> {breaksubp}});
            };#
          $Awfif::memes-> {breakthwso} [ ++$Awfif::memes-> {breakthwso} [0]] = $ati;
          $Awfif::memes-> {breakthsubp} [ ++$Awfif::memes-> {breakthsubp} [0]] = $Awfif::codelet-> {l} [$myli] [36];
          };#if

        if ( (!defined ($notracking) ) or (!$notracking) ){
          &trackcodelet ($myli, $myli, $Awfif::memes-> {snnh} {telomere}, undef(), $ati, $Awfif::codelet-> {l} [$myli] [36]);
          };#if
        &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), undef());
        $Awfif::wsol-> {l} [$ai][2]
          = inccounter (
            undef (),
            undef (),
            $Awfif::memes-> {snnh} {amplify},
            $Awfif::wsol-> {l} [$ai] [2],
            $ai,
            undef(),
            undef(),
            undef(),
            $ltransmgrid,
            $patelhwso,
            $activec);
# notgcusepoolu1

        if ((defined ($usepooling))
        && ($usepooling)
        && ($Awfif::codelet-> {l} [$myli] [38] > 1)
        ){

          my ($counteri);
          if (findcounter ($Awfif::wsol-> {l} [$ai] [2], $Awfif::memes-> {snnh}{amplify}, \$counteri) ){

            $Awfif::workspace-> {l} [$counteri] [9] += $Awfif::codelet-> {l} [$myli] [38];
            $reset38 = 't';
            };#if
          };#if
        &isetupdescc ($ai);
        &actnodes ( wsbasetype ($gs), $Awfif::memes-> {actth} + 10, (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        &invcaches (wsbasetype ($gs), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        if ( $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}] != 0){#*** submacrok ***#

          my ($ngcsponsor);
          $ngcsponsor =
            $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}]; #*** submacrok ***#

          if (($Awfif::memes-> {notgcngcspbreak}) && ($ngcsponsor != 0) && ($Awfif::memes-> {currentwsbi} == 3)) {&break ()};
          $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}] = 0;#*** submacrok ***#
          };
        for ($i = trwsoadr ($gs, 1);
        $i != $ge; $i = trwsoadr ($i,1)
        ) {
# send activation to the involved Slipnet nodes but this should just be a delta scope

          $ai = awsoadr ($i);
          &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), undef());
          $Awfif::wsol-> {l} [$ai][2]
            = inccounter (
              undef (),
              undef (),
              $Awfif::memes-> {snnh} {amplify},
              $Awfif::wsol-> {l} [$ai] [2],
              $ai);
# notgcusepoolu2

          if ((defined ($usepooling))
          && ($usepooling)
          && ($Awfif::codelet-> {l} [$myli] [38] > 1)
          ){

            my ($counteri);
            if (findcounter ($Awfif::wsol-> {l} [$ai] [2], $Awfif::memes-> {snnh}{amplify}, \$counteri) ){

              $Awfif::workspace-> {l} [$counteri] [9] += $Awfif::codelet-> {l} [$myli] [38];
              };#if
            };#if
          &isetupdescc ($ai);
          &actnodes ( wsbasetype ($i), $Awfif::memes-> {actth} + 10, (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
          &invcaches (wsbasetype ($i), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
          if ( $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}] != 0){#*** submacrok ***#

            my ($ngcsponsor);
            $ngcsponsor =
              $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}]; #*** submacrok ***#

            if (($Awfif::memes-> {notgcngcspbreak}) && ($ngcsponsor != 0) && ($Awfif::memes-> {currentwsbi} == 3)) {&break ()};
            $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}] = 0;#*** submacrok ***#
            };
          };#for
        if ($reset38) {

          $Awfif::codelet-> {l} [$myli] [38] = 1;#freecodelet should still do all the work when freeing this codelet
          };#if
        &isetupdescc (awsoadr ($ge));
        &actnodes ( wsbasetype ($ge), $Awfif::memes-> {actth} + 10, (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        &invcaches (wsbasetype ($ge), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
# notgcwscup
        &wsclinv (0, $Awfif::memes-> {currentwsbi}, $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]);# force the bottom-up group workspace cache to delta reset
        if ( $Awfif::wsol-> {l}[awsoadr ($ge)][ $Awfif::memes-> {wsogcsponsor}] != 0){#*** submacrok ***#

          my ($ngcsponsor);
          $ngcsponsor =
            $Awfif::wsol-> {l}[awsoadr ($ge)][ $Awfif::memes-> {wsogcsponsor}]; #*** submacrok ***#

          if (($Awfif::memes-> {notgcngcspbreak}) && ($ngcsponsor != 0) && ($Awfif::memes-> {currentwsbi} == 3)) {&break ()};
          $Awfif::wsol-> {l}[awsoadr ($ge)][ $Awfif::memes-> {wsogcsponsor}] = 0;#*** submacrok ***#
          };
        }#if
      elsif (($teltwso ne '') && ($teltwso != 0)) {
# send activation to the involved Slipnet nodes but this should just be a delta scope
# deploy an amplification descriptor in the real schema wsos
# notgctmgrampup2

        my ($i, $ai, $ltransmgrid, $patelhwso, $activec);
        if (($Awfif::codelet-> {l} [$myli] [37] > 0) && ($Awfif::codelet-> {l} [$myli] [36] > 0)) {

          $ltransmgrid = $Awfif::codelet-> {l} [$myli] [37];
          $patelhwso = awsoadr (trwsoadr ($gsoid, -1));
          $activec = 1;
          };#if

        $ai = awsoadr ($gsoid);
        &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {allwsstr} ^ $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bustatement}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), undef());
        if ((!defined ($dontamp)) or ((defined ($dontamp)) && (!$dontamp))) {

          $Awfif::wsol-> {l} [$ai][2]
            = inccounter (
              undef (),
              undef (),
              $Awfif::memes-> {snnh} {amplify},
              $Awfif::wsol-> {l} [$ai] [2],
              $ai,
              undef(),
              undef(),
              undef(),
              $ltransmgrid,
              $patelhwso,
              $activec);
          };#if

        my ($ngcsponsor);
        $ngcsponsor =
          $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}]; #*** submacrok ***#

        if (($Awfif::memes-> {notgcngcspbreak}) && ($ngcsponsor != 0) && ($Awfif::memes-> {currentwsbi} == 3)) {&break ()};
        $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}] = 0;#*** submacrok ***#
        for ($i = trwsoadr ($gsoid, 1);
        $i != $teltwso;
        $i = trwsoadr ($i,1)) {
# send activation to the involved Slipnet nodes but this should just be a delta scope
# deploy an amplification descriptor in the real schema wsos

          $ai = awsoadr ($i);
          &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {allwsstr} ^ $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bustatement}]) | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), undef());
          if ((!defined ($dontamp)) or ((defined ($dontamp)) && (!$dontamp))) {

            $Awfif::wsol-> {l} [$ai][2]
              = inccounter (
                undef (),
                undef (),
                $Awfif::memes-> {snnh} {amplify},
                $Awfif::wsol-> {l} [$ai] [2],
                $ai);
            };#if
          $ngcsponsor =
            $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}]; #*** submacrok ***#

          if (($Awfif::memes-> {notgcngcspbreak}) && ($ngcsponsor != 0) && ($Awfif::memes-> {currentwsbi} == 3)) {&break ()};
          $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsogcsponsor}] = 0;#*** submacrok ***#
          };#for
        }#elsif
      else {

        &break ();#should not get this situation
        };#else
      };#if did not reach threshold

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notgcompletedx ret ($found)\n");
      };

    return ($found)
    }# notgcompleted
#<!-- end tag uts -->
#<!-- end tag aso -->
#
sub promotesib {
    my($myli)=@_;
    my ($sponsor, $asponsor, $thead, $athead, $nws, $nst, $nend, $operons, $biceid, $cwsbi, $found, $iedesc, $jhlsi, $njhlsi, $linki, $i3, $i4, @matches, @matchni, @matchne, $endmatch);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("promotesib ");
      &itcpoutput ($myli);
      };
# Use context to find parent and hence all schematic siblings
# updated for merged workspaces
    $endmatch = '';
    $found = '';
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {tdfsampdo}) {#inhibit promotesib since this and its brothers/sisters are hogging the coderack
      $endmatch = 't';#so no masking of suppressors
      }#if
    else {#
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l}[ $myli] [20] ;
    $sponsor = $Awfif::codelet-> {l}[ $myli][21] ;
    $asponsor = awsoadr ($sponsor);
    $linki = $Awfif::wsol-> {l} [$asponsor][2];

# all objects should have at least one descriptor - but ....
    if (($Awfif::memes-> {doprsib}) && ($linki != 0)) {# at least one descriptor

      while ((!$found) && ($linki != 0)) {

        if ( ( ($iedesc = findtdesc ($Awfif::wsol-> {l} [ $asponsor ] [2], $Awfif::memes-> {snnh} {indequiv})) != 0 )
        && ( ($jhlsi = ($Awfif::workspace-> {l} [$iedesc] [2] - $Awfif::memes-> {snnh} {wsi})) != 0 )
        && ($Awfif::jhls-> {l} [$jhlsi] [15][1])
        && (defined ($Awfif::jhls-> {l} [$jhlsi] [16][2]))
        ){

          $found = 't';
          $biceid = $Awfif::jhls-> {l} [$jhlsi] [16][2];
          }; # if
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }; # while
      };# if
    $thead = trwsoadr ($sponsor,-1) ;
    $athead = awsoadr ($thead);
    $linki = $Awfif::wsol-> {l} [$athead][2];

# all objects should have at least one descriptor - but ....
    if (($found) && ($linki != 0)) {# at least one descriptor

      $found = '';
      while ((!$found) && ($linki != 0)) {

        if ( ( ($iedesc = findtdesc ($Awfif::wsol-> {l} [ $athead ] [2], $Awfif::memes-> {snnh} {mindequiv})) != 0 )
        && ( ($njhlsi = ($Awfif::workspace-> {l} [$iedesc] [2] - $Awfif::memes-> {snnh} {wsi})) != 0 )
        && (defined ($Awfif::jhls-> {l} [$njhlsi] [7]))# start of subgroup
        ){

          $found = 't';
          $nws = $Awfif::jhls-> {l} [$njhlsi] [7];
          $nst = $Awfif::jhls-> {l} [$njhlsi] [8];
          $nend = $Awfif::jhls-> {l} [$njhlsi] [9];
          $operons = $Awfif::jhls-> {l} [$njhlsi] [14] [1];
          }; # if
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }; # while
      };# if
    if (($found) && (defined ($operons))) {# at least one descriptor

      my ($i, $i2, $operonb, @operonbs, $failed);
      $found = '';
# first mark out the operon schemata
      $Awfif::memes-> {currentwsbi} = $nws;
      $operonb = trwsoadr ($operons,1);
      $operonbs[0] = getwsost4 ($operonb);
      $i2 = 1;
      for ($i = trwsoadr ($operonb,1) ;
      (($i != $Awfif::wsbl-> {wsoh}) && (!$found));
      $i = trwsoadr ($i, 1)) {
        if ( (getwsost4 ($i) ne $operonbs[0])
        ){

          $operonbs[$i2++] = getwsost4 ($i);
          }#if
        else {

          $found = 't';
          };#else
        };#for
      if ($found) {
# now with the operon schemata look for all matches within the nuclear workspace

        if ((defined ($Awfif::memes-> {fjhls8})) && ($Awfif::memes-> {fjhls8} != 0)
        ) {#worth checking jhls 8,9

          $i4 = 0;
          for ($i3 = $Awfif::memes-> {fjhls8}; $i3 <= $Awfif::jhls-> {p}; $i3++) {
            if (($Awfif::jhls-> {l} [$i3][7] == $nws)
            ) {#

              $i2 = 1;
              $found = '';
              $failed = '';
              for ($i = trwsoadr ($Awfif::jhls-> {l} [$i3][14] [1],2) ;
              (($i != $Awfif::wsbl-> {wsoh}[$nws]) && (!$found) && (! $failed));
              $i = trwsoadr ($i, 1)) {
                if ((getwsost4 ($i) ne $operonbs[0])
                ){

                  if ((getwsost4 ($i) ne $operonbs[$i2++])
                  ){

                    $failed = 't';
                    };#if
                  }#if
                else {

                  $found = 't';
                  if ( (trwsoadr ($Awfif::jhls-> {l} [$i3][14] [1],1) != $Awfif::jhls-> {l} [$i3][8])
                  && ($njhlsi != $i3)
                  ){

                    $matches [$i4++] = $i3;
                    };
                  };#else
                };#for
              };#if
            };#for
# if (@matches [0]) {
          if (defined (@matches [0])) {
# walk down the telomeric list for the workspace gathering matches

            my ($ni, $ne, $descid, $found, $presentni, $lastni, $setstart, $ngc);
            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l}[ $myli] [20] ;
            $setstart = 0;
            if ((($descid = findtelhd ($Awfif::memes-> {currentwsbi}))>0)
            && (($ni = ($Awfif::workspace-> {l} [$descid] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
            ) {

              $ngc = '';
              while (($ni != 0) && (!$endmatch)) {

                $descid = $Awfif::wsol-> {l} [awsoadr ($ni)] [2];
                $ne = 0;
                while (($ne == 0) && ($descid != 0)) {#get the end of the telomere

                  if (($Awfif::workspace-> {l} [$descid] [3] == $Awfif::memes-> {snnh} {ltail}) && ($Awfif::workspace-> {l} [$descid] [4] == $Awfif::memes-> {snnh} {telomere})) {

                    $ne = ($Awfif::workspace-> {l} [$descid] [2] - $Awfif::memes-> {snnh} {wsi});
                    };#if
                  $descid = $Awfif::workspace-> {l} [$descid] [0];
                  };#while
                if ($ne != 0) {
# found a telomere so check if it matches any of the siblings listed in @matches

                  my ($i3, $match);
                  $match = 't';
                  $found = '';
                  for ($i3 = 0; (($i3 < $i4) && ($match) && !($found)); $i3++) {

                    $found = tsibling ($myli, $ni, $ne, $i3, \@matches, $found, \$match);
                    if ($found) {
# found indicates that the sibling is one of the set - for promote sib they must all be present for us to amplify them
# record the sibling to stimulate if get full set

                      my ($i5, $i6, $ai, $stopmatching);
                      $stopmatching = kmatching ($myli, $ni, $ne, $i3, $i4, $setstart, \@matchni, \@matchne);
                      if ($stopmatching) {#there is a match for each sibling in the matches list so can end the match

                      $endmatch = 't';
                      for ($i5 = 0; $i5 < $i4; $i5++) {
# promotestmrgampu1
                      my ($ltransmgrid, $patelhwso, $activec);
                      if (($Awfif::codelet-> {l} [$myli] [37] > 0) && ($Awfif::codelet-> {l} [$myli] [36] > 0)) {#since these are siblings they should have the same subpid 36 and related transaction manager ids 37

                      $ltransmgrid = mapsubtotmgrid (($patelhwso = awsoadr ($matchni [$i5])), $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$myli] [36]);
                      $activec = 1;
                      };#if its a subprogram
                      $ai = awsoadr (trwsoadr ($matchni [$i5],1));
                      $Awfif::wsol-> {l} [$ai][2]
                      = inccounter (
                      undef (),
                      undef (),
                      $Awfif::memes-> {snnh} {amplify},
                      $Awfif::wsol-> {l} [$ai] [2],
                      $ai,
                      undef(),
                      undef(),
                      undef(),
                      $ltransmgrid,
                      $patelhwso,
                      $activec);
# ensure these changes are noticed by selsalwsitem
                      &setcache ('tdgroup', conmsalb ($myli, $Awfif::codelet-> {l}[$myli][10], 'tdgroup'), undef(), $ai, $Awfif::memes-> {cvpcwso}, 0);
                      &setcache ('bugroup', conmsalb ($myli, $Awfif::codelet-> {l}[$myli][10], 'bugroup'), undef(), $ai, $Awfif::memes-> {cvpcwso}, 0);
                      for ($i6 = trwsoadr ($matchni [$i5],2);
                      $i6 != $matchne [$i5];
                      $i6 = trwsoadr ($i6,1)) {
# add amplify descriptor

                      $ai = awsoadr ($i6);
                      $Awfif::wsol-> {l} [$ai][2]
                      = inccounter (
                      undef (),
                      undef (),
                      $Awfif::memes-> {snnh} {amplify},
                      $Awfif::wsol-> {l} [$ai] [2],
                      $ai);
                      };#for $i6 steps through each amplify wso
                      };#for $i5 looks at each sibling in the sibling list
# notgcomplete self
                      if (!$ngc) {

                      $ngc = 't';
                      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
                      &notgcompleted ($myli, $sponsor, teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),'t' , undef(), 't');# sponsor should be one after telomeric header
                      };#if not $ngc
                      }#if finished keepmatching as have a match for each sibling
                      else {

                      if ($i3 < ($i4)) {

                      $found = '';#to allow for to continue
                      };#if
                      };#else keepmatching
                      };#if found a match for a sibling
                    };#for each sibling in the list
                  if ($found) {

                    $setstart = $setstart + $i4;
                    };#if
                  };#if

                $found = getntel ($myli, \$ni, \$lastni, \$presentni, $endmatch);
                };#while ni != 0
              };#got telomeric structures to check
            }; #if
          };#if
        };#if
      };#if
      };#else not promotesib
    $Awfif::memes-> {currentwsbi} = $cwsbi ;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("promotesibx ret ($endmatch)\n");
      };

    return ($endmatch)
    }# promotesib
#
#<!-- start tag ctr -->
#
sub subpstate {
    my($subpid)=@_;
    my ($state, $i, $ftransid, $fi);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpstate ");
      };
# return the current aggregate state if this is a subprogram schemata

    $state = $Awfif::memes-> {snnh} {incomplete};
    if (($subpid > 0)
    && (defined ($Awfif::subpl-> {l} [$subpid] [11][0]))
    ) {

      my ($incomplete);
      $incomplete = '';
      for ($i = 1; ((!$incomplete) && ($i <= $Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11][$Awfif::subpl-> {l} [$subpid] [11][0]]] [0])); $i++) {

        $ftransid = checksameas (undef(), $Awfif::subpl-> {l} [$subpid] [11][$Awfif::subpl-> {l} [$subpid] [11][0]], $i, \$fi);
        if ($Awfif::tral-> {w}[$ftransid] [$fi] == $Awfif::memes-> {snnh} {incomplete}) {
          $incomplete = 't';
          };#if
        };#for
      if (!$incomplete) {

        $state = $Awfif::memes-> {snnh} {completed};
        };#if
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$state};
      print ("subpstatex ret $pr($state)\n");
      };

    return ($state)
    }# subpstate
#
#<!-- start tag sia -->
#
sub subtrancomp {
    my($myli, $subp11i)=@_;
    my ($state, $i, $subpid, $ftransid, $fi);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subtrancomp subp11i($subp11i) ");
      };
# return true if this sub-transaction is completed
    if (($Awfif::codelet-> {l} [$myli] [36] > 0)
    && ($subp11i > 0)
    ){

      $subpid = $Awfif::codelet-> {l} [$myli] [36];
      $state = 't';
      for ($i = 1; $i <= $Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11][$subp11i] ] [0]; $i++) {

        $ftransid = checksameas (undef(), $Awfif::subpl-> {l} [$subpid] [11][$subp11i], $i, \$fi);
        if ($Awfif::tral-> {w}[$ftransid] [$fi] == $Awfif::memes-> {snnh} {incomplete}) {

          $state = '';
          };#if
        };#for
      }#if
    else {

      $state = '';
      };
    if (($Awfif::memes-> {subtrancfoundbreak}) && ($state)) {

      &break ();
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subtrancompx ret ($state)\n");
      };

    return ($state)
    }# subtrancomp
#
#<!-- end tag sia -->
#
sub mysubtrancomp {
    my($myli, $subp11i, $iprocname)=@_;
    my ($state, $i, $subpid, $procname);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subtrancomp subp11i $subp11i ");
      if (defined ($iprocname)){
        print ("iprocname $iprocname ");
        };#if
      };
    if ( ($subp11i > 0)
    ){
# return true if this sub-transaction matching part is completed

      $procname = setupprocname ($myli, $iprocname);
      $subpid = $Awfif::codelet-> {l} [$myli] [36];
      $state = 't';
      for ($i = 1; $i <= $Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11][$subp11i] ] [0]; $i++) {

        if ( ($Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11][$subp11i] ] [$i] eq $procname)
        && (($Awfif::tral-> {w}[$Awfif::subpl-> {l} [$subpid] [11][$subp11i] ] [$i] == $Awfif::memes-> {snnh} {incomplete})
        or ($Awfif::tral-> {w}[$Awfif::subpl-> {l} [$subpid] [11][$subp11i] ] [$i] == $Awfif::memes-> {snnh} {terminated}) )
        ){

          $state = '';
          };#if
        };#for
      }#if
    else {

      $state = '';
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subtrancompx ret ($state)\n");
      };

    return ($state)
    }# mysubtrancomp
#
sub tralcomp {#part of subtrancomp
    my($myli, $transid)=@_;
    my ($state, $i, $ftransid, $fi);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tralcomp transid $transid ");
      };
# return true if this sub-transaction is completed
    if ( ($transid > 0)
    ){

      $state = 't';
      for ($i = 1; (($state) && ($i <= $Awfif::tral-> {i}[$transid ] [0])); $i++) {

        $ftransid = checksameas ($myli, $transid, $i, \$fi);
        if (($Awfif::tral-> {w}[$ftransid ] [$fi] == $Awfif::memes-> {snnh} {incomplete})
        or ($Awfif::tral-> {w}[$ftransid ] [$fi] == $Awfif::memes-> {snnh} {terminated})
        ) {

          $state = '';
          };#if
        };#for
      }#if
    else {

      $state = '';
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tralcompx ret ($state)\n");
      };

    return ($state)
    }# tralcomp
#
sub notralitemcomp {#
    my($myli, $transid)=@_;
    my ($state, $i, $ftransid, $fi);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notralitemcomp transid $transid ");
      };
# return true if this sub-transaction has no item completed
    if ( ($transid > 0)
    ){

      $state = 't';
      for ($i = 1; (($state) && ($i <= $Awfif::tral-> {i}[$transid ] [0])); $i++) {

        $ftransid = checksameas ($myli, $transid, $i, \$fi);
        if ($Awfif::tral-> {w}[$ftransid ] [$fi] == $Awfif::memes-> {snnh} {completed}) {

          $state = '';
          };#if
        };#for
      }#if
    else {

      $state = '';
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notralitemcompx ret ($state)\n");
      };

    return ($state)
    }# notralitemcomp
#
#<!-- end tag ctr -->
#
sub trackcodelet {#
    my($myli, $newli, $function, $freemode, $ati, $subpid, $clp)=@_;
    my ($cwsbi);

    if ($Awfif::memes-> {trackcactive}) {
      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        my ($pr);
        $pr = $Awfif::memes-> {snnih} {$function};
        print ("trackcodelet myli $myli newli($newli) function($pr) free mode($freemode) ati($ati) subpid($subpid) ");
        if (defined ($clp->{action}->{subpi})) {

          print ("clpsubpi($clp->{action}->{subpi}) ");
          };#if
        };
      $cwsbi = $Awfif::memes-> {currentwsbi};
# keep track of codelets through their life time
      if ($function == $Awfif::memes-> {snnh} {add}) {

        if (($Awfif::codelet-> {l} [$myli] [21] > 0)
        && ($Awfif::codelet-> {l} [$myli] [19] > 0)
        ){

          $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [19];
          $Awfif::clet-> {assoc}-> {$newli} = awsoadr ($Awfif::codelet-> {l} [$myli] [21]);
          $Awfif::cletassocc [$Awfif::clet-> {assoc}-> {$newli}]++;
          };#if
        }#if
      elsif ($function == $Awfif::memes-> {snnh} {assocf1}){#codelet is regenerating

        $Awfif::clet-> {assoc}-> {$newli} = $Awfif::clet-> {assoc}-> {$myli};
        $Awfif::cletassocc [$Awfif::clet-> {assoc}-> {$newli}]++;
        }#elsif
      elsif ($function == $Awfif::memes-> {snnh} {telomere}){#converts codelet to schematic address

        if ((defined ($ati)) && ($ati > 0) ){

          $Awfif::clet-> {assocsa}-> {$ati} = $Awfif::clet-> {assoc}-> {$myli};
          };#if
        }#elsif
      elsif ($function == $Awfif::memes-> {snnh} {group}){#groupcomplete converts back to codelet

        if ((defined ($ati)) && ($ati > 0) ){#need to check this association It is possible that there could be > 1 original sponsor to associate

          $Awfif::clet-> {assoc}-> {$newli} = $Awfif::clet-> {assocsa}-> {$ati};
          $Awfif::cletassocc [$Awfif::clet-> {assoc}-> {$newli}]++;
          };#if
        }#elsif
      elsif ($function == $Awfif::memes-> {snnh} {free}){#releases the codelet. It better have actioned

        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
        if (defined ($Awfif::clet-> {assoc}-> {$myli})) {

          my ($sws, $wso, $csdesc);
          $sws = checkwsmd ($Awfif::clet-> {assoc}-> {$myli}, $Awfif::memes-> {wsowsi});
          if ($sws != $Awfif::memes-> {currentwsbi}){

            $Awfif::memes-> {currentwsbi} = $sws;
            $wso = grwsoadr ($Awfif::clet-> {assoc}-> {$myli});
            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
            }#if
          else {

            $wso = grwsoadr ($Awfif::clet-> {assoc}-> {$myli});
            };#else
          $csdesc = findtdesc ($Awfif::wsol-> {l} [$Awfif::clet-> {assoc}-> {$myli}][2], $Awfif::memes-> {snnh}{cassponsor});#watchout this is a special use of findmdesc - groupstart does not conform in general to the setupmdesc framework. Its part of inccounter framework
          if (($freemode != 1)
          && ($Awfif::memes-> {trackcf1break})
          && (checkgcstate ($sws, $wso, $wso))#sponsor is group completed
          && (($csdesc == 0)#not cassponsor
            or (($Awfif::workspace-> {l} [$csdesc] [2] - $Awfif::memes-> {snnh} {wsi}) == 0) )
          && (!tcsponsored ($myli))
          && ($Awfif::cletassocc [$Awfif::clet-> {assoc}-> {$myli}] <= 1)
          ){#this codelet has not been run

            &break ();
            };#if

          $Awfif::cletassocc [$Awfif::clet-> {assoc}-> {$myli}]--;
          $Awfif::clet-> {assoc}-> {$myli} = undef ();
          };#if
        }#elsif
      else {#invalid function value

        &break ();
        };#else
      $Awfif::memes-> {currentwsbi} = $cwsbi;

      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        print ("trackcodeletx \n");
        };
      };#if track codelet active

    }# trackcodelet
#
sub tcsponsored {#
    my($myli)=@_;
    my ($cwsbi, $result, @sponsored);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tcsponsored myli $myli ");
      };

    $cwsbi = $Awfif::memes-> {currentwsbi};
# report if this sponsor is supported by a cascade sponsor
    $sponsored [++$sponsored [0] ] = 'crsmbuilder';#crsm codelet is cascaded by bcsubps codelet
    $sponsored [++$sponsored [0] ] = 'bcsubpcbuilder';#bcsubpc codelet is cascaded by bcsubps codelet
    $sponsored [++$sponsored [0] ] = 'ivalwbuilder';#ivalw codelet is cascaded by bcsubps codelet
    if (($Awfif::codelet-> {l} [$myli] [35] > 0)
    && (matchsaelement (\@sponsored, $Awfif::tral-> {l} [$Awfif::codelet-> {l} [$myli] [35]] [3]) != 0)
    ){

      $result = 't';
      }#if
    else {

      $result = '';
      };#else
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tcsponsoredx ret ($result)\n");
      };
    return $result

    }# tcsponsored
#
#<!-- end tag aso -->
#
sub ngccltct {
    my($myli)=@_;
    my ($count, $reached);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ngccltct myli $myli ");
# &itcpoutput ($myli);
      };
# count if active codelets which were sponsored by this codelets group exceed threshold
# updated for merged workspaces
    $reached = '';
    $count = 0;
# $ws = $Awfif::codelet-> {l}[$myli] [20];
# $wss = $Awfif::codelet-> {l}[$myli][21];
# $wse = $Awfif::codelet-> {l}[$myli][22];
# if (($ws != 0) && ($wss != 0) && ($wse != 0)) {
# $linki = $Awfif::memes-> {codeleth};

# while (($linki != 0) && (!$reached)) {

# if (($linki != $myli) && ($ws == $Awfif::codelet-> {l}[$linki][20]) && ($wss == $Awfif::codelet-> {l}[$linki][21]) && ($wse == $Awfif::codelet-> {l}[$linki][22])) {

# if ($count++ >= $Awfif::memes-> {ngcompth}) {

# $reached = 't';
# };#if
# };#if
# $linki = $Awfif::codelet-> {l} [$linki][0];
# }; # while
# };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ngccltctx ret ($reached)\n");
      };

    return ($reached)
    }# ngccltct
#
#
sub hdescexists {
    my($myli, $cws, $bcwso, $matchtoo, $sponsortype)=@_;
    my ($lhdesc, $lhwso, $rhwso, $rhdesc, $cwsi, $exists, $abcwso);
# initiate a new gc while this codelet should sponsor the next section of a cascade

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("hdescexists myli $myli bcwso $bcwso matchtoo $matchtoo ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
# check if there is a model descriptor (sponsortype)-> $matchtoo at the head of the records in the list
# if no records yet look at the list head
# if the record head exists look at the record head only
# get the app str ws

    $exists = 't';
    $Awfif::memes-> {currentwsbi} = $cws;
    $abcwso = awsoadr ($bcwso);
# using the list head get the wso that will contain the descriptor
    $lhdesc = findtdesc ($Awfif::wsol-> {l} [$abcwso] [2], $Awfif::memes-> {snnh} {listhead});

    if ( ($lhdesc == 0 )
    or (($lhwso = ($Awfif::workspace-> {l} [$lhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$lhdesc][3] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($rhdesc = findtdesc ($Awfif::wsol-> {l} [awsoadr($lhwso)] [2], $Awfif::memes-> {snnh} {recordhead})) == 0)
    && (!findbond ($Awfif::wsol-> {l} [ awsoadr ($lhwso)] [2], $matchtoo, $sponsortype, $Awfif::memes-> {snnh} {model}))
    ) {

      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        print ("lhdesc $lhdesc lhwso $lhwso ");
        };#if
      $exists = '';
      }#if
    elsif ((($lhwso = ($Awfif::workspace-> {l} [$lhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$lhdesc][3] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($rhdesc = findtdesc ($Awfif::wsol-> {l} [awsoadr($lhwso)] [2], $Awfif::memes-> {snnh} {recordhead})) != 0)
    && (($rhwso = ($Awfif::workspace-> {l} [$rhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (!findbond ($Awfif::wsol-> {l} [ awsoadr ($rhwso)] [2], $matchtoo, $sponsortype, $Awfif::memes-> {snnh} {model}))

    ) {

      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        print ("lhdesc $lhdesc lhwso $lhwso rhwso $rhwso ");
        };#if
      $exists = '';
      }#elsif
    elsif ((($lhwso = ($Awfif::workspace-> {l} [$lhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$lhdesc][3] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($rhdesc = findtdesc ($Awfif::wsol-> {l} [awsoadr($lhwso)] [2], $Awfif::memes-> {snnh} {recordhead})) != 0)
    && (($rhwso = ($Awfif::workspace-> {l} [$rhdesc][2] - $Awfif::memes-> {snnh} {wsi})) == 0)
    && (!findbond ($Awfif::wsol-> {l} [ awsoadr ($lhwso)] [2], $matchtoo, $sponsortype, $Awfif::memes-> {snnh} {model}))
# This case is where a list has been found but no records have been found yet
    ) {

      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        print ("lhdesc $lhdesc lhwso $lhwso rhdesc $rhdesc rhwso $rhwso ");
        };#if
      $exists = '';
      };#elsif

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("hdescexistsx ret ($exists)\n");
      };
    return $exists
    }# hdescexists
#
#
sub fpiecodelet {
    my($myli, $ws, $athwso, $fpielinki)=@_;
    my ($cwsi, $pindesc, $p, $codelet);
# given a structural workspace and the wsposition descriptor associate the codelet with wso type
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fpiecodelet myli $myli ws $ws athwso $athwso ");
      };
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $Awfif::memes-> {currentwsbi} = $ws;
    if ( ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ $athwso ] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 )
    && (($p = ($Awfif::workspace-> {l} [$pindesc] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
    && ($Awfif::jhls-> {l} [$p] [19] != 0)#if the codelet has a list of equivalents
    ){
# loop through the children looking for the one with a match for awsoadr codelet [21]

      my ($gotit, $linki);
      $gotit = 0;
      $linki = $Awfif::jhls-> {l} [$p][19];#head of this amoff sub list
      while (($linki != 0) && ($gotit == 0)) {

        if ($Awfif::amoffl-> {l} [$linki] [4] == $athwso) {

          $gotit = $linki;
          };#if
        $linki = $Awfif::amoffl-> {l} [$linki] [0];
        };#while
      if ($gotit != 0) {

        $codelet = $Awfif::amoffl-> {l}[$gotit] [5];
        if (defined ($$fpielinki)) {
          $$fpielinki = $gotit;
          };#if
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fpiecodeletx ");
      if (defined ($$fpielinki)) {
        print (" fpielinki $$fpielinki ");
        };#if
      print ("ret ($codelet)\n");
      };
    return $codelet
    }# fpiecodelet
#
sub catcodelet {
    my($myli, $wspdsc, $stws, $awspwso)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref, $catalysis);
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("catcodelet myli $myli wspdsc $wspdsc awspwso $awspwso ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $catalysis = '';
    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    $aws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $aws;
    $Awfif::memes-> {currentwsbi} = $stws;
# grabcatru1
    $catref = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catref});
    if (($catref != 0)) {

      $catdesc = ($Awfif::workspace-> {l} [$catref] [2] - $Awfif::memes-> {snnh}{wsi});
      }#if
    else {

      $catdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catalysis});
      };
# if catalysis enabled handle the request

    if (($catdesc != 0)
    ) {#setup the catalysis

      $catalysis = 't';
      };#if catalysis setup

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("catcodeletx ret ($catalysis)\n");
      };
    return $catalysis
    }# catcodelet
#
sub subpl15iecodelet {
    my($myli)=@_;
    my ($cwsi, $i, $codelet);
# see if there is a matching codelet in the subpl [15] cache. If there is then return its codeletid

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpl15iecodelet myli $myli ");
      &itcpoutput ($myli);
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    for ($i = 1; ((!defined ($codelet )) && ($i <= $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [15] [0])); $i++) {
      if ($Awfif::codelet-> {l} [ $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [15] [$i] ] [2] eq setupbuildername (setupprocname ($myli)) ) {

        $codelet = $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [15] [$i];
        };#if
      };#for

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpl15iecodeletx ");
      print ("ret ($codelet)\n");
      };
    return $codelet
    }# subpl15iecodelet
#
#<!-- start tag aso -->
sub warfindops {
    my($myli, $stwso, $warws, $warbwso, $sactset)=@_;
    my ($cwsi, $i, $bcount, @result);
# generate a list of wait requesters.

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warfindops myli $myli stwso($stwso) ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $bcount = ifindb ($myli, $stwso, 'warb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@$sactset);
    $$warbwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$$warws);
# find the transcription factor binding
    if ($bcount >= 1) {

      $bcount = ifindb ($myli, $stwso, 'warasb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@$sactset, $$warws, undef (), undef (), 't', 't');
      $result[0] = 0;

      for ($i = 0; (($i < $sigcount)) ; $i++) {

        if ($lomatchs[$i]) {

          if (( ($Awfif::jhls-> {l} [$lola[$i]][4] == $Awfif::memes-> {snnh}{stbinding})
          && ($Awfif::jhls-> {l} [$lola[$i]][7] == $$warws)
          && ($Awfif::jhls-> {l} [$lola[$i]][8] != $$warbwso) )#exclude the wait and relay workspace operon
          && (matchaelement (\@result, $Awfif::jhls-> {l} [$lola[$i]] [8]) == 0) # its not already deployed to this subpid
          ){

            $result [++$result[0]] = $Awfif::jhls-> {l} [$lola[$i]] [8];
            };#if
          };#if
        };#for
      $Awfif::memes-> {currentwsbi} = $$warws;
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warfindopsx warws($$warws) warbwso($$warbwso) ");
      print ("ret ($result[0])\n");
      };
    return @result
    }# warfindops
#<!-- end tag aso -->
#
sub checkgcstate {
    my ($ws, $swsoid, $gsponsor) = @_;
    my ($cwsbi, $sgdi, $ttransmgrid, $found);
#
# true if group has completed taking into account the subprogram state

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $ws;
    if (($ttransmgrid = $Awfif::tmassl-> {wsot}{awsoadr (trwsoadr ($gsponsor, -1))}) <= 0) {

      $ttransmgrid = undef ();
      };#if
    if ((fgrpd ($Awfif::memes-> {codeleth}, $swsoid, \$sgdi, $Awfif::memes->{snnh}{groupcategory})) && (($gsponsor = fgrpsponsor ($swsoid, $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory})) != 0) && (gcompleted ($gsponsor, $ttransmgrid))) {# completed group

      $found = 't';
      }#if
    else {

      $found = '';
      };#else

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $found
    }# checkgcstate
#
#
sub icskick {
    my($wsi)=@_;
    my ($count, $i, $cll, $toppri, @sponsors );
# find any active codelets with cascade sponsor set and promote them to top priority
#
#
# checked for merged workspaces

    $count = 0;
    $toppri = 0;
    $cll = $Awfif::memes-> {codeleth};

    while ($cll != 0) {
      if ( ( $Awfif::codelet-> {l} [$cll] [3] > $toppri)
      && ($Awfif::codelet->{l} [$cll][19] == $wsi)
      ){

        $toppri = $Awfif::codelet-> {l} [$cll] [3];
        };
      if ( ($Awfif::codelet-> {l} [$cll] [32] == 1)
      && ($Awfif::codelet->{l} [$cll][19] == $wsi)
      ){

        $sponsors [$count++] = $cll;
        };
      $cll = $Awfif::codelet-> {l} [$cll] [0];
      };#while

    for ($i = 0; $i < $count; $i++) {

      $Awfif::codelet-> {l} [$sponsors [$i]] [3] = $toppri;
      };#for
#
    return $count
    }# icskick
#<!-- start tag cr -resweb -->
#
sub matchsibs {
    my($myli, $ws)=@_;
    my ($cll, $found, $loopcheck );
# return true if there are sibs for this myli with same or higher priority
#
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchsibs myli $myli ");
      };
    $found = '';

    $cll = $Awfif::memes-> {codeleth};
    $loopcheck = $Awfif::memes-> {tcodelets} + 1;

    while (($cll != 0) && (!$found) && ($loopcheck-- > 0) ){
      if ( ($cll != $myli)
      && ($Awfif::codelet->{l} [$cll][19] == $ws)
      && ( $Awfif::codelet-> {l} [$cll][3] >= $Awfif::codelet-> {l} [$myli][3])
      && ( ($Awfif::codelet-> {l} [$cll] [27] eq $Awfif::codelet-> {l}[$myli][2])
        or ( (!defined ($Awfif::codelet-> {l} [$cll] [27])) or ($Awfif::codelet-> {l} [$cll] [27] eq '') && ($Awfif::codelet-> {l} [$cll] [2] eq $Awfif::codelet-> {l}[$myli][2]) ) )
      ){

        $found = 't';
        };
      $cll = $Awfif::codelet-> {l} [$cll] [0];
      };#while
    if (($loopcheck <= 0) && ($cll != 0)) {&break ()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {

      print ("matchsibx ret ($found) \n");
      };
#
    return $found
    }# matchsibs
#<!-- start tag uts -->
#<!-- start tag sia -->
#
sub freeswitch34tail {
    my($codelet, $mode)=@_;
    my ($plink, $hlink, $tlink, $rhlink, $rtlink, $cwsbi, $result, $finished, $rcodelet, $newcodeletpt);
    my($newpt);
# look for a codelet that is deletable starting from the pseudo tail which is the first undeletable codelet detected

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freeswitch34tail codelet($codelet) ");
      print ("pseudo tail($Awfif::memes->{codeletpt}) ");
      };#if
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $result = '';
    $finished = '';
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == $Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1]))
    ){

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1]))
    ){

      &break ();
      };# check for circular references
    if ($Awfif::memes-> {codeletpt} > 0){

      $plink = $Awfif::memes-> {codeletpt};
      }
    elsif ($Awfif::memes-> {codeletpt} == 0) {

      $plink = $Awfif::codelet-> {l} [$codelet][1];
      if ($plink == 0) {

        $finished = 't';
        };#if
      }#else no help from pseudo tail pointer
    else {#codeletpt <0 => negative old head where the list ran out of further codelets to try and swop/free

      if ($Awfif::memes-> {codeletpt} == ($Awfif::memes-> {codeleth} * -1) ){

        $finished = 't';
        $plink = 0;
        } #if the pseudo tail is also the head so no further codelets to check
      else {# work forward from the old head

        $plink = ($Awfif::memes-> {codeletpt} * -1);# move on from the old head towards the current head
        $newcodeletpt = 0;
        };#else
      };#codeletpt negative
    if ((defined ($plink)) && ($plink < 0)) {&break ();};
    while ( (!$finished)
    && (defined ($plink))
    && ($plink != 0)
    && (freescheckcantd ($plink, $mode)) #keep going while plink codelet cant be deleted
    ){

      if ($plink != $Awfif::memes-> {codeleth} ){

        $plink = $Awfif::codelet-> {l} [$plink][1];
        if ($plink == 0) {

          $finished = 't';
          };#if
        }#if
      else {#reached end

        $finished = 't';
        };#else
      };#while
# next complete block identifies the next pseudo tail
    if ((defined ($plink)) && ($plink < 0)) {&break ();};
    if ($Awfif::memes-> {codeletpt} > 0){#there were unchecked codelets between pseudo tail and head

# was using plink of current [pseudo] tail. After search that is now the newpt and plink is used to indicate the head of the undeletable sublist
      $newpt = $plink;
      $plink = $Awfif::memes-> {codeletpt};#first deletable should be presented
      if (!$finished) {#identify the next pseudo tail

        if ($Awfif::memes-> {codeletpt} == $newpt) {#
          $newcodeletpt = $Awfif::codelet-> {l} [$newpt] [1];#newcodeletpt will be the new pseudo tail when exit
          }#if
        else {
          $newcodeletpt = $newpt;#newcodeletpt will be the new pseudo tail when exit
          };#else
        }#if
      else {#no further deletable item so new pseudo tail is

        $newcodeletpt = ($Awfif::memes-> {codeleth} * -1);#newcodeletpt will be the new pseudo tail when exit
# looks wrong $finished = '';#since we have the pseudo tail item
        };#else
      }#if
    elsif ($finished){

      $newcodeletpt = ($Awfif::memes-> {codeleth} * -1);#newcodeletpt will be the new pseudo tail when exit
      }#elsif
    else {#codeletpt <= 0 and not finished

      $newcodeletpt = $Awfif::codelet-> {l} [$plink] [1];#newcodeletpt will be the new pseudo tail when exit
      };#else
# have identified the next pseudo tail codelet
    if ((defined ($plink)) && ($plink < 0)) {&break ();};
# proceed to swop current real tail with deletable codelet
    if ((!$finished)
    && ($plink != $codelet)
    ){#swop $codelet and $plink codelet

      $result = 't';
      if (($plink <= 0) or ($codelet <= 0) ){ &break ();};
      $rcodelet = $plink;
      $rtlink = $Awfif::codelet-> {l} [$rcodelet] [0];#towards the tail
      $rhlink = $Awfif::codelet-> {l} [$rcodelet] [1];#nearer the head
      $tlink = $Awfif::codelet-> {l} [$codelet] [0];#towards the tail
      $hlink = $Awfif::codelet-> {l} [$codelet] [1];#nearer the head
      if ( ($tlink == $hlink)
      or ($rtlink == $rhlink)
      ){

        &break ();
        };# check for circular references
      if ($hlink == $rcodelet) {#the swop codelets reference each other

        $Awfif::codelet-> {l} [$codelet] [0] = $hlink;
        $Awfif::codelet-> {l} [$codelet] [1] = $rhlink;
        $Awfif::codelet-> {l} [$rcodelet] [0] = $tlink;
        $Awfif::codelet-> {l} [$rcodelet] [1] = $rtlink;
        if ($codelet == $Awfif::memes-> {codelett}) {

          $Awfif::memes-> {codelett} = $rcodelet;
          }#if
        else {

          $Awfif::codelet-> {l} [$tlink] [0] = $rcodelet;
          };#else
        if ($rcodelet == $Awfif::memes-> {codeleth}) {

          $Awfif::memes-> {codeleth} = $codelet;
          }#if
        else {

          $Awfif::codelet-> {l} [$rhlink] [0] = $codelet;
          };#else
        }#if
      else {
# now relink the rest of list

        $Awfif::codelet-> {l} [$codelet] [0] = $rtlink;
        $Awfif::codelet-> {l} [$codelet] [1] = $rhlink;
        $Awfif::codelet-> {l} [$rcodelet] [0] = $tlink;
        $Awfif::codelet-> {l} [$rcodelet] [1] = $hlink;
        if ( ($codelet == $Awfif::memes-> {codelett})
        && ($rcodelet == $Awfif::memes-> {codeleth})
        ){

          $Awfif::memes-> {codeleth} = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::memes->{codelett} = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          }#if
        elsif ( ($codelet == $Awfif::memes-> {codelett})
        ){

          $Awfif::codelet-> {l} [$rhlink] [0] = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::memes-> {codelett} = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          }#elsif
        elsif ( ($codelet == $Awfif::memes->{codeleth})
        ){

          $Awfif::memes-> {codeleth} = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::codelet-> {l} [$tlink] [1] = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          }#elsif
        else {

          $Awfif::codelet-> {l} [$rhlink] [0] = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::codelet-> {l} [$tlink] [1] = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          };#else
        };#else
      };#if

if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freeswitch34tailx ");
      if ($result) {
        print ("codelet($codelet) switched with($rcodelet)");
        };#switched
      print ("pseudo tail($Awfif::memes->{codeletpt}) ");
      if (defined ($newcodeletpt) ){
        print ("becomes($newcodeletpt) ");
        };#if
      print ("ret ($result)\n");
      };
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == $Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1]))
    ){

      &break ();
      };# check for circular references
    if ( (($rcodelet > 0) && ($Awfif::codelet-> {l} [$rcodelet][0] == $Awfif::codelet-> {l} [$rcodelet][1]))
    ){

      &break ();
      };# check for circular references
    if ( (($codelet > 0) && ($Awfif::codelet-> {l} [$codelet][0] == $Awfif::codelet-> {l} [$codelet][1]))
    ){

      &break ();
      };# check for circular references
    if (defined ($newcodeletpt) ){

      $Awfif::memes-> {codeletpt} = $newcodeletpt;
      if (($newcodeletpt > 0) && ($Awfif::codelet-> {t} [$Awfif::memes-> {codeletpt}] == $Awfif::memes-> {snnh}{deferred} )
      or ($newcodeletpt < 0) && ($Awfif::codelet-> {t} [(-1 * $Awfif::memes-> {codeletpt})] == $Awfif::memes-> {snnh}{deferred} )
      ){ &break ();};
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# freeswitch34tail
#
#<!-- start tag inh -->
#
sub freescheckcantd {
    my($codelet, $mode)=@_;
    my ($cantd, $cwsbi, $ws, $i);
# check the local squares for a match with the desired situation, relative to current position

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freescheckcantd codelet($codelet) ");
      };#if
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

# handle codelets that can't be deleted due to activation or inhibition
    $cantd = '';

    if ($Awfif::codelet->{l} [$codelet] [34] != 0) {#catalysed so can't be deleted

      $cantd = 't';
      };#if
# activation
# activstdel
    if (($Awfif::codelet-> {l} [$codelet] [19] != 0)) {

      $ws = $Awfif::codelet-> {l} [$codelet][19];
      }
    else {#default to current ws

      $ws = $Awfif::memes-> {currentwsbi};
      };
# freebldup1
    if (($mode != 1) #this has not been run
    && (!$cantd)
    && ($Awfif::codelet-> {l} [$codelet][2] =~ /builder/) #if got to be builder ensure runs
    ){

      $cantd = 't';
      }
# freecjhlsiup1
    elsif (($mode != 1) #this has not been run
    && (!$cantd)
    && (($Awfif::codelet-> {l} [$codelet][23] != 0)
    && ($Awfif::memes-> {snw} [$ws]-> {snna} {$Awfif::memes-> {snnih} {$Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet] [23]] [6]}} > $Awfif::memes-> {killth}))
    ){

      $cantd = 't';
      }
# freecjhlsoiup1
    elsif (($mode != 1)
    && (!$cantd)
    && ($Awfif::codelet-> {l} [$codelet][30] != 0)
    && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] <= 1)
    ){

      $cantd = 't';
      }
# freectfreeup1
    elsif (($mode != 1)
    && (!$cantd)
    && ($Awfif::codelet-> {l} [$codelet][32] != 0)
    ){#cascade sponsor can't be freed

      $cantd = 't';
      }
# freectrunpu1
    elsif (($Awfif::memes-> {cruna}[0] > 0)
    && (!$cantd)
    && (matchaelement (\@{$Awfif::memes-> {cruna}}, $codelet) != 0 )
    ){#running codelet can't be freed

      $cantd = 't';
      }
    elsif (($mode != 1)
    && (!$cantd)
    && (($Awfif::codelet-> {l} [$codelet][2] eq 'tgoalscout')
    or ($Awfif::codelet-> {l} [$codelet][2] eq 'goalevaluator'))
    ){#groupcomplete signals should work

      $cantd = 't';
      };
# freecinhcdu1
# inhibition
    for ($i = 1; (($i < $Awfif::inhibl-> {p}) && (!$cantd)); $i++) {
      if ($Awfif::inhibl-> {l} [$i][3] == $codelet) {

        $cantd = 't';
        $Awfif::codelet-> {l} [$codelet] [3] *= ($Awfif::memes-> {inhuramp} * $Awfif::wsbl->{p});
        };#if
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freescheckcantdx ");
      print ("ret $cantd\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $cantd
    }# freescheckcantd
#
#<!-- end tag inh -->
#
sub waitonwalls {
    my($myli, $sponsor, $cws, $bcwso, $north, $south, $east, $west)=@_;
    my ($proceed, $cwsbi);
# check the local squares for walls, relative to current position. if find issue wait

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitonwalls myli $myli cws($cws) bcwso($bcwso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $proceed = '';
    if ( ($north == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {north}, $north);
      $proceed = 't';
      };#if
    if ( ($south == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {south}, $south);
      $proceed = 't';
      };#if
    if ( ($east == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {east}, $east);
      $proceed = 't';
      };#if
    if ( ($west == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {west}, $west);
      $proceed = 't';
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitonwallsx ");
      print ("ret ($proceed) \n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $proceed
    }# waitonwalls
#
sub activatevbtm {
    my($myli, $cws, $abcwso, $north, $south, $east, $west, $stay)=@_;
    my ($proceed, $cwsbi, $wosdsc);
# issue synced descriptor to activate in region models, reporting first wall, first can or stay when all empty

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr, $pr2, $pr3, $pr4, $pr5);
      $pr = $Awfif::memes-> {snnih} {$north};
      $pr2 = $Awfif::memes-> {snnih} {$south};
      $pr3 = $Awfif::memes-> {snnih} {$east};
      $pr4 = $Awfif::memes-> {snnih} {$west};
      $pr5 = $Awfif::memes-> {snnih} {$stay};
      print ("activatevbtm myli $myli cws($cws) abcwso($abcwso) north($pr($north)) south($pr2($south)) east($pr3($east)) west($pr4($west)) stay($pr5($stay)) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $proceed = 't';
    $wosdsc = 0; #define so it will be setup
    if ( ($north == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {north}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $north), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {north},#sltype
        $north,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $north;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {north};
      $proceed = '';
      };#if
    if ( ($south == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {south}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $south), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {south},#sltype
        $south,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $south;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {south};
      $proceed = '';
      };#if
    if ( ($east == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {east}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $east), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {east},#sltype
        $east,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $east;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {east};
      $proceed = '';
      };#if
    if ( ($west == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {west}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $west), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {west},#sltype
        $west,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $west;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {west};
      $proceed = '';
      };#if
    if ($proceed) {#force wait on desc for each can found

      if ( ($north == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {north}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $north), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {north},#sltype
          $north,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $north;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {north};
        $proceed = '';
        };#if
      if ( ($south == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {south}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $south), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {south},#sltype
          $south,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $south;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {south};
        $proceed = '';
        };#if
      if ( ($east == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {east}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $east), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {east},#sltype
          $east,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $east;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {east};
        $proceed = '';
        };#elsif
      if ( ($west == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {west}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $west), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {west},#sltype
          $west,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $west;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {west};
        $proceed = '';
        };#if
      if ( ($stay == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {stay}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $stay), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {stay},#sltype
          $stay,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $stay;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {stay};
        $proceed = '';
        };#if
      };#if
    if ($proceed) {#force wait on desc for stay empty

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {stay}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $stay), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {stay},#sltype
        $stay,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $stay;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {stay};
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("activatevbtmx \n");
      };
    }# activatevbtm
#
sub waitoncans {
    my($myli, $sponsor, $cws, $bcwso, $north, $south, $east, $west, $stay)=@_;
    my ($proceed, $cwsbi);
# check the local squares for cans, relative to current position. if find issue wait

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitoncans myli $myli cws($cws) bcwso($bcwso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $proceed = '';
    if ( ($north == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {north}, $north);
      $proceed = 't';
      };#if
    if ( ($south == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {south}, $south);
      $proceed = 't';
      };#if
    if ( ($east == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {east}, $east);
      $proceed = 't';
      };#if
    if ( ($west == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {west}, $west);
      $proceed = 't';
      };#if
    if ( ($stay == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {stay}, $stay);
      $proceed = 't';
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitoncansx ");
      print ("ret ($proceed) \n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $proceed
    }# waitoncans
#
sub getmappedvbttrns {
    my($myli)=@_;
    my ($cwsbi, $i, $i2);
    my (@list);
# generate a list of transaction mapped model to action codelet jhls entries

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getmappedvbttrns myli $myli ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    for ($i = 1; $i < $Awfif::jhls-> {p}; $i++){
      if (($Awfif::jhls-> {l} [$i] [4] == $Awfif::memes-> {snnh} {operon}) && ($Awfif::jhls-> {l} [$i] [18] [0] > 0)){

        for ($i2 = 1; (($i2 <= $Awfif::jhls-> {l} [$i] [18] [0]) && ($list [$list [0]] != $i)); $i2++){
          if ($Awfif::jhls-> {l} [$i] [18] [$i2] =~ /vbttoa(.+)*builder/i){

            $list [++$list [0]] = $i;
            };#if
          };#for
        }#if
      };#for
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getmappedvbttrnsx ");
      print ("@list");
      print ("\n");
      };
    return @list
    }# getmappedvbttrns
#
#<!-- end tag sia -->
#<!-- start tag ds -resweb -->
#
sub addcswso {
# setup the structures to support linked details of cascade sponsor wsos
    my ($ws, $wso, $slinkh) = @_;# must be the cswso head's index for this structure list or 0
    my ($nslinkh);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addcswso $ws:");
      print ("$wso slink $slinkh ");
      };
    $nslinkh = addhli ($slinkh, \$Awfif::cswsol);

    if ($nslinkh == $Awfif::cswsol-> {f}) {&break();};
# setup the links data

    $Awfif::cswsol-> {l} [$nslinkh][2] = $ws;
    $Awfif::cswsol-> {l} [$nslinkh][3] = $wso;

    if ($nslinkh == $Awfif::cswsol-> {f}) {&break ()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addcswsox ret $nslinkh\n");
      };

    return $nslinkh
    }# addcswso
#
sub freecswso {
    my ($cslnk) = @_;
#
# checked for merged workspaces

# move the codelet datastructure to the inactive list
    my ($plink);
    $plink = freehli ($cslnk, \$Awfif::cswsol);
    $Awfif::cswsol-> {l} [$cslnk] [2] = 0;
    $Awfif::cswsol-> {l} [$cslnk] [3] = 0;
    return $plink
    }#freecswso
#
sub notcsponsor {
    my ($ws, $wso, $loadcache) = @_;
#
# checked for merged workspaces

# checks the loadcache will not run into a cascade sponsor wso
    my ($i, $result, $found);
    $result = '';
    if (($loadcache == 1)
    or ($loadcache == 2)
    ) {

      $result = 't';
      }#if
    elsif (($loadcache == 4)
    or ($loadcache == 5)
    ) {

      $result = 't';
      $found = '';
      for ($i = 1; (($i < $Awfif::cswsol-> {p}) && (!$found)); $i++) {
        if (($Awfif::cswsol-> {l} [$i] [3] == $wso)
        && ($Awfif::cswsol-> {l} [$i] [2] == $ws)
        ){

          $result = '';
          $found = 't';
          };#if
        };#for
      };#elsif
    return $result
    }#notcsponsor
#
#<!-- start tag ds -resweb -->
#
sub addli {
    my ($list, $head, $tail) = @_;
# setup the structures to support linked buffers
    my ($pflink, $plink, $nslinkh, $utail, $headp, $tailp);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addli ");
      };
    if ($$list-> {l} [0] [ 1] ){

      &break ();
      };#if
# see if this uses special head & tail - is a fifo for example
    if (defined ($$head) ) {

      $headp = \$$head;
      }#if
    else {

      $headp = \$$list-> {h};
      };#else
    if (defined ($$tail) ) {

      $tailp = \$$tail;
      }#if
    else {

      $tailp = \$$list-> {t};
      };#else
# create an active descriptor
    $utail = '';
    if (($$tailp == 0) && ($$headp == 0)) {
      $utail = 't';
      }; #note need to update tail
    $pflink = $$list-> {f};
    if ($pflink != 0 ) {
# can reclaim one from the inactive list

      $$list-> {flistl}--;
      $plink = $$list-> {l} [$pflink] [0];
      if ($plink != 0) {

        $$list-> {l}[$plink][1] = 0;
        $$list-> {f} = $plink;
        } # if
      else {#zero the free head ptr

        $$list-> {f} = 0;
        };
      $$list-> {l} [$pflink][0] = $$headp;
      if ($$headp != 0) {
        $$list-> {l} [$$headp][1] = $pflink;
        };#if
      $$headp = $pflink;
      $nslinkh = $pflink;
      }# found free links
    else {
# if there weren't any then get a newone

      $$headp = newlink ($$headp, \$$list);
      $$list-> {tlistl}++;
      $nslinkh = $$headp;
      }; #else
    if ($utail) {
      $$tailp = $$headp;
      };
# setup the links data

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addlix ret $nslinkh\n");
      };

    $$headp = $nslinkh;
    if ($$list-> {l} [0] [ 1] ){

      &break ();
      };#if
    if ( (($$headp > 0) && ($$list-> {l} [$$headp][0] == $$headp))
    or (($$headp > 0) && ($$list-> {l} [$$list-> {l} [$$headp][1] ][1] == $$headp)) ) {

      &break ();
      };# check for circular references
    return $nslinkh
    }# addli
#
#<!-- end tag ds -->
#<!-- start tag ds -resweb -->
#
sub freeli {
    my ($aspl, $list, $head, $tail) = @_;
    my ($pflink, $plink, $f, $headp, $tailp);
#

    if ((defined ($$list-> {l} [0] [1]))
    ){

      &break ();
      };#if
    if ( (($aspl > 0) && ($$list-> {l} [$aspl][0] == $aspl))
    or (($aspl > 0) && ($$list-> {l} [$$list-> {l} [$aspl][1] ][1] == $aspl)) ) {

      &break ();
      };# check for circular references
# move the buffer list structure to the inactive list
#
# checked for merged workspaces
# get the current free head
# see if this uses special head & tail - is a fifo for example
    if (defined ($$head) ) {
      $headp = \$$head;
      }#if
    else {
      $headp = \$$list-> {h};
      };#else
    if (defined ($$tail) ) {
      $tailp = \$$tail;
      }#if
    else {
      $tailp = \$$list-> {t};
      };#else
    $f = $$list-> {f};
    $plink = 0;
    $pflink = $$list-> {f};
    if ($aspl != 0 ) {

# check if the active list tail must be altered
      if ($$tailp == $aspl) {
        if ($$tailp == $$headp) {
          $$tailp = 0;
          }
        else {
          $$tailp = $$list-> {l}[$aspl][1];
          };
        };#if
# can reclaim it to the inactive list
      $$list-> {flistl}++;
# link its neighbours together
      $plink = $$list-> {l} [$aspl][0];
      if ($plink != 0) {

        if ($$list-> {l} [$aspl][1] == 0) {
# This is a head sentinal relink head
          $$headp = $plink;
          $$list-> {l} [$plink ][1] = 0;
          }
        else {# normal case - not either sentinal

          $$list-> {l} [$plink ][1] =
            $$list-> {l} [$aspl][1];
          $$list-> {l} [$$list-> {l} [$aspl][1] ][0] =
            $$list-> {l} [$aspl][0];
          };
        }
      else {

# this is a tail sentinal
        if ($$list-> {l} [$aspl][1] == 0) {
# This is a head sentinal as wellrelink head
          $$headp = $plink;
          }
        else {# just tail sentinal

          $$list-> {l} [$$list-> {l} [$aspl][1] ][0] = 0;
          };
        };
# relink this to become the head of the inactive list

      $$list-> {l} [$aspl] [1] = 0; #sentinal
      $$list-> {l} [$aspl] [0] = $pflink;
      if ($pflink != 0) {
        $$list-> {l} [$pflink][1] = $aspl;
        };# if
      $$list-> {f} = $aspl;
      };# ok to relink
    if ( (($aspl > 0) && ($$list-> {l} [$aspl][0] == $aspl))
    or (($aspl > 0) && ($$list-> {l} [$$list-> {l} [$aspl][1] ][1] == $aspl)) ) {

      &break ();
      };# check for circular references
    return $plink
    }#freeli
#
#<!-- end tag ds -->
#<!-- start tag aso -->
#<!-- start tag dli -->
#<!-- start tag al -->
#
sub ifindb {# see if there is a bound workspace with the schematic string
    my($myli, $sti, $strategy, $sigcount, $lomatchs, $lola, $loconcs, $lostrts, $loends, $logb, $loge, $kwp, $kwpr, $sactset, $stws, $issubp, $subp, $dontcallbreak, $dontusebice)=@_;
    my ($i, $bcount, $linki, $cwsbi, $static, $labcount, $hchain, $srws, $erws);
    my (@lab );

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      print ("ifindb myli $myli currentwsbi $pr ");
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $bcount = 0;

    $static = '';
    $labcount = $Awfif::memes-> {binds}-> {$strategy}->
        ($myli, $sti, \@lab, $kwp, $kwpr, \@$sactset, \$static);
# ifindbcrelu1

    $srws = 0; #must be defined for relifindb
    $erws = 0; #must be defined for relifindb
    &relifindb ($myli, \$Awfif::ifbhcl, \$srws, \$erws);

    if (((!defined ($dontusebice)) or (!$dontusebice))
    && (($linki = getifb ($myli, $strategy, $labcount, \@lab, \$hchain, $subp, $stws, $srws, $erws)) != 0)
    && ($hchain != 0)
    ) {#usebice cache setup

      $$sigcount = usebice ($Awfif::ifbhcl-> {l} [$linki][4], \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge);
      $bcount = $Awfif::bicl-> {l} [$Awfif::ifbhcl-> {l} [$linki][4]][3];
      }#if
    else {

      if ((defined ($stws)) && (defined ($srws)) && (defined ($erws)) ){#use structural ws sequence for search

        $$sigcount = labinv2 ($myli, \@lab, $labcount, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, 'wsseqstbinding', undef (), $srws, $erws);
        }#if
      elsif ((!defined ($stws)) && (defined ($srws)) && (defined ($erws)) ){#use specific stws only for search

        $$sigcount = labinv2 ($myli, \@lab, $labcount, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, 'wsseqoporstbinding', undef (), $srws, $erws);
        }#elsif
      elsif ((defined ($stws)) && (defined ($issubp)) ){#use specific stws only for search

        $$sigcount = labinv2 ($myli, \@lab, $labcount, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, 'specsubpstonly', $stws);
        }#elsif
      elsif ((defined ($stws)) ){#use specific stws only for search

        $$sigcount = labinv2 ($myli, \@lab, $labcount, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, 'specstonly', $stws);
        }#elsif
      else {

        $$sigcount = labinv2 ($myli, \@lab, $labcount, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, 'onlyoporstbinding');
        };#else
      if ($$sigcount > 0) {

        for ($i = 0; $i < $$sigcount; $i++) {
          if ($$lomatchs[$i]) {

            if ( (defined ($issubp))
            && ($Awfif::jhls-> {l} [$$lola[$i]][4] == $issubp)
            ){
              $bcount++;
              }#if
            elsif (($Awfif::jhls-> {l} [$$lola[$i]][4] == $Awfif::memes-> {snnh}{subpstbinding}) && ( ($$lola[$i] == $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [4]) or ($$lola[$i] == $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [8]) or ($$lola[$i] == $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [5])) ) {

              $bcount++;
              }#elsif
            elsif ($Awfif::jhls-> {l} [$$lola[$i]][4] == $Awfif::memes-> {snnh}{stbinding}) {

              $bcount++;
              }#elsif
            else {
              $$lomatchs [$i] = '';
              };#else ignore this one
            };#if
          };#for
        };#if
      if ( ($bcount > 0)
      && ((!defined ($dontusebice)) or (!$dontusebice)) ) {
# ifindbcrelu2

        &addifb ($myli, $strategy, $labcount, \@lab, addbice ($Awfif::memes-> {currentwsbi}, $bcount, 5, $$sigcount, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge), $subp, $stws, $srws, $erws);
        };#stable answer can be cached
      };#else
    if (($bcount == 0)
    && !($dontcallbreak)
    ){

      &break ();
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ifindbx ret ($bcount)\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $bcount
    }# ifindb
#
#<!-- end tag dli -->
#<!-- end tag aso -->
#
sub getfbws {# get the index of the first bound workspace
    my($myli, $sigcount, $lomatchs, $lola, $ws, $jhlsi, $stws, $subp)=@_;
    my ($i, $bwso, $found, $cwsbi);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getfbws myli $myli ");
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';
    for ($i = 0; (($i < $sigcount) && (!$found)) ; $i++) {
      if ($$lomatchs[$i]) {
        if ( ($Awfif::jhls-> {l} [$$lola[$i]][4] == $Awfif::memes-> {snnh}{stbinding})
        or ( subpst ($myli, $$lola[$i], $stws, $subp) )
        ){
          $$ws = $Awfif::jhls-> {l} [$$lola[$i]] [7];
          $bwso = $Awfif::jhls-> {l} [$$lola[$i]] [8];
          $found = 't';
          if (defined ($$jhlsi)) {
            $$jhlsi = $$lola[$i];
            };#if
          };#if
        };#if
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getfbwsx ws $$ws ret ($bwso)\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $bwso
    }# getfbws
#
sub subpst {# check if this jhls index is for a subprogram and matches the specific subprogram index
    my($myli, $i, $ws, $subpi)=@_;
    my ($found, $cwsbi, $subpii);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpst myli $myli ");
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';
    if ((defined ($ws)) && (defined ($subpi))
    && ( ($Awfif::subpl-> {l} [$subpi] [2] == $ws)
    or ($Awfif::subpl-> {l} [$subpi] [6] == $ws)
    or ($Awfif::subpl-> {l} [$subpi] [7] == $ws) )
    ){

      if ( ($Awfif::jhls-> {l} [$i][4] == $Awfif::memes-> {snnh}{subpstbinding})
      && (($Awfif::jhls-> {l} [$i][7] == $Awfif::subpl-> {l} [$subpi] [2])
        or ($Awfif::jhls-> {l} [$i][7] == $Awfif::subpl-> {l} [$subpi] [6])
        or ($Awfif::jhls-> {l} [$i][7] == $Awfif::subpl-> {l} [$subpi] [7]) )
      ){

        $found = 't';
        };#if
      }#if
    elsif ((!defined ($ws))
    ){

      if (!defined ($subpi) ) {

        $subpii = $Awfif::codelet-> {l} [$myli] [36];
        }
      else {

        $subpii = $subpi;
        };
      if ( ($Awfif::jhls-> {l} [$i][4] == $Awfif::memes-> {snnh}{subpstbinding})
      && ( ((defined ($Awfif::subpl-> {l} [$subpii] [2]))
        && ($Awfif::subpl-> {l} [$subpii] [2] == $Awfif::jhls-> {l} [$i][7]))
        or ((defined ($Awfif::subpl-> {l} [$subpii] [6]))
        && ($Awfif::subpl-> {l} [$subpii] [6] == $Awfif::jhls-> {l} [$i][7]))
        or ((defined ($Awfif::subpl-> {l} [$subpii] [7]))
        && ($Awfif::subpl-> {l} [$subpii] [7] == $Awfif::jhls-> {l} [$i][7])) )
      ){

        $found = 't';
        };#if
      }#elsif
    elsif ((defined ($ws))
    ){

      $subpii = $Awfif::codelet-> {l} [$myli] [36];
      if ( ($Awfif::jhls-> {l} [$i][4] == $Awfif::memes-> {snnh}{subpstbinding})
      && ( ((defined ($Awfif::subpl-> {l} [$subpii] [2]))
        && ($Awfif::subpl-> {l} [$subpii] [2] == $Awfif::jhls-> {l} [$i][7]))
        or ((defined ($Awfif::subpl-> {l} [$subpii] [6]))
        && ($Awfif::subpl-> {l} [$subpii] [6] == $Awfif::jhls-> {l} [$i][7]))
        or ((defined ($Awfif::subpl-> {l} [$subpii] [7]))
        && ($Awfif::subpl-> {l} [$subpii] [7] == $Awfif::jhls-> {l} [$i][7])) )
      && ( ($Awfif::subpl-> {l} [$subpii] [2] == $ws)
      or ($Awfif::subpl-> {l} [$subpii] [7] == $ws)
      or ($Awfif::subpl-> {l} [$subpii] [6] == $ws) )
      ){

        $found = 't';
        };#if
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpstx ret ($found)\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $found
    }# subpst
#
#<!-- start tag aso -->
#
sub getstsbws {# get the index of the first bound workspace
    my($myli, $sigcount, $lomatchs, $lola, $ws, $stws, $subp)=@_;
    my ($i, $bwso, $found, $cwsbi);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getstsbws myli $myli ");
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';
    for ($i = 0; (($i < $sigcount) && (!$found)) ; $i++) {
      if ($$lomatchs[$i]) {
        if (( ($Awfif::jhls-> {l} [$$lola[$i]][4] == $Awfif::memes-> {snnh}{stbinding})
        && ($Awfif::jhls-> {l} [$$lola[$i]][7] == $ws) )
        or ( subpst ($myli, $$lola[$i], $stws, $subp) )
        ){
          $bwso = $Awfif::jhls-> {l} [$$lola[$i]] [8];
          $found = 't';
          };#if
        };#if
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getstsbwsx ret ($bwso)\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $bwso
    }# getstsbws
#
#<!-- end tag al -->
#<!-- xtart tag sia -->
#
sub assieojhlc {# inversion of groupbuilders ie jhlabel operon association - no callers!
    my($myli, $sponsor, $ws, $as, $ae)=@_;
    my ($i, $cwsbi, $newjhlsi, $atelhwso, $teldesc, $asponsor, $sigcount, @lomatchs, @logb, @loge, @loconcs, @lola, @lostrts, @loends);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("assieojhlc myli $myli sponsor($sponsor) ws($ws) as($as) ae($ae) ");
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $ws;
# see if there is an operon within the as ae group by binding with it
# apply the linking function of group completion

    $sigcount = labinv1 ($myli, $as, $ae, '', '', \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'notoporstbinding');
    if ($sigcount > 0) {

      my ($atti);
      for ($i = 0; $i < $sigcount; $i++) {

        if ($lomatchs[$i]) {#there is a link use the association
#

          if (($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{operon}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{stbinding}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{subpstbinding})) {
# now setup a cache for it

            if ($Awfif::wsol-> {l}[($asponsor = awsoadr ($sponsor))][ $Awfif::memes-> {wsogcspjhlsi}] == 0) {#this is a new group complete

              ©sn1 ($Awfif::memes-> {currentwsbi}, $Awfif::memes->{snnih}{$Awfif::jhls-> {l} [$lola[$i]] [6]});
# add a jhlabel for this workspace group
              $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl} [$Awfif::memes-> {snnh}{operon}] = newnlink ($Awfif::memes-> {snnh} {attrib}, ($newjhlsi = addjhlst ($Awfif::memes-> {snnh} {groupcategory}, $Awfif::memes-> {snnh} {operon}, 1, $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl}[$Awfif::memes-> {snnh}{operon}], $Awfif::jhls-> {l} [$lola[$i]] [6], $Awfif::memes-> {currentwsbi}, $lostrts[$i], $loends[$i], $Awfif::jhls-> {l} [$lola[$i]] [15] [0])), $Awfif::memes-> {snnh}{operon}, $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes-> {snnh}{operon}]);
# if this schemata has indequiv true check the telomeric head wso (logically sponsor - 1) for a mindeqiv descriptor
# if find one update that jhls with newly created jhls id
              if (($Awfif::jhls-> {l} [$lola[$i]][15] [0])
              && ($Awfif::wsol-> {l} [($atelhwso = awsoadr ( trwsoadr($sponsor,-1)))] [2] != 0)
              && ( ($teldesc = findtdesc ($Awfif::wsol-> {l} [ ($atelhwso)] [2], $Awfif::memes-> {snnh} {mindequiv})) != 0 )
              ){

                $Awfif::jhls-> {l} [($Awfif::workspace-> {l} [$teldesc][2] - $Awfif::memes-> {snnh} {wsi})][15][2] = $newjhlsi;
                }; #if
              if (writeiecok ($sponsor)
              ){

                $Awfif::jhls-> {l} [$newjhlsi][16][2] = addbice ($Awfif::memes-> {currentwsbi} , $as, $ae, $sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
                $Awfif::jhls-> {l} [$newjhlsi][15][1] = 't';
                $Awfif::jhls-> {l} [$newjhlsi][16][0] = $as;
                $Awfif::jhls-> {l} [$newjhlsi][16][1] = $ae;
# if the new jhls is indeqiv then write a descriptor in the sponsor
                $Awfif::wsol-> {l} [$asponsor][2]
                  = setupdesc ( $Awfif::memes-> {snnh} {zero},
                  ($newjhlsi + $Awfif::memes-> {snnh} {wsi}),
                  $Awfif::memes-> {snnh} {indequiv},
                  $Awfif::wsol-> {l} [$asponsor] [2],
                  $asponsor);
                };#if
# $lola[$i] is the index of the jhls when $lomatchs[$i] is true so can copy over its attributes

              $atti = $Awfif::jhls-> {l} [$lola[$i]] [5];
              $atti = $Awfif::attribs-> {l} [$atti][1];#move past the start attribute
              while (($Awfif::attribs-> {l} [$atti][2]) != $Awfif::memes-> {snnh}{attribe}) {

                &addjhlattrib ($Awfif::memes-> {snnh}{operon}, $Awfif::attribs-> {l} [$atti][3], $Awfif::attribs-> {l} [$atti][4]);
                $atti = $Awfif::attribs-> {l} [$atti][1];#next
                };

              &addjhlattribs ($Awfif::memes-> {snnh}{operon});
              $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcspjhlsi}] = $Awfif::slipnet-> {l} [$Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl} [$Awfif::memes-> {snnh}{operon}]] [2];#*** submacrok ***#
              $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}] = $Awfif::slipnet-> {l} [$Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl} [$Awfif::memes-> {snnh}{operon}]] [2];#*** submacrok ***#
# now add the sponsor info to the jhls
              $Awfif::jhls-> {l} [$Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]] [14][0] = $Awfif::memes-> {currentwsbi};#*** submacrok ***#
              $Awfif::jhls-> {l} [$Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]] [14][1] = $sponsor;#*** submacrok ***#
# and initialise the codelet count in the jhls
              $Awfif::jhls-> {l} [$Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]] [14][2] = 0;#*** submacrok ***#
# and initialise the codelet count in the jhls
              };#first time associating operon
            };#if
          };#if
        };#for
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("assieojhlcx\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    }# assieojhlc
#
#<!-- end tag sia -->
#<!-- start tag sss -->
#
sub ilaunchnc {# inversion of part of launchmodel
    my($myli, $sti, $strategy, $comptype, $giveup, $kwp, $kwpr, $sactset, $mparams, $usetrans, $transid, $transtatus, $subprogram, $jhlabeli, $jhlabeloi, $newli, $hiurg, $usepooling, $buildoffurg, $remvboosturg)=@_;
    my ($i, $linki, $cwsbi, $launched, $usedbice, $subp, $usedpooling );
    my ($labcount, $sigcount, $hchain, $bcount);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, @lab);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      print ("ilaunchnc myli $myli ws $pr ");
      if (defined ($strategy)) {
        print ("strategy $strategy ");
        };#if
      if (defined ($comptype)) {
        print ("comptype $comptype ");
        };#if
      if (defined ($$giveup)) {
        print ("giveup $$giveup ");
        };#if
      if (defined ($mparams)) {
        print ("mparams $mparams ");
        };#if
      if (defined ($usetrans)) {
        print ("usetrans $usetrans ");
        };#if
      if (defined ($$transid)) {
        print ("transid $$transid ");
        };#if
      if (defined ($subprogram)) {
        print ("subprogram $subprogram ");
        };#if
      if (defined ($hiurg)) {
        print ("hiurg $hiurg ");
        };#if
      if (defined ($$usepooling)) {
        print ("usepooling($$usepooling) ");
        };#if
      if (defined ($buildoffurg)) {
        print ("buildoffurg($buildoffurg) ");
        };#if
      if (defined ($remvboosturg)) {
        print ("remvboosturg($remvboosturg) ");
        };#if
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $launched = '';
# ilncupoolu3
    if ((defined ($$usepooling)) && ($$usepooling > 0)) {

      my ($linkp, $bcindex);
      $linkp = $$usepooling;
# ilncupoolu4
      $bcindex = matchbreakcodelet ($myli);
      while ($linkp != 0) {

        $Awfif::codelet-> {l} [ $Awfif::poolcl-> {l} [$linkp] [2] ] [38]++;#add to each element of the pool
        $linkp = $Awfif::poolcl-> {l} [$linkp] [0];
        if (($bcindex > 0) #handle break codelet
        && (matchbreakcodelet ($Awfif::poolcl-> {l} [$linkp] [2]) == 0) #not already in list
        ){

          $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::poolcl-> {l} [$linkp] [2];
          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l} [$myli] [36];
            };#if subprogram
          };#if
        };#while not at tail
      if ($bcindex > 0) {

        &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
        &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
        };#if
      }#if
    else {
    $labcount = $Awfif::memes-> {binds}-> {$strategy}->
          ($myli, $sti, \@lab, $kwp, $kwpr, \@$sactset);

    $usedbice = '';
    if ($Awfif::codelet-> {l} [$myli][36] > 0) {

      $subp = $Awfif::codelet-> {l} [$myli][36];
      };# if - or if 0 subp will be undef
    if ((($linki = getilab ($myli, $strategy, $labcount, \@lab, \$hchain, $subp)) != 0)
    && ($hchain != 0)
    ) {#usebice cache setup

      $sigcount = usebice ($Awfif::ilabhcl-> {l} [$linki][4], \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
      $usedbice = 't';
      }#if
    else {

      $bcount = 0;
      $sigcount = labinv2 ($myli, \@lab, $labcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'notoporstbinding');
      };#else
# apply the linking function of group completion
# if the groups labels result in a match with a signal then raise the signal
#

    if ($sigcount > 0) {
      for ($i = 0; $i < $sigcount; $i++) {
        if ($lomatchs[$i]) {#there is a link launch the model scout
# ilncufilu1

# unless this is an operon where it should be filtered out
          if (($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{operon}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{stbinding}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{subpstbinding})) {

            $Awfif::clp = ();
            if ((defined($myli))
            && ((!defined($Awfif::codelet-> {l} [$myli] [13]))
              or ((defined($Awfif::codelet-> {l} [$myli] [13])) && ($Awfif::codelet-> {l} [$myli] [13] == 0)))
            && (((defined ($Awfif::wsol-> {l} [awsoadr ($sti)] [8]) )
              && ( $Awfif::wsol-> {l} [awsoadr ($sti)] [8] != 0))
                      or (
                        $Awfif::wsol-> {l}[awsoadr ($sti)][ $Awfif::memes-> {wsologucount}]#*** submacrok ***#
                          != 0))) {&break()};
            $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
            if ( (defined ($buildoffurg)) && ($buildoffurg)
            ){#

              $Awfif::clp-> {urgency} *= $Awfif::memes-> {pappbu};
              };#if
            if ( (defined ($remvboosturg)) && ($remvboosturg) ) {

              if ( (defined ($hiurg)) && ($hiurg) ) {

                $Awfif::clp-> {urgency} = (($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchhim}) / $Awfif::memes-> {vbttoamxmult});#already hiurg
                }#if
              else {

                $Awfif::clp-> {urgency} = (($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchm}) / $Awfif::memes-> {vbttoamxmult});
                };#else
              }#if
            elsif ( (defined ($hiurg)) && ($hiurg) ) {

              $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchhim});
              }#elsif
            else {

              $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchm});
              };#else
            if ($Awfif::codelet-> {l}[$myli][19] ne '') {

              $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
              }#wsi set
            else {

              $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
              };
# ilnctgu
            if ( (defined ($usetrans)) && ( defined ($Awfif::jhls-> {l} [$lola[$i]][18])) ){#transactional protection
# there are transactionally protected members

              if ( ($usetrans > 0) ){#transaction id already allocated

                $Awfif::clp-> {action}-> {transid} = $usetrans;
                }#if
              else {#new transaction to setup

                $$transid = transalloc ($myli, $Awfif::memes-> {snnh} {transid}, $lola[$i], undef(), \$$transtatus);
                $Awfif::clp-> {action}-> {transid} = $$transid;
                };#else
              };#if
            if ((defined ($subprogram)) && ($subprogram > 0) ){#
# ilnctsubpu

              $Awfif::clp-> {action}-> {subpi} = $subprogram;
              }#if
            $Awfif::clp-> {strategy} = "tmodelscout";
            $Awfif::clp-> {action}-> {sponsor} = $sti;

            $Awfif::clp-> {action}-> {signal} = findsignal ($loconcs[$i]);
            $Awfif::clp-> {action}-> {schema} = $loconcs[$i];
            $Awfif::clp-> {action}-> {sws} = $Awfif::memes->{currentwsbi};
            $Awfif::clp-> {action}-> {wss} = $lostrts[$i];
            $Awfif::clp-> {action}-> {wse} = $loends[$i];
# ilncupoolu
            if (defined ($$usepooling)) {

              $usedpooling = 't';
              };#if
            if (($logb[$i] != 0)
            && ($logb[$i] != $loge[$i]) ){

              $Awfif::clp-> {action}-> {wsgs} = $logb[$i];
              $Awfif::clp-> {action}-> {wsge} = $loge[$i];
              };#operon has a gap
            $Awfif::clp-> {action}-> {jhlabeli} = $lola[$i];
# ilncolu
            $Awfif::clp-> {action}-> {jhlabeloi} = $Awfif::codelet-> {l} [$myli][30];
            $Awfif::clp-> {action}-> {wsoname} = 0;#models don't use a wso
# ilncmpu
            $newli = mcdsubmitcodelet ($myli, \$Awfif::clp, $mparams);
# ilncupoolu2

            if ($usedpooling){

              my ($linkp);
              $$usepooling = addpoolc ($newli, $$usepooling);#addpoolc will ensure the [38] of each codelet is the same across the elements in the list
              $linkp = $$usepooling;

              $Awfif::codelet-> {l} [ $Awfif::poolcl-> {l} [$linkp] [2] ] [38] = 1;#add to the pool
              };#if
            &trackcodelet ($myli, $newli, $Awfif::memes-> {snnh} {add});
            $launched = 't';
            $bcount++;
            if ( (defined ($$jhlabeli)) && (defined ($$jhlabeloi)) ){

              $$jhlabeli = $lola[$i];
              $$jhlabeloi = $Awfif::codelet-> {l} [$myli][30];
              };#if
            }; #if its not an operon
          };#launch the action scout
        };#for
      };
    if (!$launched) {

      break ();
      }#if
    elsif (!$usedbice) {

      &addilab ($myli, $strategy, $labcount, \@lab, addbice ($Awfif::memes-> {currentwsbi}, $bcount, 5, $sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge), $subp);
      };#elsif
      };#else
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ilaunchncx\n");
      };
    }# ilaunchnc
#
#<!-- start tag sia -->
#<!-- end tag sss -->
#
sub iasslnc {# inversion of part of ilaunchnc for subpid association
    my($myli, $sti, $strategy, $kwp, $kwpr, $sactset, $mparams, $usetrans, $transid, $subprogram, $jhlabeli, $jhlabeloi, $usetmass)=@_;
    my ($i, $cwsbi, $launched );

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      print ("iasslnc myli $myli ws $pr ");
      if (defined ($strategy)) {
        print ("strategy $strategy ");
        };#if
      if (defined ($mparams)) {
        print ("mparams $mparams ");
        };#if
      if (defined ($usetrans)) {
        print ("usetrans $usetrans ");
        };#if
      if (defined ($$transid)) {
        print ("transid $$transid ");
        };#if
      if (defined ($subprogram)) {
        print ("subprogram $subprogram ");
        };#if
      if (defined ($usetmass)) {
        print ("usetmass $usetmass ");
        };#if
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $launched = '';
    my ($iedesc, $found, $bicei, $sponsor, $labcount, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $bcount);
    my (@lab);
    $found = '';
    $labcount = $Awfif::memes-> {binds}-> {$strategy}->
          ($myli, $sti, \@lab, $kwp, $kwpr, \@$sactset);
    $sponsor = $Awfif::codelet-> {l} [$myli] [21];
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    if ( ( ($iedesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($sponsor)] [2], $Awfif::memes-> {snnh} {indequiv})) != 0)
    && (($bicei = $Awfif::workspace-> {l} [$iedesc] [3]) != 0)
    ){

      $sigcount = usebice ($bicei, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
      }#if
    else {

      if ( ($Awfif::memes-> {ssiasslncusetmass})
      && ((!defined($usetrans)) or ($usetrans == 0))
      && (defined ($usetmass))
      && ($usetmass)
      && ($usetmass ne $Awfif::tral-> {l} [(getsubptransid ($myli, $subprogram))] [3])#this is being called from a codelet that knows the transid of the subcascade codelets is in its schematas tmassl and is not referenced by subpl[11]
      ){# no point

        $sigcount = 0;
        }#if
      else {

        $sigcount = labinv2 ($myli, \@lab, $labcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'notoporstbinding');
        };#else
      };#if
# apply the linking function of group completion
# if the groups labels result in a match with a signal then raise the signal
#

    if ($sigcount > 0) {
      my ($done, $i1, $i2, $i3, $match);
      $done = '';
      for ($i = 0; ((!$done) && ($i < $sigcount)); $i++) {
        if ($lomatchs[$i]) {#there is a link

# unless this is an operon
          $done = 't';
          if (($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{operon}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{stbinding}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{subpstbinding})) {

            if ( (defined ($usetrans)) && ( defined ($Awfif::jhls-> {l} [$lola[$i]][18])) ){#transactional protection
# there are transactionally protected members

              if ( ($usetrans > 0) ){#transaction id already allocated

                $$transid = $usetrans;
                $found = 't';
                }#if
              elsif ((defined ($usetmass)) && ($usetmass) && ($usetmass eq $Awfif::tral-> {l} [($$transid = getsubptransid ($myli, $subprogram))] [3])) {#this is being called from a codelet that knows the transid of the subcascade codelets is in its schematas tmassl and is not referenced by subpl[11]

                if ($$transid > 0) {

                  $bcount++;
                  for ($i2 = 1; ((!$found) && ($i2 <= $Awfif::tral-> {i} [$$transid] [0])); $i2++){#each builder string in {i}

                    for ($i3 = 1; ((!$found) && ($i3 <= $Awfif::jhls-> {l} [$lola[$i]][18][0])); $i3++){#each builder string in {18}
                      if ($Awfif::tral-> {i} [$$transid][$i2] eq $Awfif::jhls-> {l} [$lola[$i]][18][$i3] ){

                        $found = 't';
                        };#if
                      };#for i3
                    };#for i2
                  };#if
                }
# iasslcu1
              else {#find the 'new' transaction setup by ilaunchnc

                $match = 1;
                $found = '';
# iasslcu2
# iterate until the transaction matches the builder to be sponsored
                for ($i1 = 1; ((!$found) && ($i1 <= $Awfif::subpl-> {l} [$subprogram] [11][0] )); $i1++ ){#each item in 11

                  for ($i2 = 1; ((!$found) && ($i2 <= $Awfif::tral-> {i} [$Awfif::subpl-> {l} [$subprogram] [11][$i1]] [0])); $i2++){#each builder string in {i}

                    for ($i3 = 1; ((!$found) && ($i3 <= $Awfif::jhls-> {l} [$lola[$i]][18][0])); $i3++){#each builder string in {18}
                      if ($Awfif::tral-> {i} [$Awfif::subpl-> {l} [$subprogram] [11][$i1]][$i2] eq $Awfif::jhls-> {l} [$lola[$i]][18][$i3] ){

                        $found = 't';
                        $match = $i1;#have a match for the codelet string between jhls of msublabel and builder strings in
                        };#if
                      };#for i3
                    };#for i2
                  };#for i1

                if ($found) {

                  $$transid = $Awfif::subpl-> {l} [$subprogram] [11][$match];#match the index to the transaction to be initiated
                  };#if
                };#else
              };#if

            if ($found) {

              $$jhlabeli = $lola[$i];#$done guards this $i
              $$jhlabeloi = $Awfif::codelet-> {l} [$myli][30];
              };#if
            }; #if its not an operon
          };#if use the link
        };#for
      }; #if
    if ( ( (!defined($bicei)) or ($bicei == 0)) && ($found)) {

      $bicei = addbice ($Awfif::memes-> {currentwsbi}, 1, 5, $sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
      $Awfif::workspace-> {l} [$iedesc] [3] = $bicei;
      };#stable answer can be cached
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("iasslncx ");
      if (defined ($$jhlabeli)) {
        print ("jhlabeli $$jhlabeli ");
        };#if
      if (defined ($$jhlabeloi)) {
        print ("jhlabeloi $$jhlabeloi ");
        };#if
      print ("ret ($found)\n");
      };
    return $found
    }# iasslnc
#
#<!-- start tag ctr -->
#
sub findsubpicnm {# inversion of part of iasslnc for subpid transaction match
    my($myli, $subprogram, $submatch)=@_;
    my ($i1, $i2, $found, $match, $cwsbi, $ftransid, $fi );
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findsubpicnm myli $myli subprogram $subprogram submatch $submatch ");
      };
# updated for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};

    $found = '';
    $match = 0;
    if ($subprogram > 0) {
# iterate until the transaction matches the builder to be sponsored
      for ($i1 = 1; ((!$found) && ($i1 <= $Awfif::subpl-> {l} [$subprogram] [11][0])); $i1++ ){#each item in 11

        for ($i2 = 1; ((!$found) && ($i2 <= $Awfif::tral-> {i} [$Awfif::subpl-> {l} [$subprogram] [11][$i1]] [0])); $i2++){#each builder string in {i}

          $ftransid = checksameas (undef(), $Awfif::subpl-> {l} [$subprogram] [11][$i1], $i2, \$fi);
          if ($Awfif::tral-> {i} [$ftransid][$fi] eq $submatch ){

            $found = 't';
            $match = $i1;#have a match for the codelet string between jhls of msublabel and builder strings in
            };#if
          };#for i2
        };#for i1
      };#if subprogram
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findsubpicnmx ret ($match)\n");
      };
    return $match
    }# findsubpicnm
#
#<!-- end tag ctr -->
#<!-- end tag sia -->
#<!-- start tag dli -->
#
sub icompletesc {
    my ($myli, $strategy, $sponsor, $cws, $kwp, $kwpr, $sactset, $rbdwso) = @_;
    my ($launch);
# complete schematic structure when detect end sequence
#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("icompletesc myli $myli strategy($strategy) sponsor($sponsor) ");
      };
    $launch = '';
    my (@typel, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $twso, $asponsor, $sldesc, $bdwso, $cwsbi, $aws);
    $twso = trwsoadr (fgrpend ($sponsor), 1);
    $asponsor = awsoadr ($sponsor);
    $typel[0] = wsbasetype (trwsoadr ($twso, -3));
    $typel[1] = wsbasetype (trwsoadr ($twso, -2));
    $typel[2] = wsbasetype (trwsoadr ($twso, -1));
    if ($strategy ne 'unbindbuilder'){

      $typel[2] = $Awfif::memes-> {snnh} {unbind};
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ( (ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset) == 1)
    ){#

      $bdwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$$cws);
      if (defined($rbdwso)){

        $$rbdwso = $bdwso;
        };#if
      my ($count, $descfits, $conforms);
      $Awfif::memes-> {currentwsbi} = $$cws;

      if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($bdwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
      && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
      && ( ($Awfif::memes-> {currentwsbi} = ($aws = ($Awfif::workspace-> {l} [$sldesc] [3] - $Awfif::memes-> {snnh} {wsi}))) != 0 )
      && (($count = ipartseqcount ('onematch', $myli, ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), trwsoadr(($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), 3), \$descfits, \$conforms, $Awfif::wsbl-> {wsoh} [$aws], $Awfif::wsbl-> {wsft} [$aws],
        $Awfif::memes-> {snnh} {tokencategory}, $typel [0],
        $Awfif::memes-> {snnh} {tokencategory}, $typel [1],
        $Awfif::memes-> {snnh} {tokencategory}, $typel [2])>0))
      && ($conforms)
      && ($descfits)
      ){#launch builder

        $launch = 't';
        };#if
      };#if binderc
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("icompletescx cws($$cws) ret($launch)\n");
      };
    return $launch
    }# icompletesc
#
#<!-- end tag aso -->
#<!-- start tag sia -->
#<!-- start tag ctr -->
#<!-- start tag ds -resweb -->
#
sub transalloc {# coordinate transactions and allocate transaction ids
    my($myli, $request, $jhls, $transid, $transtatus)=@_;
    my ($i, $linki, $c35iszero);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih}{$request};
      print ("transalloc request $pr($request) ");
      if (defined ($jhls)) {
        print ("jhls $jhls ");
        &itjhloutput ($jhls);
        };#if
      if (defined ($transid)) {
        print ("transid $transid ");
        };#if
      };
# updated for merged workspaces

    if (defined ($$transtatus)) {

      $$transtatus = 0;
      };
    if (defined ($transid)) {#initialise linki - if necessary it will be asigned

      $linki = $transid;
      };#if
    $c35iszero = '';
    if (($request == $Awfif::memes-> {snnh} {transid}) && (defined ($jhls)) ){#new transid

      $linki = addtra ($myli, $jhls);#setup the transaction tral element.
      if (!defined($Awfif::memes-> {transmgr} {$myli})) {#setup the transaction manager sponsor tmassl-> {s}
        &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {begin}, $Awfif::memes-> {snnh} {stran});
        };#if
      if (($linki != 0) && (defined ($$transtatus)) && (findtra ($linki, 't') != 0) ){

        $$transtatus = $Awfif::memes-> {snnh} {completed};
        }#if
      elsif (($linki != 0) && (defined ($$transtatus)) && (findtra ($linki, 't') == 0) ){

        $$transtatus = $Awfif::memes-> {snnh} {incomplete};
        };#elsif
      }#if
    elsif ( ( ($request == $Awfif::memes-> {snnh} {cassponsor}) && (defined ($transid))
    or (($request == $Awfif::memes-> {snnh} {casrelay}) && (defined ($transid))) )
    ){#new transid

      if (($transid != 0) && (findtra ($transid, 't') != 0) ){#completed

        if ( (defined ($$transtatus)) ){

          $$transtatus = $Awfif::memes-> {snnh} {completed};
          };#if
        }#if
      elsif (($transid != 0) && (findtra ($transid, 't') == 0) ){#incomplete

        if ( (defined ($$transtatus)) ){

          $$transtatus = $Awfif::memes-> {snnh} {incomplete};
          };#if
        }#elsif
      }#elsif cassponsor
    elsif ((($request == $Awfif::memes-> {snnh} {wascassponsor}) or ($request == $Awfif::memes-> {snnh} {wascasrelay})) && (defined ($transid)) ){#new transid

      if (($transid != 0) && (findtra ($transid, 't') != 0) ){#completed
# can release resources
# transalfreeu1

# &freetra ($transid);#instead must build a list of transactions that can be freed when all refering codelets have completed
        &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {end}, $Awfif::memes-> {snnh} {stran});
        if ( (defined ($$transtatus)) ){

          $$transtatus = $Awfif::memes-> {snnh} {deleted};
          };#if
        }#if
      elsif (($linki != 0) && (defined ($$transtatus)) && (findtra ($linki, 't') == 0) ){

        $$transtatus = $Awfif::memes-> {snnh} {incomplete};
        }#elsif
      }#elsif wascassponsor
# transalu1
    elsif (($request == $Awfif::memes-> {snnh} {casparticipant}) && (defined ($transid)) ){#participant completed
# The completion of a subprogram transaction part should update the sub-program's Awfif::subpl-> {l} [sub][11] referenced tral items as well as the transid referenced - since the transid's are likely to be different.
# The point is that any codelet that completes an aspect of the sub-program it is a part of represents the sub-program and should adjust its state.

      my ($cwsbi, $sponsor, $atelhwso, $index, $subp11i);
      $cwsbi = $Awfif::memes-> {currentwsbi};
      $index = 0; #must be defined
      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];#sws
      $sponsor = $Awfif::codelet-> {l} [$myli] [17];#sponsor
      if( ($Awfif::wsol-> {l} [($atelhwso = awsoadr ( trwsoadr($sponsor,-1)))] [2] != 0)
      ){

        $c35iszero = 't';
        &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, 0, $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [37]);#added 37 since was always adding since could not match the transmgrid
        };#if
      if (($transid != 0) && (($i = matchgsubtrans ($myli, $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [2], \$index, $transid)) != 0)
      && ($index != 0)
      ){#incomplete

        $Awfif::tral-> {w} [$i] [$index] = $Awfif::memes-> {snnh} {completed};
        &icskick ($Awfif::codelet-> {l} [$myli] [20]);
        if ( (defined ($$transtatus)) ){

          $$transtatus = $Awfif::memes-> {snnh} {accepted};
          };#if
        };#if
# transalswaitu1

      $subp11i = findsubpicnm ($myli, $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [2]);
      if ((subtrancomp ($myli, $subp11i))
      && ($Awfif::tral-> {w} [ $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ] [0] > 0)
      ){#schedule the waiting codelets
# transal34u1

        my ($linki, $trali);
        $Awfif::tral-> {w} [ $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ] [0] = ilwaiting ($Awfif::tral-> {w} [ $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ] [0], 't', \$Awfif::tral-> {w} [ $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ] [0], \$Awfif::tral-> {wt} [ $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ] [0]);
# check each transaction whose index is back referenced

        $linki = $Awfif::tral-> {sameash} [ $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ];
        while ((defined ($linki)) && ($linki != 0)) {
# find the procedure match within this backreferenced transaction

          if ($Awfif::memes-> {checkcompsameas}) {&break ()};
          $trali = matchsaelement (\@{$Awfif::tral-> {i} [$Awfif::sametl-> {l} [$linki] [2]]}, $Awfif::tral-> {l} [ $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ][3]);# need to compare to the subtransactions signaller string
# now mark this procedure complete
          if ($trali > 0) {

            $Awfif::tral-> {w} [$Awfif::sametl-> {l} [$linki] [2]] [$trali] = $Awfif::memes-> {snnh} {completed};
# now check if the transaction is complete
            if ((subtrancomp ($myli, $Awfif::sametl-> {l} [$linki] [2]))
            && ($Awfif::tral-> {w} [ $Awfif::sametl-> {l} [$linki] [2] ] [0] > 0)
            ){#schedule the waiting codelets

              $Awfif::tral-> {w} [ $Awfif::sametl-> {l} [$linki] [2] ] [0] = ilwaiting ($Awfif::tral-> {w} [ $Awfif::sametl-> {l} [$linki] [2] ] [0], 't', \$Awfif::tral-> {w} [ $Awfif::sametl-> {l} [$linki] [2] ] [0], \$Awfif::tral-> {wt} [ $Awfif::sametl-> {l} [$linki] [2] ] [0]);
              };#if
            };#if
          $linki = $Awfif::sametl-> {l} [$linki] [0];
          };#while
        };#complete wait
      if ($c35iszero) {

        my ($linki, $trali);# even if the transaction has not completed should still record the completion in the dependent transactions
        $linki = $Awfif::tral-> {sameash} [ $transid ];
        while ((defined ($linki)) && ($linki != 0)) {
# find the procedure match within this backreferenced transaction

          if ($Awfif::memes-> {checktcompsameas}) {&break ()};
          $trali = matchsaelement (\@{$Awfif::tral-> {i} [$Awfif::sametl-> {l} [$linki] [2]]}, $Awfif::codelet-> {l} [ $myli ][2]);# need to compare to the subtransactions signaller string
          if ($trali > 0) {

            $Awfif::tral-> {w} [$Awfif::sametl-> {l} [$linki] [2]] [$trali] = $Awfif::memes-> {snnh} {completed};
            };#if
          $linki = $Awfif::sametl-> {l} [$linki] [0];
          };#while

        $Awfif::codelet-> {l} [$myli] [35] = 0;#This transaction is complete
        };#if
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#elsif

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("transallocx ");
      if (defined ($$transtatus)) {
        $pr = $Awfif::memes-> {snnih} {$$transtatus};
        print ("transtatus $pr($$transtatus) ");
        };
      print ("ret ($linki)\n");
      };
    return $linki
    }# transalloc
#
#<!-- end tag ds -->
#
sub transmgr {# coordinate transactions and allocate transaction ids
    my($myli, $codelet, $request, $state, $awso, $rtype, $transid, $subpid, $stransmgrid, $descriptor4, $descriptor4mask, $descriptor4val)=@_;
    my ($i, $istate, $cwsbi);

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih}{$request};
      if (defined ($myli)) {
        print ("transmgr myli $myli codelet $codelet request $pr($request) ");
        }#if
      else {
        print ("transmgr myli () codelet $codelet request $pr($request) ");
        };#else
      if (defined ($state)) {
        $pr = $Awfif::memes-> {snnih}{$state};
        print ("state $pr($state) ");
        };#if
      if ((defined ($descriptor4)) && (defined ($descriptor4mask)) && (defined ($descriptor4val))) {
        $pr = $Awfif::memes-> {snnih}{$descriptor4};
        print ("descriptor4 $pr($descriptor4) mask ($descriptor4mask) val ($descriptor4val)");
        };#if
      };

    if (defined ($state)) {

      $istate = $state;
      }#if
    else {

      $istate = $Awfif::memes-> {snnh} {indequiv};
      };#else
    if (($request == $Awfif::memes-> {snnh} {begin})
    && (!defined ($Awfif::memes-> {transmgr} {$codelet}))
    ){

      if (($istate == $Awfif::memes-> {snnh} {indequiv})
      ){

        $Awfif::memes-> {transmgr} {$codelet} = 0;
        $Awfif::memes-> {transcount} {0}++;
        }#if
      elsif (($istate == $Awfif::memes-> {snnh} {stran}) ) {#begin as sponsor of a transaction

        $Awfif::memes-> {transcount} {$codelet} = 1;
        $i = ++$Awfif::memes-> {transmid};
        while ( ( $i == 0) or ( defined ($Awfif::memes-> {itransmgr} {$i}))
        ){

          $i = ++$Awfif::memes-> {transmid};
          };#while
        $Awfif::memes-> {transmgr} {$codelet} = $i;
        $Awfif::memes-> {itransmgr} {$i} = $codelet;
        }#elsif
      else {#assume its a participant of a transaction

        $Awfif::memes-> {transcount} {$codelet} = 1;
        $i = ++$Awfif::memes-> {transmid};
        while ( ( $i == 0) or ( defined ($Awfif::memes-> {itransmgr} {$i}))
        ){

          $i = ++$Awfif::memes-> {transmid};
          };#while
        $Awfif::memes-> {transmgr} {$codelet} = $i;
        $Awfif::memes-> {itransmgr} {$i} = $codelet;
        };#else
      }#if
    elsif (($request == $Awfif::memes-> {snnh} {add})
    && ((defined ($Awfif::memes-> {transmgr} {$codelet}))
      or (($istate == $Awfif::memes-> {snnh} {assoctran}) && (defined ($awso) && defined ($rtype)))
      or (($istate == $Awfif::memes-> {snnh} {assocdesc}) && (defined ($awso) && defined ($rtype))) )
    ){

      if (($istate == $Awfif::memes-> {snnh} {indequiv})
      ){

        $i = $Awfif::memes-> {transmgr} {$codelet};
        $Awfif::memes-> {itransmgr} {$i} = undef();
        $Awfif::memes-> {transmgr} {$codelet} = 0;
        $Awfif::memes-> {transcount} {$codelet} = 0;
        $Awfif::memes-> {transcount} {0}++;
        }#if
      elsif (($istate == $Awfif::memes-> {snnh} {assoctran})
      && (defined ($awso) && defined ($rtype))
      ){

        if ($rtype == $Awfif::memes-> {snnh} {stran}) {#if adding then the transmgrid will be allocated by addtmass

          &addtmass ($codelet, $awso, $rtype, undef(), $Awfif::memes-> {snnh} {codeletslice}, 35, $transid, $Awfif::memes-> {snnh} {codeletslice}, 36, $subpid);
          }#if
        else {

          &addtmass ($codelet, $awso, $rtype, undef(), $Awfif::memes-> {snnh} {codeletslice}, 35, $Awfif::codelet-> {l} [$codelet] [35], $Awfif::memes-> {snnh} {codeletslice}, 36, $Awfif::codelet-> {l} [$codelet] [36]);
          };#else
        }#elsif
# transmadescu1
      elsif (($istate == $Awfif::memes-> {snnh} {assocdesc})
      && (defined ($awso) && defined ($rtype))
      ){

        if ($rtype == $Awfif::memes-> {snnh} {stran}) {#during add the transmgrid is allocated by addtmass

          &addtmass ($codelet, $awso, $rtype, undef(), $Awfif::memes-> {snnh} {iterator}, $descriptor4, $descriptor4mask, $descriptor4val);
          }#if
        else {

          &addtmass ($codelet, $awso, $rtype, undef(), $Awfif::memes-> {snnh} {iterator}, $descriptor4, $descriptor4mask, $descriptor4val);
          };#else
        }#elsif
      elsif (($istate == $Awfif::memes-> {snnh} {assocf1})
      && (defined ($awso))
      ){

        &addtmass ($codelet, $awso, $Awfif::memes-> {snnh} {rtran}, $stransmgrid, $Awfif::memes-> {snnh} {assocf1}, $subpid, $descriptor4);
        }#elsif
      else {#assume its a transaction

        $Awfif::memes-> {transcount} {$codelet} = 1;
        $i = ++$Awfif::memes-> {transmid};
        while ( ( $i == 0) or ( defined ($Awfif::memes-> {itransmgr} {$i}))
        ){

          $i = ++$Awfif::memes-> {transmid};
          };#while
        $Awfif::memes-> {transmgr} {$codelet} = $i;
        $Awfif::memes-> {itransmgr} {$i} = $codelet;
        };#else
      }#elsif
    elsif (($request == $Awfif::memes-> {snnh} {update})
    && ((defined ($Awfif::memes-> {transmgr} {$codelet}))
      or (($istate == $Awfif::memes-> {snnh} {assoctran}) && (defined ($awso) && defined ($rtype)))
      or (($istate == $Awfif::memes-> {snnh} {assocdesc}) && (defined ($awso) && defined ($rtype)))
      or (($istate == $Awfif::memes-> {snnh} {assoccspon}) && (defined ($awso) && defined ($rtype)))
      or (($istate == $Awfif::memes-> {snnh} {disassoccspon}) && (defined ($awso) && defined ($rtype))) )
    ){

      if (($istate == $Awfif::memes-> {snnh} {indequiv})
      ){

        $i = $Awfif::memes-> {transmgr} {$codelet};
        $Awfif::memes-> {itransmgr} {$i} = undef();
        $Awfif::memes-> {transmgr} {$codelet} = 0;
        $Awfif::memes-> {transcount} {$codelet} = 0;
        $Awfif::memes-> {transcount} {0}++;
        }#if
      elsif (($istate == $Awfif::memes-> {snnh} {assoctran})
      && (defined ($awso) && defined ($rtype))
      ){

        if ($rtype == $Awfif::memes-> {snnh} {stran}) {

          &updtmass ($codelet, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {codeletslice}, 35, $transid, $Awfif::memes-> {snnh} {codeletslice}, 36, $subpid);
          }#if
        else {

          &updtmass ($codelet, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {codeletslice}, 35, $Awfif::codelet-> {l} [$codelet] [35], $Awfif::memes-> {snnh} {codeletslice}, 36, $Awfif::codelet-> {l} [$codelet] [36]);
          };#else
        }#elsif
# transmadescu2
      elsif (($istate == $Awfif::memes-> {snnh} {assocdesc})
      && (defined ($awso) && defined ($rtype))
      ){

        if ($rtype == $Awfif::memes-> {snnh} {stran}) {

          &updtmass ($codelet, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {iterator}, $descriptor4, $descriptor4mask, $descriptor4val);
          }#if
        else {

          &updtmass ($codelet, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {iterator}, $descriptor4, $descriptor4mask, $descriptor4val);
          };#else
        }#elsif
# transmacasspu1
      elsif (($istate == $Awfif::memes-> {snnh} {assoccspon})
      && (defined ($awso) && defined ($rtype))
      ){

        &updtmass ($myli, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {cassponsor}, $Awfif::memes-> {snnh} {notcasrelay}, (0 + $Awfif::memes-> {snnh} {wsi}), $descriptor4);
        }#elsif
      elsif (($istate == $Awfif::memes-> {snnh} {assoccrel})
      && (defined ($awso) && defined ($rtype))
      ){

        &updtmass ($myli, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {cassponsor}, $Awfif::memes-> {snnh} {casrelay}, (0 + $Awfif::memes-> {snnh} {wsi}), $descriptor4);
        }#elsif
# transmaasspu2
      elsif (($istate == $Awfif::memes-> {snnh} {disassoccspon})
      && (defined ($awso) && defined ($rtype))
      ){

        &updtmass ($myli, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {cassponsor}, $Awfif::memes-> {snnh} {notcasrelay}, (1 + $Awfif::memes-> {snnh} {wsi}), $descriptor4);
        }#elsif
      elsif (($istate == $Awfif::memes-> {snnh} {disassoccrel})
      && (defined ($awso) && defined ($rtype))
      ){

        &updtmass ($myli, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {cassponsor}, $Awfif::memes-> {snnh} {casrelay}, (1 + $Awfif::memes-> {snnh} {wsi}), $descriptor4);
        }#elsif
# transmaasf1u1
      elsif (($istate == $Awfif::memes-> {snnh} {assocf1})
      && (defined ($awso))
      ){

        &updtmass ($codelet, $awso, $Awfif::memes-> {snnh} {rtran}, $stransmgrid, $Awfif::memes-> {snnh} {assocf1}, $subpid, $descriptor4);
        }#elsif
      else {#assume its a transaction

        $Awfif::memes-> {transcount} {0}--;
        $Awfif::memes-> {transcount} {$codelet} = 1;
        $i = ++$Awfif::memes-> {transmid};
        while ( ( $i == 0) or ( defined ($Awfif::memes-> {itransmgr} {$i}))
        ){

          $i = ++$Awfif::memes-> {transmid};
          };#while
        $Awfif::memes-> {transmgr} {$codelet} = $i;
        $Awfif::memes-> {itransmgr} {$i} = $codelet;
        };#else
      }#elsif
    elsif ( ($request == $Awfif::memes-> {snnh} {remove})
    && (defined ($awso))
    && (defined ($rtype))
    && (defined ($subpid))
    ) {#treat as end

      if (($istate == $Awfif::memes-> {snnh} {assocf1})
      ){
        &remtmass ($myli, $awso, $rtype, $stransmgrid, $Awfif::memes-> {snnh} {assocf1}, $subpid);
        };#if

      }#elsif
    elsif ( ($request == $Awfif::memes-> {snnh} {end})
    && (defined ($Awfif::memes-> {transmgr} {$codelet}))
    ) {#treat as end

      if ($Awfif::memes-> {transmgr} {$codelet} == 0) {
        $Awfif::memes-> {transcount} {0}--;
        $Awfif::memes-> {transmgr} {$codelet} = undef();
        }#if
      else {
        $Awfif::memes-> {transcount} {$codelet} = undef ();
        $i = $Awfif::memes-> {transmgr} {$codelet};
        $Awfif::memes-> {transmgr} {$codelet} = undef();
        $Awfif::memes-> {itransmgr} {$i} = undef();
        };#else
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("transmgrx ");
      $pr = $Awfif::memes-> {transmgr} {$codelet};
      print ("ret ($pr)\n");
      };
    if ($Awfif::memes-> {transcount} {0} < 0) {

      &break();
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $Awfif::memes-> {transmgr} {$codelet}
    }# transmgr
#
#<!-- end tag sia -->
#<!-- start tag ds -resweb -->
#
sub firsttmgr {# coordinate transactions and allocate transaction ids
    my($myli, $atelhwso, $rtran, $transid, $subpid, $preview)=@_;
    my ($linki, $transmgrid, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("firsttmgr myli $myli atelhwso $atelhwso ");
      if (defined ($$subpid)) {
        print ("subpid $$subpid ");
        };#if
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {
      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {
      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {first}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {first}{$atelhwso}][2] > 0)) {

      my ($it, $inc, $found, $transidfound);
      $inc = 0;
      $found = '';
      $transidfound = '';
      $linki = $Awfif::tmassl-> {first}{$atelhwso};#starting at the first new entry work towards the head of the list
      while (($linki != 0) && (!$found)) {
        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) ); $it++ ) {
          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 35)
          ){
            $transmgrid = $linki;

            if (($tranp [0][$linki] [$it] [2] != 0)) {

              $$transid = $tranp [0][$linki] [$it] [2];
              $transidfound = 't';
              };#if
            $inc = $inc + 3;
            }#if
          elsif ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 36)
          && ((!defined($$subpid)) or ($$subpid == $tranp [0][$linki] [$it] [2]))
          ){

            $transmgrid = $linki;
            if (($tranp [0][$linki] [$it] [2] != 0)) {

              $$subpid = $tranp [0][$linki] [$it] [2];
              $found = 't';
              };#if
            $inc = $inc + 3;
            };#elsif
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#advance to the head
        };#while
      if (($found) && ((!defined ($preview)) or (!$preview)) && ($transmgrid != $Awfif::tmassl-> {first}{$atelhwso})) {#migrate the first to the next item from the tail

        my($ofp, $otp, $otn);
        $ofp = $Awfif::tmassl-> {l} [$Awfif::tmassl-> {first}{$atelhwso}] [0];
        $otp = $Awfif::tmassl-> {l} [$transmgrid] [0];
        $otn = $Awfif::tmassl-> {l} [$transmgrid] [1];
# link transmgrid neighbours together
        if ($otp > 0) {
          $Awfif::tmassl-> {l} [$otp] [1] = $otn;
          };#if
        $Awfif::tmassl-> {l} [$otn] [0] = $otp;
# move the transmgrid item between the first and its previous
        $Awfif::tmassl-> {l} [$transmgrid] [0] = $ofp;
        if ($ofp > 0) {
          $Awfif::tmassl-> {l} [$ofp] [1] = $transmgrid;
          };#if
        $Awfif::tmassl-> {l} [$transmgrid] [1] = $Awfif::tmassl-> {first}{$atelhwso};
        $Awfif::tmassl-> {l} [$Awfif::tmassl-> {first}{$atelhwso}] [0] = $transmgrid;
        }#elsif
      elsif ((($found) or ($transidfound)) && ((!defined ($preview)) or (!$preview))) {

        $Awfif::tmassl-> {first}{$atelhwso} = $Awfif::tmassl-> {l} [$Awfif::tmassl-> {first}{$atelhwso}][1];
        }#elsif
      elsif ((!defined ($preview)) or (!$preview)) {#remove the association

        &freetmass ($myli, $Awfif::tmassl-> {first}{$atelhwso}, $atelhwso);
        };#elsif
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("firsttmgrx ");
      $pr = $transmgrid;
      print ("ret transid $$transid subpid $$subpid ($pr)\n");
      };
    @tranp = ();
    return $transmgrid
    }# firsttmgr
#
sub gettmgr {# coordinate transactions and allocate transaction data
    my($myli, $atelhwso, $rtran, $transid, $subpid)=@_;
    my ($linki, $transmgrid, @tranp, @transarray, $transidlink, $transidfound, $ignoringactiveitems, $strategy, $cwsbi);
# gettmgr will associate a salient transmgrid with a rtran telhwso
# it then uses the subpid specified in an stran to associate the same transmgrid with the sponsor wso

    $cwsbi = $Awfif::memes-> {currentwsbi};
no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("gettmgr myli $myli atelhwso $atelhwso rtran $pr($rtran) ");
      if (defined ($$subpid)) {
        print ("subpid $$subpid ");
        };#if
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
    $strategy = $Awfif::codelet-> {l} [$myli] [2];#but tmassl-> {submitted} [$stransmgrid] is undefed when ivalw removes completed grabbed transaction
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $inc, $found, @salarray);
      $inc = 0;
      $ignoringactiveitems = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while ($linki != 0){

        $found = '';
        $transidfound = '';
        $transidlink = 0;
        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 35)
          && (
            ($Awfif::codelet-> {l} [$myli] [2] !~ /builder/i) or
            (($Awfif::codelet-> {l} [$myli] [2] =~ /builder/i) && ($Awfif::tmassl-> {submitted}[$linki] =~ /$strategy/i))
            )
          ){

            $transidlink = $linki;
            $transidfound = 't';
            }#if
          elsif ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 36)
          && ((!defined($$subpid)) or ($$subpid == $tranp [0][$linki] [$it] [2]))
          && (
            ($rtran == $Awfif::memes-> {snnh} {stran}) or
            ($Awfif::codelet-> {l} [$myli] [2] !~ /builder/i) or
            (($Awfif::codelet-> {l} [$myli] [2] =~ /builder/i) && ($Awfif::tmassl-> {submitted}[$linki] =~ /$strategy/i))
            )
          ){

            if (($tranp [0][$linki] [$it] [2] != 0)) {

              if ((!defined($Awfif::tmassl-> {l} [$linki][3])) or ($Awfif::tmassl-> {l} [$linki][3] == $Awfif::memes-> {snnh}{start})) {

                if (!$ignoringactiveitems) {

                  $inc = 0;
                  $ignoringactiveitems = 't';
                  };#if
                $salarray [$inc] = $Awfif::tmassl-> {salience} [$linki];
                $transarray [$inc++] = $linki;
                $found = 't';
                }#if
              elsif ((defined($Awfif::tmassl-> {l} [$linki][3]))
              && ($Awfif::tmassl-> {l} [$linki][3] == $Awfif::memes-> {snnh}{incomplete})
              ) {

                if (!$ignoringactiveitems) {

                  $salarray [$inc] = $Awfif::tmassl-> {salience} [$linki];
                  $transarray [$inc++] = $linki;
                  $found = 't';
                  };#if
                };#else
              };#if
            };#elsif
          };#for
        if (($transidfound)
        && (!$found) #no subpid in list
        && (!defined ($$subpid))
        && (
          ($Awfif::codelet-> {l} [$myli] [2] !~ /builder/i) or
          (($Awfif::codelet-> {l} [$myli] [2] =~ /builder/i) && ($Awfif::tmassl-> {submitted}[$transidlink] =~ /$strategy/i))
          )
        ) {

          $salarray [$inc] = $Awfif::tmassl-> {salience} [$transidlink];
          $transarray [$inc++] = $transidlink;
          }
        elsif ( ($transidfound)
        && ($found)
        && ($rtran == $Awfif::memes-> {snnh} {rtran})
        && (!defined ($Awfif::tmassl-> {salience} [$linki]))
        ) {

          $inc--;#this one is not valid because it is a subprogram and it has no salience yet
          };
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while

      if ($inc > 0){

        my ($tsum);
        if ( ($rtran == $Awfif::memes-> {snnh} {stran})
        or (!$found )
        ){

          $transmgrid = $transarray [0];#with specific subpid should just be one
          }#if
        else {

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$transmgrid][2])); $it ++) {
          if (($rtran == $Awfif::memes-> {snnh} {rtran})
          && ($tranp [0][$transmgrid] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice})
          ){

            $Awfif::codelet-> {l} [$myli] [$tranp [0][$transmgrid] [$it] [1]] = $tranp [0][$transmgrid] [$it] [2];
            $Awfif::codelet-> {l} [$myli] [37] = $transmgrid;
            if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {

              my ($pr);
              $pr = $tranp [0][$transmgrid] [$it] [1];
              print ("rtran set codelet->{l} [$myli][$pr] ");
              $pr = $Awfif::codelet-> {l} [$myli] [$tranp [0][$transmgrid] [$it] [1]];
              print ("=> $pr ");
              };#if
            }#if
          elsif (($rtran == $Awfif::memes-> {snnh} {stran})
          && ($tranp [0][$transmgrid] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice})
          && ($tranp [0][$transmgrid] [$it] [1] == 36)
          && (defined ($$subpid))
          ){

            $$subpid = $tranp [0][$transmgrid] [$it] [2];
            }#elsif
          elsif (($rtran == $Awfif::memes-> {snnh} {stran})
          && ($tranp [0][$transmgrid] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice})
          && (defined ($$transid))
          && ($tranp [0][$transmgrid] [$it] [1] == 35)
          ){

            $$transid = $tranp [0][$transmgrid] [$it] [2];
            };#elsif
          };#for
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("gettmgrx ");
      $pr = $transmgrid;
      if ( (defined ($$transid)) ){
        print ("transid $$transid ");
        };#if
      if ( (defined ($$subpid)) ){
        print ("subpid $$subpid ");
        };#if
      print ("ret ");
      print ("($pr)\n");
      };
    @tranp = ();
    return $transmgrid
    }# gettmgr
#
#<!-- end tag ds -->
#<!-- start tag sia -->
#
sub mapsubtotmgrid {# map a subprogramid to a transaction mgr id
    my($atelhwso, $rtran, $subpid)=@_;
    my ($linki, $transmgrid, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("mapsubtotmgrid atelhwso $atelhwso rtran $pr($rtran) subpid $subpid ");
      };#if
    $transmgrid = 0;
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $inc, $found);
      $inc = 0;
      $found = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && (!$found)){

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 36)
          && ($subpid == $tranp [0][$linki] [$it] [2])
          ){

            $transmgrid = $linki;
            $found = 't';
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mapsubtotmgridx ret ($transmgrid)\n");
      };
    @tranp = ();
    return $transmgrid
    }# mapsubtotmgrid
#
#<!-- start tag aso -->
#
sub mapnonsubtotmgrid {# select the best (== first non-zero 35) zero subpid to map back a transaction mgr id
    my($atelhwso, $rtran, $subpid, $transid, $usehead)=@_;
    my ($linki, $transmgrid, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("mapnonsubtotmgrid atelhwso $atelhwso rtran $pr($rtran) subpid $subpid ");
      if (defined ($$transid)) {
        print ("transid $$transid ");
        };#if
      if (defined ($usehead)) {
        print ("usehead ($usehead) ");
        };#if
      };#if
    $transmgrid = 0;
    if ($Awfif::memes-> {nomapnonsubtotm}){#vbot GA must not use transactions

      if (defined ($$transid)){

        $$transid = 0;
        };#if
      }#if
    elsif (($subpid == -1) or ($subpid == 0)) {

      if ($rtran == $Awfif::memes-> {snnh} {stran}) {

        @tranp = \@{$Awfif::tmassl-> {s}};
        }#if
      elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

        @tranp = \@{$Awfif::tmassl-> {r}};
        };#elsif
# see if get a transid and subpid from the transmgr
      if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

        my ($it, $inc, $found, $found0, $found35, $found35val);
        $inc = 0;
        $found = '';
        if ((defined ($usehead)) && ($usehead)) {
          $linki = $Awfif::tmassl-> {wsoh}{$atelhwso};
          }#if
        else {
          $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
          };#else
        while (($linki != 0) && (!$found)){

          $found0 = '';
          $found35 = 0;
          $found35val = 0;
          for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

            if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
            && ($tranp [0][$linki] [$it] [1] == 36)
            && ($tranp [0][$linki] [$it] [2] == 0)
            ){

              $found0 = 't';
              };#if

            if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
            && ($tranp [0][$linki] [$it] [1] == 35)
            && ($tranp [0][$linki] [$it] [2] > 0)
            ){

              $found35 = $tranp [0][$linki] [$it] [2];
              };#if
# mapnons35valu1
            if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
            && ($tranp [0][$linki] [$it] [1] == 35)
            && ($tranp [0][$linki] [$it] [2] == 0)
            && (defined ($tranp [0][$linki] [$it] [3]) )
            ){

              $found35val = $tranp [0][$linki] [$it] [3];
              };#if
            };#for
          if ( ($found35 != 0) && ($found0) ){

            $transmgrid = $linki;
            if (defined ($$transid)){

              $$transid = $found35;
              };#if
            $found = 't';
            }#if
          elsif ( ($found35val != 0) && ($found0) && (defined($Awfif::tral-> {sameash} [$found35val]))){
# mapnons35valu2

            $transmgrid = $linki;
            if (defined ($$transid)){

              $$transid = $found35val;
              };#if
            };#else
          if ((defined ($usehead)) && ($usehead)) {
            $linki = $Awfif::tmassl-> {l} [$linki][0];#move to the tail
            }#if
          else {
            $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
            };#else
          };#while
        };#if
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mapnonsubtotmgridx ");
      if (defined ($$transid)) {
        print ("transid $$transid ");
        };#if
      print ("ret ($transmgrid)\n");
      };
    @tranp = ();
    return $transmgrid
    }# mapnonsubtotmgrid
#
#<!-- end tag aso -->
#
sub maptmgrtosubpid {# map a transaction mgr id to a subpid
    my($atelhwso, $rtran, $transmgrid)=@_;
    my ($linki, $subpid, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("maptmgrtosubpid atelhwso $atelhwso rtran $pr($rtran) transmgrid $transmgrid ");
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $inc, $found);
      $inc = 0;
      $found = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && (!$found)){

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 36)
          && ($transmgrid == $linki)
          ){

            $subpid = $tranp [0] [$linki] [$it] [2];
            $found = 't';
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("maptmgrtosubpidx ret ($subpid)\n");
      };
    @tranp = ();
    return $subpid
    }# maptmgrtosubpid
#
#<!-- end tag sia -->
#
sub addtmgrdesc {# map a transaction mgr id to a subpid
    my($atelhwso, $rtran, $transmgrid, $from, $mask, $value)=@_;
    my ($linki, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("addtmgrdesc atelhwso $atelhwso rtran $pr($rtran) transmgrid $transmgrid ");
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($inc, $found);
      $inc = 0;
      $found = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && (!$found)){

        if ( ($transmgrid == $linki)
        ){

          $tranp [0] [$linki] [++$Awfif::tmassl-> {l} [$linki][2]] [0] = $Awfif::memes-> {snnh} {iterator};
          if (defined ($from)) {

            $tranp [0] [$linki] [$Awfif::tmassl-> {l} [$linki][2]] [1] = $from;
            };#if
          if (defined ($mask)) {

            $tranp [0] [$linki] [$Awfif::tmassl-> {l} [$linki][2]] [2] = $mask;
            };#if
          if (defined ($value)) {

            $tranp [0] [$linki] [$Awfif::tmassl-> {l} [$linki][2]] [3] = $value;
            };#if
          $found = 't';
          };#if
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addtmgrdescx\n");
      };
    @tranp = ();
    }# addtmgrdesc
#
sub updtmgrdesc {# map a transaction mgr id to a subpid
    my($atelhwso, $rtran, $transmgrid, $from, $mask, $value)=@_;
    my ($linki, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("updtmgrdesc atelhwso $atelhwso rtran $pr($rtran) transmgrid $transmgrid ");
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $inc, $found);
      $inc = 0;
      $found = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && (!$found)){

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($transmgrid == $linki)
          && ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{iterator} )
          && ($tranp [0][$linki] [$it] [1] == $from)
          ){

            if (defined ($mask)) {

              $tranp [0] [$linki] [$it] [2] = $mask;
              };#if
            if (defined ($value)) {

              $tranp [0] [$linki] [$it] [3] = $value;
              };#if
            $found = 't';
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("updtmgrdescx\n");
      };
    @tranp = ();
    }# updtmgrdesc
#
sub gettmgrdesc {# get the data from a transaction mgr based descriptor
    my($atelhwso, $rtran, $transmgrid, $from, $mask, $value)=@_;
    my ($linki, @tranp, $result);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("gettmgrdesc atelhwso $atelhwso rtran $pr($rtran) transmgrid $transmgrid ");
      };#if
    $result = '';
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $inc, $found);
      $inc = 0;
      $found = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && (!$found)){

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($transmgrid == $linki)
          && ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{iterator} )
          && ($tranp [0][$linki] [$it] [1] == $from)
          ){

            if ((defined ($tranp [0] [$linki] [$it] [2])) && ($tranp [0] [$linki] [$it] [2] == 0)) {
              $result = 't';
              };
            if (defined ($$mask)) {

              $$mask = $tranp [0] [$linki] [$it] [2];
              };#if
            if (defined ($$value)) {

              $$value = $tranp [0] [$linki] [$it] [3];
              };#if
            $found = 't';
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gettmgrdescx ");
      if (defined ($$mask)) {

        print ("mask $$mask ");
        }#if
      else {
        print ("no mask ");
        };#else
      if (defined ($$value)) {

        print ("value $$value ");
        }#if
      else {
        print ("no value ");
        };#else
      print ("ret ($result)\n");
      };
    @tranp = ();
    return $result
    }# gettmgrdesc
#
sub gettmgrgc {# get the summed gc state of a subprogram transaction set
    my($atelhwso, $rtran, $from)=@_;
    my ($found, $linki, @tranp, $result);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("gettmgrgc atelhwso $atelhwso rtran $pr($rtran) ");
      };#if
    $result = 't';
    $found = '';
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $inc);
      $inc = 0;
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0)){

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2])); $it ++) {

          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{iterator} )
          && ($tranp [0][$linki] [$it] [1] == $from)
          ){

            if ((defined ($tranp [0] [$linki] [$it] [2])) && ($tranp [0] [$linki] [$it] [2] == 1)) {
              $result = '';
              };
            $found = 't';
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if
    if (!$found) {
      $result = '';
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gettmgrgcx ");
      print ("ret ($result)\n");
      };
    @tranp = ();
    return $result
    }# gettmgrgc
#
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#
sub assandmaptran {# assign sameas and map a subprogramid to a transaction mgr id
    my($myli, $ci, $ic37, $atelhwso, $rtran, $subpid, $transid)=@_;
    my ($cwsbi, $c35, $c37, $defpid, $i, $doaddsamet);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("assandmaptran myli $myli ci($ci) ic37($ic37) atelhwso($atelhwso) rtran $pr($rtran) subpid($subpid) ");
      if (defined($transid)){
        print ("transid($transid) ");
        };#if
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
# now it should not be reasonable for there to be two transmgrids for the same subpid atelhwso pairing but this is the time we setup the transmgrid for a new atelhwso
    if (defined ($transid)){

      $defpid = $subpid;
      };#if
    if ((defined ($Awfif::memes-> {checksubpnesameas})) && (defined ($Awfif::subpl-> {l}[ $Awfif::memes-> {checksubpnesameas} ] [11] [$Awfif::subpl-> {l}[ $Awfif::memes-> {checksubpnesameas} ] [11] [0]])) && ($Awfif::subpl-> {l}[ $Awfif::memes-> {checksubpnesameas} ] [11] [$Awfif::subpl-> {l}[ $Awfif::memes-> {checksubpnesameas} ] [11] [0]] == $Awfif::codelet-> {l} [$ci] [35]) && ($Awfif::memes-> {checksubpnesameas} != $subpid) ){&break ()};
    if (
    (($subpid == 0) && ( (($c37 = mapnonsubtotmgrid ($atelhwso, $rtran, $subpid)) == 0) ) )
    or (($subpid > 0) && (
    (($c37 = mapsubtotmgrid ($atelhwso, $rtran, $subpid)) == 0) ) )
    or (!defined ($c35 = maptmgridtotransid ($atelhwso, $rtran, $c37, $Awfif::codelet-> {l} [$ci] [35]) ))
    ){

      &transmgr ($myli, $ci, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $atelhwso, $rtran, $transid, $defpid);#add proliferated copies
      if ($subpid > 0) {


    elsif ((defined ($c35 = maptmgridtotransid ($atelhwso, $rtran, $c37, $Awfif::codelet-> {l} [$ci] [35]) ) )
    && ($c35 != $Awfif::codelet-> {l} [$ci] [35])
    && ($Awfif::codelet-> {l} [$ci] [35] > 0)#if transid is 0 then this subtran is not transactionally managed
    && (!matchsubplset($myli, $ci, $c35, $Awfif::codelet-> {l} [$ci] [35]))
    && (notralitemcomp ($myli, $c35))
    ){
# there is a transactionid and transmgrid associated so setup sameas

      $doaddsamet = '';
      if (!defined ($Awfif::tral-> {sameas} [ $Awfif::codelet-> {l} [$ci] [35] ] [1] [0]) ){

        $doaddsamet = 't';
        };#if
      if ($Awfif::memes-> {checktsameas}) {&break ()};

      for ($i = 1; $i <= $Awfif::tral-> {i} [$Awfif::codelet-> {l} [$ci] [35]] [0]; $i++ ){

        if (!defined ($Awfif::tral-> {sameas} [$Awfif::codelet-> {l} [$ci] [35] ] [$i] [0])) {

          $Awfif::tral-> {sameas} [ $Awfif::codelet-> {l} [$ci] [35] ] [$i] [0] = $c35;
          if (defined ($Awfif::tmassl-> {proc} {$atelhwso})
          && ($Awfif::tral-> {i} [$Awfif::codelet-> {l} [$ci] [35]] [$i] eq $Awfif::tmassl-> {proc} {$atelhwso})
          ){

            $Awfif::tral-> {sameas} [ $Awfif::codelet-> {l} [$ci] [35] ] [$i] [1] = $Awfif::memes-> {snnh} {valid};
            }#if
          else {

            $Awfif::tral-> {sameas} [ $Awfif::codelet-> {l} [$ci] [35] ] [$i] [1] = $Awfif::memes-> {snnh} {qmark};
            };#else
          }#if
        elsif (($Awfif::tral-> {sameas} [ $Awfif::codelet-> {l} [$ci] [35] ] [$i] [1] == $Awfif::memes-> {snnh} {qmark})
        && (defined ($Awfif::tmassl-> {proc} {$atelhwso}))
        && ($Awfif::tral-> {i} [$Awfif::codelet-> {l} [$ci] [35]] [$i] eq $Awfif::tmassl-> {proc} {$atelhwso})
        ){#defined sameas

          $Awfif::tral-> {sameas} [ $Awfif::codelet-> {l} [$ci] [35] ] [$i] [1] = $Awfif::memes-> {snnh} {valid};
          };#else
        };#for
      if ($doaddsamet){
# now deploy a list element in the active transid pointing at this transid

        &addsamet ($ci, $c35, $atelhwso);
        };#if
      }#elsif
    elsif ((defined ($c35 = maptmgridtotransid ($atelhwso, $rtran, $c37, $Awfif::codelet-> {l} [$ci] [35]) ) )
    && ($c35 == $Awfif::codelet-> {l} [$ci] [35])
    && ($Awfif::codelet-> {l} [$ci] [35] > 0)#if transid is 0 then this subtran is not transactionally managed
    ){#we seem to be aligned and allocated

      if ((defined ($Awfif::memes-> {assansamebreak})) && ($Awfif::memes-> {assansamebreak}) ){ &break()};
      }#elsif
    else {#this should be when we are creating a new transaction so going to the head makes sense

      &transmgr ($myli, $ci, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $atelhwso, $rtran, $transid, $defpid);#add proliferated copies
      if ($subpid > 0) {


      };#else
    if (!defined ($c37) ){

      $c37 = $ic37;
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("assandmaptranx ret ($c37)\n");
      };
    return $c37
    }# assandmaptran
#
#<!-- end tag ds -->
#
sub maptmgridtotransid {# map a transaction mgr id to a transid
    my($atelhwso, $rtran, $transmgrid, $ctransid)=@_;
    my ($linki, $transid, @tranp);
# did start loop at tail. It means that can return an active transaction with all items completed rather than a newer incomplete item
# can switch to head, but this may have problems with finding the tail item when it is not complete
# could skip the item if its signal targets are all complete - but why are we creating more transactions when this one is not complete yet?

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("maptmgridtotransid atelhwso $atelhwso rtran $pr($rtran) transmgrid $transmgrid ");
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $inc, $found);
      $inc = 0;
      $found = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && (!$found)){

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 35)
          && ($transmgrid == $linki)
          && ($tranp [0] [$linki] [$it] [2] != 0)
          ){

            $transid = $tranp [0] [$linki] [$it] [2];
            $found = 't';
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
# but reject the transid/report not found if also find an assocf1 for the subpid
      if ($found) {
      }#if
    elsif ((defined ($ctransid)) && (defined ($Awfif::tral-> {sameas} [$ctransid] [1] [0]))) {#sameas setup

      $transid = $Awfif::tral-> {sameas}[$ctransid] [1][0];
      };#elsif

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("maptmgridtotransidx ret ($transid)\n");
      };
    @tranp = ();
    return $transid
    }# maptmgridtotransid
#
#<!-- end tag ctr -->
#<!-- start tag aso -->
#<!-- start tag vbt -->
#
sub checksameas {# see if there is a sameas match and can resolve the proc in which case use its transid
    my($myli, $itransid, $trindex, $findex)=@_;
    my ($i, $activetransid, $found);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("checksameas myli $myli itransid ($itransid) trindex($trindex) ");
      };#if

    $activetransid = $itransid;
    $$findex = $trindex;
# now ensure that the sameas applies to this procedure

    if ( defined ($Awfif::tral-> {sameas} [$itransid] [$trindex] [1] )
    && ($Awfif::tral-> {sameas} [$itransid] [$trindex] [1] == $Awfif::memes-> {snnh} {valid} )
    ){

      $activetransid = $Awfif::tral-> {sameas} [$itransid] [$trindex] [0];
      for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i} [$activetransid] [0])) ; $i++ ){
        if ($Awfif::tral-> {i} [$activetransid] [$i] eq $Awfif::tral-> {i} [$itransid] [$trindex]){

          $$findex = $i;
          $found = 't';
          };#if
        };#for
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("checksameasx findex($$findex) ret ($activetransid)\n");
      };
    return $activetransid
    }# checksameas
#
#<!-- end tag vbt -->
#<!-- end tag aso -->
#
sub assprocwtran {# assign sameas and map a subprogramid to a transaction mgr id
    my($myli)=@_;
    my ($cwsbi, $listi, $i, $found);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("assprocwtran myli $myli ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ((defined ($Awfif::tral-> {sameash} [$Awfif::codelet-> {l} [$myli] [35] ]))
    && ($Awfif::tral-> {sameash} [$Awfif::codelet-> {l} [$myli] [35] ] > 0)

    ){
# go through the back reference list updating any items that need to be resolved

      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
      $listi = $Awfif::tral-> {sameash} [$Awfif::codelet-> {l} [$myli] [35] ];
      do {
        $found = '';
        for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i} [$Awfif::sametl-> {l} [$listi] [2]] [0])); $i++ ){
          if (($Awfif::tral-> {i} [$Awfif::sametl-> {l} [$listi] [2]] [$i] eq $Awfif::codelet-> {l} [$myli] [2])) {

            $Awfif::tral-> {sameas} [ $Awfif::sametl-> {l} [$listi] [2] ] [$i] [1] = $Awfif::memes-> {snnh} {valid};
            $Awfif::tral-> {sameasaadd} [ $Awfif::sametl-> {l} [$listi] [2] ] [$i] [1] = awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli] [21],-1));
            $found = 't';
            };#if
          };#for
        } until ( ($listi == $Awfif::tral-> {sameast} [$Awfif::codelet-> {l} [$myli] [35]])
        or (($listi = $Awfif::sametl-> {l} [$listi] [0]) == 0) );
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("assprocwtranx \n");
      };
    }# assprocwtran
#
sub addtmatch {# assign sameasaadd
    my($myli, $ilinki, $atelhwso)=@_;
    my ($cwsbi, $i, $linki, $prelinki);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addtmatch myli $myli ilinki($ilinki) atelhwso($atelhwso) ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $linki = $ilinki;
    if (($prelinki = $Awfif::sametl-> {l} [$linki][0]) > 0) {
# look through the prelink transactions for validated relations
# if find a validation then check that it references this schematic address
# if that is so then can transfer the validity to the linki transaction sameas

      for ($i = 1; $i <= $Awfif::tral-> {i} [$Awfif::sametl-> {l} [$prelinki] [2] ] [0]; $i++) {
        if (($Awfif::tral-> {sameas} [$Awfif::sametl-> {l} [$prelinki] [2] ] [$i] [1] == $Awfif::memes-> {snnh} {valid})
        && ($Awfif::tral-> {sameasaadd} [$Awfif::sametl-> {l} [$prelinki] [2] ] [$i] [1] == $atelhwso)
        ){

          $Awfif::tral-> {sameas} [$Awfif::sametl-> {l} [$linki] [2]] [$i] [1] = $Awfif::tral-> {sameas} [$Awfif::sametl-> {l} [$prelinki] [2] ] [$i] [1];
          };#if
        }; #for
      };# if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addtmatchx \n");
      };
    }# addtmatch
#
sub matchsubplset {# map a transaction mgr id to a subpid
    my($myli, $ci, $c35, $ci35)=@_;
    my ($i, $match, $c35p, $ci35p);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchsubplset myli $myli ci $ci c35 $c35 ci35 $ci35 ");
      };#if
    $ci35p = '';
    $c35p = '';
    $match = '';
    if ($Awfif::codelet-> {l} [$ci] [36] > 0) {

      for ($i = 1; $i <= $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$ci] [36]] [11] [0]; $i++ ){
        if ($c35 == $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$ci] [36]] [11][$i]) {

          $c35p = 't';
          };#if
        if ($ci35 == $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$ci] [36]] [11][$i]) {

          $ci35p = 't';
          };#if
        };#for
      if (($ci35p ) && ($c35p) ){

        $match = 't';
        };#if
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchsubplsetx ret ($match)\n");
      };
    return $match
    }# matchsubplset
#
#
#
#<!-- start tag ds -resweb -->
#<!-- start tag ctr -->
#
sub assprocwtmass {# associate procedure with tmassl->proc if not assigned
    my($myli)=@_;
    my ($cwsbi, $atelhdr);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my($pr);
      $pr = trwsoadr ($Awfif::codelet-> {l} [$myli] [21],-1);
      print ("assprocwtmass myli $myli telhdr($pr) ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    if (!defined($Awfif::tmassl-> {proc} {($atelhdr = awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli] [21],-1)))})) {

      $Awfif::tmassl-> {proc} {$atelhdr} = $Awfif::codelet-> {l} [$myli] [2];
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::tmassl-> {proc} {$atelhdr};
      print ("assprocwtmassx proc($pr)\n");
      };
    }# assprocwtmass
#
#<!-- end tag ds -->
#<!-- end tag sia -->
#
sub gettmgrcslice {# get the data from a transaction mgr based descriptor
    my($atelhwso, $rtran, $transmgrid, $sliceid)=@_;
    my ($linki, @tranp, $result);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("gettmgrcslice atelhwso $atelhwso rtran $pr($rtran) transmgrid $transmgrid sliceid $sliceid ");
      };#if
    $result = 0;
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it);
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && ($result == 0)){

        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && ($result == 0)); $it ++) {

          if ( ($transmgrid == $linki)
          && ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == $sliceid)
          ){
# gettmgrcs35valu1

            if (($tranp [0][$linki] [$it] [2] == 0)
            && (defined ($tranp [0][$linki] [$it] [3]))
            && (defined ($Awfif::tral-> {sameash}[$tranp [0][$linki] [$it] [3]]))
            ) {

              $result = $tranp [0][$linki] [$it] [3];
              }#if completed transaction still referenced in dependent transaction
            else {

              $result = $tranp [0][$linki] [$it] [2];
              };#else general case
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gettmgrcslicex ret ($result)\n");
      };
    @tranp = ();
    return $result
    }# gettmgrcslice
#<!-- end tag ctr -->
#
sub normsaltransmgr {# return the normalized selected instance of transmgr to use
    my($sum, $inc, $transarray)=@_;
    my ($i, $sel, $tinstance, $transmgrid);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("normsaltrnsmgr sum $sum inc $inc ");
      };#if
    $tinstance = 1;
    $sel = 1 + int (rand($sum));
    for ($i = 0; (($i < $inc) && ($tinstance <= $sel)); $i++) {

      $tinstance += $Awfif::tmassl-> {salience} [($transmgrid = $$transarray [$i])];
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("normsaltransmgrx ret $transmgrid ");
      };
    return $transmgrid
    }# normsaltransmgr
#
sub calsaltransmgr {# return the summed salience from the set of participants
    my($inc, $salarray)=@_;
    my ($i, $sum);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("calsaltrnsmgr inc $inc ");
      };#if
    $sum = 1;
    for ($i = 0; $i < $inc; $i++) {

      $sum += $$salarray [$i];
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("calsaltransmgrx ret $sum ");
      };
    return $sum
    }# calsaltransmgr
#
#<!-- start tag ctr -->
#
sub addtmgrdropsal {# add a dropsalience descriptor link to a transaction mgr state
    my($atelhwso, $rtran, $transmgrid, $from, $mask, $type, $too)=@_;
    my ($i, $linki, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("addtmgrdropsal atelhwso $atelhwso rtran $pr($rtran) transmgrid $transmgrid from ($from) mask ($mask) type ($type) too ($too) ");
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($inc, $found);
      $inc = 0;
      $found = '';
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      while (($linki != 0) && (!$found)){

        if ( ($transmgrid == $linki)
        ){

          for ($i = 0; ((!$found) && ($i < $Awfif::tmassl-> {l} [$linki] [2])); $i++) {
            if ($tranp [0] [$linki] [$i] [0] == $Awfif::memes-> {snnh} {dropsalience}) {
              $found = 't';
              &updtmgrdropsal ($linki, $rtran, $from, $mask, $type, $too);
              };#if
            };#for
          if (!$found) {
            $tranp [0] [$linki] [++$Awfif::tmassl-> {l} [$linki][2]] [0] = $Awfif::memes-> {snnh} {dropsalience};
            $found = 't';
            if (defined ($from)) {

              $tranp [0] [$linki] [$Awfif::tmassl-> {l} [$linki][2]] [1] = $from;
              };#if
            if (defined ($mask)) {

              $tranp [0] [$linki] [$Awfif::tmassl-> {l} [$linki][2]] [2] = $mask;
              };#if
            if (defined ($type)) {

              $tranp [0] [$linki] [$Awfif::tmassl-> {l} [$linki][2]] [3] = $type;
              };#if
            if (defined ($too)) {

              $tranp [0] [$linki] [$Awfif::tmassl-> {l} [$linki][2]] [4] = $too;
              };#if
            };#if
          };#if
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addtmgrdropsalx\n");
      };
    @tranp = ();
    }# addtmgrdropsal
#
sub updtmgrdropsal {# map a transaction mgr id to a subpid
    my($ilink, $rtran, $from, $mask, $type, $too)=@_;
    my ($linki, @tranp);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$rtran};
      print ("updtmgrdropsal ilink $ilink rtran $pr($rtran) ");
      };#if
    if ($rtran == $Awfif::memes-> {snnh} {stran}) {

      @tranp = \@{$Awfif::tmassl-> {s}};
      }#if
    elsif ($rtran == $Awfif::memes-> {snnh} {rtran}) {

      @tranp = \@{$Awfif::tmassl-> {r}};
      };#elsif

    my ($it, $inc, $found);
    $inc = 0;
    $found = '';
    $linki = $ilink;

    for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

      if (
      ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{dropsalience} )
      ){

        if (defined ($mask)) {

          $tranp [0] [$linki] [$it] [2] = $mask;
          };#if
        if (defined ($from)) {

          $tranp [0] [$linki] [$it] [1] = $from;
          };#if
        if (defined ($type)) {

          $tranp [0] [$linki] [$it] [3] = $type;
          };#if
        if (defined ($too)) {

          $tranp [0] [$linki] [$it] [4] = $too;
          };#if
        $found = 't';
        };#if
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("updtmgrdropsalx\n");
      };
    @tranp = ();
    }# updtmgrdropsal
#
#<!-- end tag ctr -->
#<!-- start tag ctr -->
#
sub anysubpidcsponsor {# called to see if any tmassl {r} element includes a csponsor association.
    my($myli, $atelhwso)=@_;
    my ($found, $linki, $i);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("anysubpidcsponsor myli $myli atelhwso $atelhwso ");
      };#if

    $found = '';
    $linki = $Awfif::tmassl-> {wsoh}{$atelhwso};
    while (($linki != 0) && (!$found) ){

# if a cassponsor exists check if it is active
      for ($i = 1; ((!$found) && ($i <= $Awfif::tmassl-> {l}[$linki][2])); $i++) {

        if (($Awfif::tmassl-> {r}[$linki] [$i] [0] == $Awfif::memes-> {snnh} {cassponsor})
        && ($Awfif::tmassl-> {r}[$linki] [$i] [1] == $Awfif::memes-> {snnh} {notcasrelay})
        && ($Awfif::tmassl-> {r}[$linki] [$i] [2] == (0 + $Awfif::memes-> {snnh} {wsi}))
        ){

          $found = 't';
          };#if
        };#for
      $linki = $Awfif::tmassl-> {l} [$linki] [0];
      };#while

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("anysubpidcsponsorx ret ($found)\n");
      };
    return $found
    }# anysubpidcsponsor
#
sub aligncassphl {# called to see if any tmassl {r} element includes a csponsor association.
    my($myli, $atelhwso)=@_;
    my ($found, $result, $linki, $i);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("aligncassphl myli $myli atelhwso $atelhwso ");
      };#if

    $found = '';
    $result = $Awfif::memes-> {snnh} {wsi};
    $linki = $Awfif::tmassl-> {wsoh}{$atelhwso};
    while (($linki != 0) && (!$found) ){

# if a cassponsor exists check if it is active
      for ($i = 1; ((!$found) && ($i <= $Awfif::tmassl-> {l}[$linki][2])); $i++) {

        if (($Awfif::tmassl-> {r}[$linki] [$i] [0] == $Awfif::memes-> {snnh} {cassponsor})
        && ($Awfif::tmassl-> {r}[$linki] [$i] [2] == (0 + $Awfif::memes-> {snnh} {wsi}))
        && ($Awfif::tmassl-> {r}[$linki] [$i] [3] > (0 + $Awfif::memes-> {snnh} {wsi}))
        ){

          $found = 't';
          $result = $Awfif::tmassl-> {r}[$linki] [$i] [3];
          };#if
        };#for
      $linki = $Awfif::tmassl-> {l} [$linki] [0];
      };#while

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $result - $Awfif::memes-> {snnh} {wsi};
      print ("aligncassphlx ret ($result=>$pr)\n");
      };
    return $result
    }# aligncassphl
#
#<!-- end tag ctr -->
#<!-- end tag cr -->
#<!-- start tag aso -->
#
sub crsmann {
    my ($myli, $token, $targsel, $stwso, $sponsortype, $ivalc, $ival, $casefor, $target, $eos, $bws, $bbwso, $kwp, $kwpr, $sactset) = @_;
    my ($sponsor, $recordi, $lrecordi, $arecordi, $foundgap, $bcount, $cwsbi, $abbwso);
#
# checked for merged workspaces
    my ($proceed, $msws, $msb, $listi, $i);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    if (($proceed = ibawswalk ($myli, $sponsor, $stwso, 'binderp1', 'bindercs', \@$sactset, \$bcount, \$msws, \$msb, \$$bws, \$$bbwso) )){
      $foundgap = '';#undefined found -> no list; false found -> list but no missing models; true -> found missing models
      };#if
    if ($proceed) {#walk the workspace identifying case descriptors that are not associated with a model

      $Awfif::memes-> {currentwsbi} = $$bws;
      $abbwso = awsoadr ($$bbwso);
# now pickup the listlink
      if (($listi = findtdesc ($Awfif::wsol-> {l} [ $abbwso] [2], $Awfif::memes-> {snnh} {listlink})) != 0
      ){
# now convert the listi to reference the first list record

        $listi = ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi});
# now get the first record link descriptor and then turn it into the record wso index
        if ( (($recordi = findtdesc ($Awfif::wsol-> {l} [ ($arecordi = awsoadr ($listi))] [2], $Awfif::memes-> {snnh} {recordlink})) != 0)
        ){
# now check each record until get a match or run out - move in to the first record

          $recordi = ($Awfif::workspace-> {l} [$recordi] [2] - $Awfif::memes-> {snnh} {wsi});
          $arecordi = awsoadr ( $recordi);
          $foundgap = findgap ($myli, $arecordi, $Awfif::wsol-> {l} [$arecordi] [2], $Awfif::memes-> {snnh} {casinopp}, $sponsortype, $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {casemodel}, $Awfif::memes-> {snnh} {casedeploys}, $token, $Awfif::memes-> {snnh} {ivalue});
          };#if
# now process each record until reach end of stream

        while ( donelement ($myli, \$recordi, \$lrecordi, \$arecordi, \$$eos)
        ){
          $foundgap = findgap ($myli, $arecordi, $Awfif::wsol-> {l} [$arecordi] [2], $Awfif::memes-> {snnh} {casinopp}, $sponsortype, $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {casemodel}, $Awfif::memes-> {snnh} {casedeploys}, $token, $Awfif::memes-> {snnh} {ivalue});
          $recordi = ($Awfif::workspace-> {l} [$recordi] [2] - $Awfif::memes-> {snnh} {wsi});
          if (((defined ($foundgap)) && ($foundgap))
          && ($bcount == 1)
          ){#find all ivalue descriptors in the record so that can match them to parameterized model

            my (@modeled);
            $$ivalc = listival ($myli, $$bws, $lrecordi, $arecordi, \@$ival, $token, \@modeled);
# if find a record without a model

            for ($i = 0; (($i < $$ivalc) && ((!defined ($modeled[$i])) or (!$modeled[$i])) );$i++) {

              &findcot ($myli, $token, $targsel, \@$ival, $i, \$casefor, \$target);
              if ((defined ($target)) && (defined ($casefor))) {

                &depcmodel ($myli, $$bws, $lrecordi, $arecordi, $token, $casefor, $target);
                $target = undef ();
                $casefor = undef ();
                };#if report success
              };#for
            };#if
# check if the subprogram has been completed

          if ( (endsubpstream ($myli, $arecordi, $abbwso))
          && (bcsubpcompsub ($myli) )
          ){#its a subprogram's last record and the bcsubpc has completed

            $$eos = 't';
            }#if
          elsif ( ($Awfif::codelet-> {l} [$myli] [36] == 0)
          && ((findtdesc ($Awfif::wsol-> {l} [ $arecordi] [2], $Awfif::memes-> {snnh} {listend})) != 0)
          ){

            $$eos = 't';
            };#elsif
          };#while
        };#if
      };# if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("crsmannx ivalc($$ivalc) casefor($$casefor) target($$target) eos($$eos) bws($$bws) bbwso($$bbwso)\n");
      };
    }# crsmann
#
#<!-- end tag aso -->
#<!-- start tag cr -resweb -->
#<!-- start tag sia -->
#
sub aligntmgrr {# ensure that the transid in tmassl-> {r} is reflected in codelet [35]
    my($myli)=@_;
    my ($linki, $transid, @tranp, $deptransid, $transvalid, $cttlinki, $trali, $tlinki);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("aligntmgrr myli $myli ");
      };#if

    $transid = $Awfif::codelet-> {l} [$myli] [35];
    @tranp = \@{$Awfif::tmassl-> {r}};
# see if get a transid and subpid from the transmgr
    if ( ($Awfif::codelet-> {l} [$myli] [37] > 0) #is trans managed
    ) {

      my ($it, $found);

      $found = '';
      $linki = $Awfif::codelet-> {l} [$myli] [37];
      for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

        if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
        && ($tranp [0][$linki] [$it] [1] == 35) #got a transid
        ){
# aligntmgrr35valu1

          if (($tranp [0][$linki] [$it] [2] == 0)
          && (defined ($tranp [0][$linki] [$it] [3]))
          && (defined ($Awfif::tral-> {sameash}[$tranp [0][$linki] [$it] [3]]))
          ) {
# The active transaction has finished so generate a new transaction for the dependent procedure.

            $transvalid = checktlvalid ($myli, $linki, $it, \$trali, \$cttlinki, \$deptransid);
            if ($transvalid) {

              $tlinki = swicompst ($myli, $deptransid, $linki, $cttlinki, $cttlinki, $it, $trali);
              };#if
# aligntmgrr35valu2
# aligntmgrr35valu3
            }#if completed transaction still referenced in dependent transaction
          else {

            $transid = $tranp [0][$linki] [$it] [2];
            $found = 't';
            };#else general case
          };#if
        };#for
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("aligntmgrrx ");
      print ("ret ");
      print ("($transid)\n");
      };
    @tranp = ();
    return $transid
    }# aligntmgrr
#
sub swicompst {# switch dependent transactions of part completed transactions to newly allocated transaction
    my($myli, $deptransid, $linki, $itlinki, $cttlinki, $it, $trali)=@_;
    my ($tlinki, $transid, @tranp, @ctsameas);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("swicompst myli $myli deptransid($deptransid) linki($linki) cttlinki($cttlinki) it($it) ");
      };#if

    $tlinki = $itlinki;
    $transid = $Awfif::codelet-> {l} [$myli] [35];
    @tranp = \@{$Awfif::tmassl-> {r}};
# see if get a transid and subpid from the transmgr
    if ( ($Awfif::codelet-> {l} [$myli] [37] > 0) #is trans managed
    ) {

      if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
      && ($tranp [0][$linki] [$it] [1] == 35) #got a transid
      ){

        if (($tranp [0][$linki] [$it] [2] == 0)
        && (defined ($tranp [0][$linki] [$it] [3]))
        && (defined ($Awfif::tral-> {sameash}[$tranp [0][$linki] [$it] [3]]))
        ) {
# The active transaction has finished so generate a new transaction for the dependent procedure.

          if ( (defined ($Awfif::memes-> {alignt35valbreak}))
          && ($Awfif::memes-> {alignt35valbreak})
          ){

            &break();
            };#if
          &initnewtran ($myli, $linki, $it, $deptransid, $trali); #(a)
# invalidate deptransids sameas entry (e)

          $ctsameas [0] = $Awfif::tral-> {sameas} [$deptransid][$trali] [0];
          $ctsameas [1] = $Awfif::tral-> {sameas} [$deptransid][$trali] [1];
          $Awfif::tral-> {sameas} [$deptransid][$trali] [1] = $Awfif::memes-> {snnh} {invalid};
# and its list element (d)
# if all elements are invalid then can free the list element

# otherwise need to create a list linking this procedure to each dependent transaction
# regenerate the head and tail entries at deptransid (b)
          $Awfif::tral-> {sameash} [$deptransid] = $Awfif::tral-> {sameash} [ $ctsameas [0] ];
# remove the old head and tail entries (c) these must be procedure relative not transaction relative.

          $Awfif::tral-> {sameash} [ $ctsameas [0] ] = ();
          $Awfif::tral-> {sameast} [$deptransid] = $Awfif::tral-> {sameast} [ $ctsameas [0] ];
          $Awfif::tral-> {sameast} [ $ctsameas [0] ] = ();
# if could not remove the old list element in d then generate a new list for procedure within the transaction
# if could remove the old list element in d then
# reposition the list referenced transaction sameas entries to point to deptransid (f)
          $tlinki = $Awfif::tral-> {sameash} [ $tranp [0][$linki] [$it] [3] ];

          while ((defined ($tlinki)) && ($tlinki != 0)) {
            $Awfif::sametl-> {l} [$tlinki] [2] = $deptransid;
            $tlinki = $Awfif::sametl-> {l} [$tlinki] [0];
            };#while
          };#if
        };#if
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("swicompstx ");
      print ("ret($tlinki)\n");
      };
    @tranp = ();
    return $tlinki
    }# swicompst
#
sub checktlvalid {# ensure that the dependent transaction list is associated with a valid transaction
    my($myli, $linki, $it, $rtrali, $cttlinki, $deptransid)=@_;
    my ($transid, @tranp, $trali, $transvalid, $nottransvalid );

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("checktlvalid myli $myli linki($linki) it($it) ");
      };#if

    $transvalid = '';
    $transid = $Awfif::codelet-> {l} [$myli] [35];
    @tranp = \@{$Awfif::tmassl-> {r}};

    if (($tranp [0][$linki] [$it] [2] == 0)
    && (defined ($tranp [0][$linki] [$it] [3]))
    && (defined ($Awfif::tral-> {sameash}[$tranp [0][$linki] [$it] [3]]))
    ) {
# The active transaction has finished so generate a new transaction for the dependent procedure.

      if ( (defined ($Awfif::memes-> {alignt35valbreak}))
      && ($Awfif::memes-> {alignt35valbreak})
      ){

        &break();
        };#if
# loop through the list of dependent procedures with matching procedure name
      my ($tlinki, $sourcei, $found, $newsameas);
      $newsameas = '';#will become true if must allocate a new active transaction since the current one has a finished part
      $tlinki = $Awfif::tral-> {sameash} [ $tranp [0][$linki] [$it] [3] ];
# aligntmgrr35valu4
      while ((defined ($tlinki)) && ($tlinki != 0) && (!$newsameas)) {
# find the procedure match within this backreferenced transaction

        $$deptransid = $Awfif::sametl-> {l} [$tlinki] [2];
# For each of the subtrans that has been marked as sameas allocation completed
# can find matching strings in the dependent transactions.
# These matches can have transactions initiated
        for ($sourcei = 1; $sourcei <= $Awfif::tral-> {i} [ $tranp [0][$linki] [$it] [3] ][0]; $sourcei++ ){
# if no item in sameas is invalid allocate a new transaction otherwise this transactin has become active and the sameas is invalid so must allocate the same transaction to the rest of the dependent list
          $found = '';
          for ($trali = 1; $trali <= $Awfif::tral-> {i} [ $$deptransid ][0]; $trali++ ){
            if ($Awfif::tral-> {sameas} [ $$deptransid ][$trali] [1] == $Awfif::memes-> {snnh} {invalid} ){

              $found = 't';
              };#if
            };#for
          if (!$found) {

            if ($Awfif::tral-> {w} [ $tranp [0][$linki] [$it] [3] ][$sourcei] == $Awfif::memes-> {snnh} {completed}) {#this is a candidate

              $trali = matchsaelement (\@{$Awfif::tral-> {i} [$Awfif::sametl-> {l} [$tlinki] [2]]}, $Awfif::tral-> {i} [ $tranp [0][$linki] [$it] [3] ][$sourcei]);# need to compare to the subtransactions signaller string
              if (($trali > 0)
              && ($Awfif::tral-> {w} [ $$deptransid ] [$trali] != $Awfif::memes-> {snnh} {completed})
              && ($Awfif::tral-> {sameas} [ $$deptransid ] [$trali] != $Awfif::memes-> {snnh} {invalid})
              ){
# if no item in sameas is invalid, allocate a new transaction otherwise must allocate the same transaction

                $transvalid = 't';
                $$rtrali = $trali;
                $$cttlinki = $tlinki;
                }#if
              elsif ($trali > 0) {

                $nottransvalid = 't';
                };#else
              };#if
            };#if
          };#for

        $tlinki = $Awfif::sametl-> {l} [$tlinki] [0];
        };#while
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("checktlvalidx ");
      print ("trali($$rtrali) cttlink($$cttlinki) deptransid($$deptransid) ret($transvalid) ");
      print ("\n");
      };
    @tranp = ();
    return $transvalid
    }# checktlvalid
#
sub initnewtran {# initiate a new transaction for a dependent list if sameas is not invalid (a)
    my($myli, $linki, $it, $deptransid, $trali)=@_;
    my ($transid, @tranp, $defpid);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("initnewtran myli $myli linki($linki) it($it) deptransid($deptransid) trali($trali) ");
      };#if

    $transid = $Awfif::codelet-> {l} [$myli] [35];
    @tranp = \@{$Awfif::tmassl-> {r}};

    if (($tranp [0][$linki] [$it] [2] == 0)
    && (defined ($tranp [0][$linki] [$it] [3]))
    && (defined ($Awfif::tral-> {sameash}[$tranp [0][$linki] [$it] [3]]))
    ) {
# The active transaction has finished so generate a new transaction for the dependent procedure.

      $Awfif::codelet-> {l}[$myli] [35] = $deptransid;
      &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli][21],-1)), $Awfif::memes-> {snnh} {rtran}, $deptransid, $defpid);#add proliferated copies
      $Awfif::tral-> {sameas} [$deptransid] [$trali] [1] = $Awfif::memes-> {snnh} {invalid};
      if ($Awfif::codelet-> {l}[$myli] [36] == 0) {

        $Awfif::codelet-> {l}[$myli] [37] = mapnonsubtotmgrid (awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli][21],-1)), $Awfif::memes-> {snnh} {rtran}, 0, $deptransid);
        }#if
      else {

        $Awfif::codelet-> {l}[$myli] [37] = mapsubtotmgrid (awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli][21],-1)), $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$myli][36]);
        };#subprogram
      };#if dependent sub transaction is not completed and sameas mapping is qmark or valid

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("initnewtranx ");
      print ("\n");
      };
    @tranp = ();
    }# initnewtran
#
#<!-- start tag aso -->
#
sub getf1tmgr {# associate sub-programs with parents
    my($myli, $atelhwso, $asponsor, $subpid, $transid, $transmgrid, $csubs, $nocompleted)=@_;
    my ($result, @tranp, @f1sub, $cwsbi);

no strict 'refs';
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getf1tmgr myli $myli atelhwso $atelhwso ");
      if (defined ($subpid)) {
        print ("subpid $subpid ");
        };#if
      if ($Awfif::memes-> {tmasstrace}) {
        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
        &ittmassoutput (grwsoadr ($atelhwso), $Awfif::codelet-> {l} [$myli] [20]);
        $Awfif::memes-> {currentwsbi} = $cwsbi;
        };#if
      };#if

    $result = 0;
    @tranp = \@{$Awfif::tmassl-> {r}};
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      @f1sub = getf1list ($myli, $atelhwso, $subpid, $nocompleted);

      if (($f1sub [0] > 0)){

        my ($s35, $i, $i2, $compc, $trans, @f1comp);
        if ((defined ($csubs)) && ($$csubs [0] > 0)){
          for ($i = 1; $i <= $f1sub[0]; $i++) {#capture any completed subprograms

            $trans = $Awfif::subpl-> {l} [$f1sub[$i]][11] [$Awfif::subpl-> {l} [$f1sub[$i]][11][0]];
            if ($trans > 0) {

              $compc = 0;
              for ($i2 = 1; $i2 <= $Awfif::tral-> {i}[ $trans] [0];$i2++) {

                if ($Awfif::tral-> {w} [$trans] [$i2] == $Awfif::memes-> {snnh} {completed}) {

                  $compc++;
                  if (($compc == $Awfif::tral-> {i}[ $trans] [0]) #all active parts of the transaction are completed
                  && (matchaelement (\@$csubs, $f1sub [$i]) > 0)#if its also in the set of completed sub-programs then it is complete
                  ){

                    $f1comp [++$f1comp [0]] = $f1sub [$i];
                    };#if
                  };#if
                };#for
              };#if
            };#for
          };#if
        if ($f1comp [0] > 0) {

          $result = $f1comp [1 + int (rand($f1comp [0]))];#weighted to completed
          }#if
        else {

          $result = $f1sub [1 + int (rand($f1sub [0]))];#
          };#else
        $$transmgrid = mapsubtotmgrid ($asponsor, $Awfif::memes-> {snnh} {stran}, $result);
        $s35 = 35;
        &gettmass ($myli, $asponsor, $Awfif::memes-> {snnh} {stran}, $$transmgrid, $Awfif::memes-> {snnh} {codeletslice}, \$s35, \$$transid);
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getf1tmgrx ");
      if ( (defined ($$transmgrid)) ){
        print ("transmgrid $$transmgrid ");
        };#if
      if ( (defined ($$transid)) ){
        print ("transid $$transid ");
        };#if
      print ("ret ");
      print ("($result)\n");
      };
    @tranp = ();
    return $result
    }# getf1tmgr
#
sub getf1list {# associate sub-programs with parents
    my($myli, $atelhwso, $subpid, $nocompleted)=@_;
    my ($linki, @tranp, @f1sub, $cwsbi);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getf1list myli $myli atelhwso $atelhwso ");
      if (defined ($subpid)) {
        print ("subpid $subpid ");
        };#if
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    @tranp = \@{$Awfif::tmassl-> {r}};
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $found);
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      $f1sub [0] = 0;
      while ($linki != 0){

        $found = '';
        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{assocf1} )
          && (($subpid == -1)#want a list of all subpids
            or ($tranp [0][$linki] [$it] [1] == $subpid) )
          && (((!defined ($nocompleted) or (!$nocompleted)))
            or ((subpstate ($tranp [0][$linki] [$it] [2]) != $Awfif::memes-> {snnh} {completed})) )
          ){

            $f1sub [++$f1sub [0]] = $tranp [0][$linki] [$it] [2];
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getf1listx ");
      print ("ret ");
      print ("($f1sub[0])\n");
      };
    @tranp = ();
    return @f1sub
    }# getf1list
#
#<!-- end tag aso -->
#
sub getsubplist {# associate sub-programs with parents
    my($myli, $atelhwso, $nocompleted)=@_;
    my ($linki, @tranp, @f0sub, $cwsbi);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getsubplist myli $myli atelhwso $atelhwso ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    @tranp = \@{$Awfif::tmassl-> {r}};
# see if get a transid and subpid from the transmgr
    if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

      my ($it, $found);
      $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
      $f0sub [0] = 0;
      while ($linki != 0){

        $found = '';
        for ($it = 1; (($it <= $Awfif::tmassl-> {l} [$linki][2]) && (!$found)); $it ++) {

          if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
          && ($tranp [0][$linki] [$it] [1] == 36) #subprogram
          && ($tranp [0][$linki] [$it] [2] != 0) #exclude 0 from sub-program index list
          && (((!defined ($nocompleted) or (!$nocompleted)))
            or ((subpstate ($tranp [0][$linki] [$it] [2]) != $Awfif::memes-> {snnh} {completed})) )
          && (matchaelement (\@f0sub, $tranp [0][$linki] [$it] [2]) == 0 )
          ){

            $f0sub [++$f0sub [0]] = $tranp [0][$linki] [$it] [2];
            $found = 't';
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
        };#while
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getsubplistx ");
      print ("ret ");
      print ("($f0sub[0])\n");
      };
    @tranp = ();
    return @f0sub
    }# getsubplist
#
#<!-- start tag aso -->
#
sub spicompsub {# see if this subprogram transaction part is complete according to a completion report - Should only be used to encourage other codelets in the part to run
    my($myli, $strategy)=@_;
    my ($result, $subi, $sponsor, $subpid, $i, $isubpt, $cwsbi, $ftransid, $fi);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("spicompsub myli $myli ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $subpid = $Awfif::codelet-> {l} [$myli][36];
    $sponsor = $Awfif::codelet-> {l} [$myli][21];
    if (($subpid > 0)
    && (defined ($Awfif::subpl-> {l} [$subpid] [11][0]))
    ) {
# and transaction managed

      my ($sigcount, $bcwso, $abcwso, $cws, $reportdesc, $areportwso, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
      if ( (ifindb ($myli, $sponsor, $strategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@{$Awfif::memes-> {sactset}}) == 1)
      ){#

        $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
        $Awfif::memes-> {currentwsbi} = $cws;
        $abcwso = awsoadr ($bcwso);
        if (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {completed})) != 0 ){

          for ($isubpt = 1; ((!$result) && ($isubpt <= $Awfif::subpl-> {l} [$subpid] [11][0])); $isubpt++) {#look through subp for transaction match with caller

            if (($subi = matchsubtbname ($myli, $isubpt)) != 0) {#use the matching sub to check transaction status
              for ($i = 1; ((!$result) && ($i <= $Awfif::tral-> {i}[$Awfif::subpl-> {l} [$subpid] [11][$isubpt]] [0])); $i++) {#look at each

                $ftransid = checksameas (undef(), $Awfif::subpl-> {l} [$subpid] [11][$isubpt], $i, \$fi);
                if ($Awfif::tral-> {w}[$ftransid] [$fi] == $Awfif::memes-> {snnh} {completed}) {

                  $Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi});
                  $areportwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi}));
                  if (( (findbond ($Awfif::wsol-> {l} [ $areportwso] [2], $Awfif::codelet-> {l} [$myli] [36], $Awfif::memes-> {snnh} {completed}, $Awfif::memes-> {snnh} {subprogram})))) {

                    $result = 't';
                    };#if
                  };#if
                };#for $i
              };#if
            };#for $isubp
          };#if report defined
# then return true
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("spicompsubx ");
      print ("ret ");
      print ("($result)\n");
      };
    return $result
    }# spicompsub
#
sub bcsubpcompsub {# see if bcsubpc is complete according to a completion report - Should only be used to encourage other codelets in the part to run
    my($myli)=@_;
    my ($result, $sponsor, $subpid, $cwsbi);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("bcsubpcompsub myli $myli ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $subpid = $Awfif::codelet-> {l} [$myli][36];
    $sponsor = $Awfif::codelet-> {l} [$myli][21];
# if subpid
    if (($subpid > 0)
    && (defined ($Awfif::subpl-> {l} [$subpid] [11][0]))
    ) {
# and transaction managed

      my ($sigcount, $bcwso, $abcwso, $cws, $reportdesc, $areportwso, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
      if ( (ifindb ($myli, $sponsor, 'bindercs', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@{$Awfif::memes-> {sactset}}) == 1)
      ){#

        $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
        $Awfif::memes-> {currentwsbi} = $cws;
        $abcwso = awsoadr ($bcwso);
        if (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {completed})) != 0 ){

          $Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi});
          $areportwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi}));
          if (( (findbond ($Awfif::wsol-> {l} [ $areportwso] [2], $Awfif::codelet-> {l} [$myli] [36], $Awfif::memes-> {snnh} {completed}, $Awfif::memes-> {snnh} {subprogram})))) {

            $result = 't';
            };#if
          };#if
# then return true
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("bcsubpcompsubx ");
      print ("ret ");
      print ("($result)\n");
      };
    return $result
    }# bcsubpcompsub
#
sub matchsubtbname {# identify the callers buildername, see if it matches a transaction recipient and return true if it does
    my($myli, $isubpt)=@_;
    my ($result, $subpid, $i, $cwsbi, $procname, $codeletname);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchsubtbname myli $myli isubpt $isubpt ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = 0;
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $subpid = $Awfif::codelet-> {l} [$myli][36];
# identify the callers builder name
# now check for a match to the transaction sponsor
    for ($i = 1; ( (!$result) && ($i <= $Awfif::tral-> {i} [ $Awfif::subpl-> {l} [$subpid] [11][$isubpt] ] [0])); $i++) {
      if ($Awfif::tral-> {i} [$Awfif::subpl-> {l} [$subpid] [11][$isubpt] ] [$i] eq $codeletname) {

        $result = $i;
        };#if
      };#for

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchsubtbnamex ");
      print ("ret ");
      print ("($result)\n");
      };
    return $result
    }# matchsubtbname
#
#<!-- start tag sia -->
#<!-- start tag smo -->
#
sub compwfctran {# identify the evaluator's buildername, see if it matches a transaction recipient and complete it if it does
    my($myli, $procname, $sgjhlsi)=@_;
    my ($result, $i, $cwsbi, $codeletname, $vboti, $vbotg);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("compwfctran myli $myli procname($procname) ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ( $Awfif::codelet-> {l} [$myli] [35] > 0 ) {

      $result = 0;
# identify the callers builder name
# compwfctgmu1
# now if there is a genetic mapping apply it

      $vbotg = $Awfif::memes-> {vbottgenmax} - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [3] - $Awfif::memes->{snnh}{wsi});
      $vboti = $Awfif::memes-> {vbottpopmax} + 1 - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [2] - $Awfif::memes->{snnh}{wsi});
      if ( ($vboti > 1)
      && ( (defined ($Awfif::vbotha-> { gens} [0] [1]-> {vbotscbh} {$codeletname}))) #ensure it will find the builder in array
      && ( defined ($Awfif::vbotga-> {scmaph}-> {$sgjhlsi})) #check the mapped sgjhlsi exists
      && ( (defined ($Awfif::vbotga-> {scmapc} [$vboti][$Awfif::vbotga-> {scmaph}-> {$sgjhlsi}]))) #check the mapped builder is in the cache
      ){

        $codeletname = $Awfif::vbotga-> {scmap0} [1] [$Awfif::vbotga-> {scmaph}-> {$sgjhlsi}];
        };#if
# now check for a match to the transaction sponsor
      for ($i = 1; ( ($result == 0) && ($i <= $Awfif::tral-> {i} [ $Awfif::codelet-> {l} [$myli] [35] ] [0])); $i++) {
        if ($Awfif::tral-> {i} [$Awfif::codelet-> {l} [$myli] [35] ] [$i] eq $codeletname) {

          $result = $i;
          };#if
        };#for
# as long as wfc only contains simple transactions with no subprograms this completion mechanism should be ok - fingers crossed
      if (($result > 0) && ($Awfif::tral-> {w} [$Awfif::codelet-> {l} [$myli] [35] ] [$result] [1] != $Awfif::memes-> {snnh} {completed}) ){

        $Awfif::tral-> {w} [$Awfif::codelet-> {l} [$myli] [35] ] [$result] [1] = $Awfif::memes-> {snnh} {completed};
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("compwfctranx ");
      print ("ret ");
      print ("($result)\n");
      };
    return $result
    }# compwfctran
#
#<!-- end tag smo -->
#<!-- end tag sia -->
#<!-- end tag aso -->
#<!-- start tag aso -->
#
sub gettransstate {# get the subprogram transaction state for the caller - for non subprogram use chstoff1
    my($myli, $sponsor, $asponsor, $bindstring, $stransmgrid, $transid, $transtatus, $kwp, $kwpr, $sactset)=@_;
    my ($usetrans, $subpid, $cwsbi);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gettransstate myli $myli sponsor $sponsor(a:$asponsor) bindstring($bindstring) transtatus($$transtatus) ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $cws, $bcwso, $abcwso);
    if ( (ifindb ($myli, $sponsor, $bindstring, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset) == 1)
    ){#
      $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
      $Awfif::memes-> {currentwsbi} = $cws;
      $abcwso = awsoadr ($bcwso);
      $$transid = 0;#must be defined to be setup in gettmgr
      $subpid = $Awfif::codelet-> {l} [$myli] [36];
      $$stransmgrid = gettmgr ($myli, $asponsor, $Awfif::memes-> {snnh} {stran}, \$$transid, \$subpid);
      $usetrans = $$transid;
      if ($$transid == 0 ) {

        $$transid = undef();
        $$transtatus = $Awfif::memes-> {snnh} {transid};
        }#if
      else {

        $$transtatus = $Awfif::memes-> {snnh} {cassponsor};#unless shift to wascassponsor
        &transalloc ($myli, $Awfif::memes-> {snnh} {cassponsor}, undef(), $$transid, \$$transtatus);
        };#else

      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gettransstatex ret ($usetrans)\n");
      };
    return $usetrans #
    }# gettransstate
#
#<!-- start tag sss -->
#
sub signaltrans {# signal subtransactions
    my($myli, $asponsor, $atelhwso, $usetrans, $stransmgrid, $transid, $transtatus, $kwp, $kwpr, $sactset, $cwsbi, $hiurg)=@_;
    my ($depsubs);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("signaltrans myli $myli usetrans $usetrans transtatus($$transtatus) cwsbi $cwsbi ");
      if (defined ($hiurg)){
        print ("hiurg($hiurg) ");
        };#if
      };#if

    my ($dummy, $giveup);
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    &ilaunchnc ($myli, $dummy, 'cassuboppi', $Awfif::memes-> {snnh} {cascompsopp}, \$giveup, $kwp, $kwpr, \@$sactset,
      32, #mask out codelet-> {l} [32] i.e. {tfree}
      $usetrans,
      \$$transid,
      \$$transtatus
      ,$Awfif::codelet-> {l} [$myli] [36],
      undef (), #jhlabeli
      undef (), #jhlabelo1
      undef (), #newli
      $hiurg
      );
    $depsubs = 't';
    if (($usetrans == 0) && (defined ($transid) && ( ($transtatus == $Awfif::memes-> {snnh} {completed}) or ($transtatus == $Awfif::memes-> {snnh} {incomplete}))) ){#record the transid

      &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, $transid, $Awfif::codelet-> {l} [$myli] [36], $stransmgrid);
      &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {add}, $Awfif::memes-> {snnh} {assocf1}, $atelhwso, $Awfif::memes-> {snnh} {stran}, undef(), $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [37], $Awfif::codelet-> {l} [$myli] [36]);
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("signaltransx ret ($depsubs)\n");
      };
    return $depsubs #
    }# signaltrans
#
#<!-- end tag sss -->
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#
sub subptrachanged {# see if the subprogram codelets have changed transaction state
    my($myli, $subpid)=@_;
    my ($launch, $cwsbi, $change, $i, $sponsor, $transid);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::codelet-> {l} [$myli] [35];
      print ("subptrachanged myli $myli subpid $subpid ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [19];
    $sponsor = $Awfif::codelet-> {l} [$myli] [17];
    $transid = getsubptransid ($myli, $subpid);

    $launch = 't';#default to allowing builder to act
    $change = '';
    if (($subpid > 0)
    && ($transid > 0)
    ){

      if ( ($Awfif::tral-> {i} [$transid ] [0] > 0) #there are transactioally managed cascade codelets
      ){

        if (defined ($Awfif::tral-> {r} [$transid ] [0])){
          for ($i = 1; $i <= $Awfif::tral-> {i} [$transid ] [0]; $i++) {

            if ($Awfif::tral-> {w} [$transid ] [$i] != $Awfif::tral-> {c} [$transid ] [$i] ){ #there has been a change

              $change = 't';
              $Awfif::tral-> {c} [$transid ] [$i] = $Awfif::tral-> {w} [$transid ] [$i];
              };#if
            };#for
          if (!$change) {

            if (($Awfif::tral-> {r} [$transid ] [0]--) <= 0) {

              $Awfif::tral-> {r} [$transid ] [0] = $Awfif::memes-> {subptrachcount};
              $Awfif::memes-> {applyactive} = '';#let coderack get control & stimulate the cascade codelets
              if ($Awfif::memes-> {applycount} > $Awfif::memes-> {applycmin}) {

                $Awfif::memes-> {applycount} = $Awfif::memes-> {applycmin};
                };
              }#if
            else {
              $launch = '';
              };#else
            };#if
          }#if
        else {#setup r (running info) and c (copy of subtran state)

          $Awfif::tral-> {r} [$transid ] [0] = $Awfif::memes-> {subptrachcount};
          for ($i = 1; $i <= $Awfif::tral-> {i} [$transid ] [0]; $i++) {
            $Awfif::tral-> {c} [$transid ] [$i] = $Awfif::tral-> {w} [$transid ] [$i];
            };#for
          };#else - this should stimulate the cascade codelets to write into r when they run
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subptrachangedx ret ($launch)\n");
      };
    return $launch #
    }# subptrachanged
#
sub getsubptransid {# get the transid of sub cascade codelets from the schema tmassl
    my($myli, $subpid)=@_;
    my ($found, $cwsbi, $i, $listi, $sponsor, $asponsor, $transid);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::codelet-> {l} [$myli] [35];
      print ("getsubptransid myli $myli subpid $subpid ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [19];
    $sponsor = $Awfif::codelet-> {l} [$myli] [17];
    $listi = $Awfif::tmassl-> {wsot} {($asponsor=awsoadr ($sponsor))};
    $found = 0;
    while (($found == 0) && ($listi != 0)) {

      if (defined ($Awfif::tmassl-> {s} [$listi] [1] [0])) {

        for ($i = 0; $i <= $Awfif::tmassl-> {l} [$listi] [2] ; $i++) {
          if ($Awfif::tmassl-> {s} [$listi] [$i] [0] == $Awfif::memes-> {snnh} {codeletslice}) {

            if (($Awfif::tmassl-> {s} [$listi] [$i] [1] == 36)
            && ($Awfif::tmassl-> {s} [$listi] [$i] [2] == $subpid)
            ){

              $found = $listi;
              };#if
            };#if
          };#for
        };#if

      $listi = $Awfif::tmassl-> {l} [$listi] [1];
      };#while

    if ($found > 0) {#get the 35 value

      for ($i = 0; $i <= $Awfif::tmassl-> {l} [$found] [2] ; $i++) {
        if (($Awfif::tmassl-> {s} [$found] [$i] [0] == $Awfif::memes-> {snnh} {codeletslice})
        && ($Awfif::tmassl-> {s} [$found] [$i] [1] == 35)
        ){

          $transid = $Awfif::tmassl-> {s} [$found] [$i] [2];
          };#if
        };#for
      };#if found > 0

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $subpid;
      print ("subpid($pr)->cascade tid($transid) ");
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getsubptransidx ret ($transid)\n");
      };
    return $transid #
    }# getsubptransid
#
#<!-- end tag ds -->
#<!-- start tag aso -->
#
sub warb1 {# setup the binding for wait and relay workspace
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warb1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {waitarelay});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {schema});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {integration});

    if (defined ($$static)) {
      $$static = 't';#can depend on this being the same every return - can cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warbx ret ($labcount)\n");
      };
    return $labcount
    }# warb
#
sub warasb1 {# setup the association for wait and relay operons
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warasb1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {waitarelay});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {schema});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {qmark});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {qmark});

    if (defined ($$static)) {
      $$static = 't';#can depend on this being the same every return - can cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warasbx ret ($labcount)\n");
      };
    return $labcount
    }# warasb
#
sub warmab1 {# match a wait and relay operon
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount, $lbuffer, $content);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warmab1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {waitarelay});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {schema});
# now must find each <keyword> in $st1 snnh it into its index and labload it
    $lbuffer = $sti;
    while ($lbuffer =~ /<([\w]*)>/){

      $content = $1;
      $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {$content});
      $lbuffer =~ s/\Q<$1>/ /;
      };#while

    if (defined ($$static)) {
      $$static = 't';#can depend on this being the same every return - can cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warmabx ret ($labcount)\n");
      };
    return $labcount
    }# warmab
#
sub warmdob1 {# setup the association of do mergestreams with wait and relay operons
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warmdob1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {waitarelay});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {schema});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {do});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {mergestreams});

    if (defined ($$static)) {
      $$static = 't';#can depend on this being the same every return - can cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warmdobx ret ($labcount)\n");
      };
    return $labcount
    }# warmdob
#
sub warhdob1 {# setup the association of histone do with wait and relay operons
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warhdob1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {waitarelay});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {schema});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {hdo});

    if (defined ($$static)) {
      $$static = 't';#can depend on this being the same every return - can cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warhdobx ret ($labcount)\n");
      };
    return $labcount
    }# warhdob
#
sub warmsb1 {# setup the association of mergestreams stream with wait and relay operons
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warmsb1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {waitarelay});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {schema});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {mergestreams});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {stream});

    if (defined ($$static)) {
      $$static = 't';#can depend on this being the same every return - can cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warmsbx ret ($labcount)\n");
      };
    return $labcount
    }# warmsb
#
sub comparestb1 {# setup the binding for compare source target binder
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("comparestb1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {source});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {target});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {sequence});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {integration});

    if (defined ($$static)) {
      $$static = 't';#can depend on this being the same every return - can cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("comparestbx ret ($labcount)\n");
      };
    return $labcount
    }# comparestb
#
sub comparesti1 {# setup the labels for compare source target
    my($myli, $sti, $lab, $kwp, $kwpr, $sactset, $static)=@_;
    my ($labcount, $i);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("comparesti1 myli $myli sti $sti kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# updated for merged workspaces

    $labcount = 0;

    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {source});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {target});
    $labcount = labload (\@$lab, $labcount, $Awfif::memes-> {snnh} {schema});
    for ($i = $Awfif::codelet-> {l} [$myli][21]; $i != $Awfif::codelet-> {l} [$myli][22];$i = trwsoadr ($i,1)) {
      $labcount = labload (\@$lab, $labcount, wsbasetype ($i));
      };#for
    $labcount = labload (\@$lab, $labcount, wsbasetype ($Awfif::codelet-> {l} [$myli][22]));
    $labcount = labload (\@$lab, $labcount, wsbasetype ($sti));

    if (defined ($$static)) {
      $$static = '';#can't depend on this being the same every return - don't cache
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("comparesti1x ret ($labcount)\n");
      };
    return $labcount
    }# comparesti1
#
#<!-- end tag aso -->
#
sub submitcodelet {
    my ($myli, $clp, $deferred, $addbreak) = @_;
#
    my ($pflink, $plink, $utail, $tt, $f, $h, $w, $jhlsoi, $bcindex);
# create an active codelet
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("submitcodelet ");
      };
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if

    $tt = $Awfif::memes-> {codelett};
    $h = $Awfif::memes-> {codeleth};
    $w = $Awfif::memes-> {codeletw};
    $f = $Awfif::memes-> {codeletf};
    $utail = '';
    if (($Awfif::memes-> {codelett} == 0)
    && ($Awfif::memes-> {codeleth} == 0)) {

      $utail = 'T';
      }; #note need to update tail
    $pflink = $Awfif::memes-> {codeletf};
    if ($pflink != 0 ) {
# can reclaim one from the inactive list

      $Awfif::memes-> {submitted} = $pflink;
      $Awfif::memes-> {fcodelets}--;
      $plink = $Awfif::codelet-> {l} [$pflink][0];
      if ($plink != 0) {

        $Awfif::codelet-> {l} [$plink ][1]=0; #sentinal
        $Awfif::memes-> {codeletf} = $plink;
        }# if
      else {#zero the free head ptr

        $Awfif::memes-> {codeletf} = 0;
        }; # else
      if ((defined ($deferred)) && ($deferred)) {

        $Awfif::codelet-> {l} [$pflink][0] = $Awfif::memes-> {codeletdef};
        if ($Awfif::memes-> {codeletdef} != 0) {

          $Awfif::codelet-> {l} [$Awfif::memes-> {codeletdef}] [1] = $pflink;
          };#if
        $Awfif::memes-> {codeletdef} = $pflink;
        $Awfif::codelet-> {t} [$pflink] = $Awfif::memes-> {snnh} {deferred};
        }#if
# submitcudsel
      elsif (defined ($Awfif::clp-> {delayselect}) && ($Awfif::clp-> {delayselect} > 0) ){#wait queue

        $Awfif::codelet-> {l} [$pflink][0] = $Awfif::memes-> {codeletw};
        if ($Awfif::memes-> {codeletw} != 0) {

          $Awfif::codelet-> {l} [$Awfif::memes-> {codeletw}] [1] = $pflink;
          };#if
        $Awfif::memes-> {codeletw} = $pflink;
        $Awfif::codelet-> {t} [$pflink] = $Awfif::memes-> {snnh} {wait};
        }#if
      else {

        $Awfif::codelet-> {l} [$pflink][0] = $Awfif::memes-> {codeleth};
        $Awfif::memes-> {acodelets} ++;#new active codelet
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        if ($Awfif::memes-> {codeleth} != 0) {

          $Awfif::codelet-> {l} [$Awfif::memes-> {codeleth}] [1] = $pflink;
          };#if
        $Awfif::memes-> {codeleth} = $pflink;
        $Awfif::codelet-> {t} [$pflink] = $Awfif::memes-> {snnh} {active};
        };#else
# submitcmbcul
      if (($bcindex = matchbreakcodelet ($myli)) > 0) {

        if ((defined ($addbreak)) && ($addbreak) ){

          $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $pflink;
          if ($$clp-> {action}-> {subpi} != 0) {

            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $$clp-> {action}-> {subpi};
            }#if
          else {

            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          }#if
        else {
          $Awfif::memes-> {breakcodelet} [$bcindex] = $pflink;
          if ($$clp-> {action}-> {subpi} != 0) {

            $Awfif::memes-> {breaksubp} [$bcindex] = $$clp-> {action}-> {subpi};
            }#if
          else {

            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#else
        };#if
      &trackcodelet ($myli, $pflink, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36], $$clp);
      if (($jhlsoi = unpackclp ($myli, \$$clp, $pflink)) != 0) {

        $Awfif::jhls-> {l} [$jhlsoi] [14] [2]++;
        };#if
# submitcafbu2

      if (($Awfif::codelet-> {t} [$pflink] == $Awfif::memes-> {snnh} {active})
      &&($Awfif::codelet-> {l} [$pflink] [2] eq 'groupbuilder')
      ){

        &addfb ($pflink);#list added codelets by name
        };#if
      }# found free links
    else {
# if there weren't any then get a newone

      my ($transtype);
      $Awfif::memes-> {tcodelets}++;
# submitcietu1
      if (($$clp-> {action}-> {subpi} != 0) or ($$clp-> {action}-> {transid} != 0) ) {
        $transtype = $Awfif::memes-> {snnh} {rtran};
        }#if
      else {
        $transtype = $Awfif::memes-> {snnh} {indequiv};
        };#else
      if ((defined ($deferred)) && ($deferred)) {

        $Awfif::memes-> {codeletdef} = newcodeletl ($myli, \$$clp, $deferred);
        $Awfif::memes-> {submitted} = $Awfif::memes-> {codeletdef};
# submitcietu2
        &transmgr (undef(), $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {begin}, $transtype);
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        if (($bcindex = matchbreakcodelet ($myli)) > 0) {

          if ((defined ($addbreak)) && ($addbreak) ){

            $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {codeletdef};
            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            }#if
          else {

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::memes-> {codeletdef};
            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#if
        &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
        }#if
      elsif (defined ($Awfif::clp-> {delayselect}) && ($Awfif::clp-> {delayselect} > 0) ){#wait queue

        $Awfif::memes-> {codeletw} = newcodeletl ($myli, \$$clp);
        $Awfif::memes-> {submitted} = $Awfif::memes-> {codeletw};
# submitcietu3
        &transmgr (undef(), $Awfif::memes-> {codeletw}, $Awfif::memes-> {snnh} {begin}, $transtype);
        if (($bcindex = matchbreakcodelet ($myli)) > 0) {

          if ((defined ($addbreak)) && ($addbreak) ){

            $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {codeletw};
            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            }#if
          else {

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::memes-> {codeletw};
            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#if
        &trackcodelet ($myli, $Awfif::memes-> {codeletw}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
        }#elsif
      else {

        $Awfif::memes-> {acodelets} ++;#new active codelet
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        $Awfif::memes-> {codeleth} = newcodeletl ($myli, \$$clp);
        $Awfif::memes-> {submitted} = $Awfif::memes-> {codeleth};
# submitcietu4
        if (($bcindex = matchbreakcodelet ($myli)) > 0) {

          if ((defined ($addbreak)) && ($addbreak) ){

            $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {codeleth};
            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            }#if
          else {

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::memes-> {codeleth};
            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#if
        &trackcodelet ($myli, $Awfif::memes-> {codeleth}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
# submitcafbul

        if ($Awfif::codelet-> {l} [$Awfif::memes-> {codeleth}] [2] eq 'groupbuilder'){

          &addfb ($Awfif::memes-> {codeleth});#list added codelets by name
          };#if
        };#else
      }; #else
    if ($utail) {

      $Awfif::memes-> {codelett} = $Awfif::memes-> {codeleth};
      };# update tail
    $tt = $Awfif::memes-> {codelett};
    $h = $Awfif::memes-> {codeleth};
    $f = $Awfif::memes-> {codeletf};
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
    if (($Awfif::memes-> {submitted} > 0) && (($Awfif::codelet-> {l} [$Awfif::memes-> {submitted}][0] == $Awfif::memes-> {submitted}) or ($Awfif::codelet-> {l} [$Awfif::memes-> {submitted}][1] == $Awfif::memes-> {submitted})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr, $pr2);
      if ((defined ($deferred)) && ($deferred)) {
        $pr = $Awfif::memes-> {codeletdef};
        }#if
      else {
        $pr = $Awfif::memes-> {codeleth};
        };#else
      print ("submitcodeletx h $pr ");
      $pr2 = $Awfif::codelet-> {l} [$pr] [19];
      print ("ws($pr2)\n");
      };
    }#submitcodelet
#
#<!-- start tag aso -->
#<!-- start tag ds -resweb -->
#
sub cascadesponsor {
    my ($myli, $sponsor, $option, $strategy, $transid, $transtatus) = @_;
#
    my ($cwsbi, $realsponsor, $asponsor, $desci, $result, $found, $drefi, $href, $lhref, $group, $atelhwso, $csstate);
# manage description of cascade ownership
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$option};
      print ("cascadesponsor myli $myli sponsor $sponsor option $pr($option) ");
      };

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = 0;
    $realsponsor = 0;
# The cascade sponsor descriptors are deployed to the real sponsor wso
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $asponsor = awsoadr ($sponsor);

    $desci = $Awfif::wsol-> {l} [$asponsor][2];
    while (($desci != 0) && ($realsponsor == 0)) {
      if (($Awfif::workspace-> {l} [$desci][4] == $Awfif::memes-> {snnh}{groupcategory})
      ){

        $realsponsor = ($Awfif::workspace-> {l} [$desci][2] - $Awfif::memes-> {snnh} {wsi});
        $asponsor = awsoadr ($realsponsor);
        $atelhwso = awsoadr (trwsoadr ($realsponsor, -1));
        $group = $Awfif::workspace-> {l} [$desci][3];
        };
      $desci = $Awfif::workspace-> {l} [$desci][0];
      };
# cascmdesc1

    if (($realsponsor != 0)
    && (($option == $Awfif::memes-> {snnh}{cassponsor})
      or ($option == $Awfif::memes-> {snnh} {casrelay}))
    ){

      if ( (($csstate = findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {cassponsor})) == 0)
      ){

        $Awfif::wsol-> {l} [$asponsor][2]
        = setupmdesc ( $Awfif::memes-> {snnh}{wsi},
            $Awfif::memes-> {snnh}{wsi},
            $Awfif::memes-> {snnh}{cassponsor},
            $Awfif::wsol-> {l} [$asponsor] [2],
            $asponsor);
        if ($option == $Awfif::memes-> {snnh} {casrelay}) {#flag that this cassponsor is a relay

          $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor][2]] [12] = $option;
          };#if relay
        if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

          $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor][2]] [11] = $Awfif::codelet-> {l} [$myli] [37];
          };#if
        }#if
      elsif ($Awfif::workspace-> {l} [$csstate][3] == (1 + $Awfif::memes-> {snnh}{wsi})
      ) {

          $Awfif::workspace-> {l} [$csstate] [3]--;
          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            $Awfif::workspace-> {l} [$csstate] [2] = aligncassphl ($myli, $atelhwso);#must align the cswso headlink
            };#if
        };#elsif
      &findmdesc ($Awfif::wsol-> {l} [$asponsor][2], ($Awfif::memes-> {snnh}{cassponsor}), $Awfif::memes-> {snnh}{wsi}, \$drefi);
      $href = ($Awfif::workspace-> {l} [$drefi] [2] - $Awfif::memes-> {snnh}{wsi});
      if (($href == 0) ) {

        my ($start, $end, $i, $pastend, $grefi);
        if (($Awfif::workspace-> {l} [$drefi] [12] != $Awfif::memes-> {snnh} {casrelay})) {

          &findmdesc ($Awfif::wsol-> {l} [$asponsor][2], ($Awfif::memes-> {snnh}{groupstart}), $group, \$grefi);#watchout this is a special use of findmdesc - groupstart does not conform in general to the setupmdesc framework. Its part of inccounter framework
          $start = ($Awfif::workspace-> {l} [$grefi] [2] - $Awfif::memes-> {snnh}{wsi});
          &findmdesc ($Awfif::wsol-> {l} [$asponsor][2], ($Awfif::memes-> {snnh}{groupend}), $group, \$grefi);#watchout this is a special use of findmdesc - groupend does not conform in general to the setupmdesc framework. Its part of inccounter framework
          $end = ($Awfif::workspace-> {l} [$grefi] [2] - $Awfif::memes-> {snnh}{wsi});
          $pastend = '';
          for ($i = $start; !$pastend; $i = trwsoadr ($i,1)) {

            $href = addcswso ($Awfif::codelet-> {l} [$myli] [20], $i, $href);
            $Awfif::workspace-> {l} [$drefi] [2] = $href + $Awfif::memes-> {snnh}{wsi};
            if ($i == $end) {

              $pastend = 't';
              };#if
            };#for
          };#if
# cascusubp1
# if this is a subpid then record the cassponsorship in a tmassl entry
        if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

          if (($Awfif::workspace-> {l} [$drefi] [12] != $Awfif::memes-> {snnh} {casrelay})) {
            &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoccspon}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$drefi] [2]);
            }#if
          else {
            &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoccrel}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$drefi] [2]);
            };#else
          };
        };#if
# cascumaskbo1
# since will now own the cascade remove backoffs for the previous cascade driver
      if (($Awfif::workspace-> {l} [$drefi] [12] != $Awfif::memes-> {snnh} {casrelay})) {

      $Awfif::codelet-> {l} [$myli] [32] = 1;
      }#if
    elsif ( ($realsponsor != 0)
    && (($option == $Awfif::memes-> {snnh}{wascassponsor}) or ($option == $Awfif::memes-> {snnh}{wascasrelay}))
    ){

      $found = '';
      $desci = $Awfif::wsol-> {l} [$asponsor][2];
      while (($desci != 0) && (!$found)) {
        if (($Awfif::workspace-> {l} [$desci][4] == $Awfif::memes-> {snnh}{cassponsor})
        ){
# cascusubp2

          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            if (($Awfif::workspace-> {l} [$desci] [12] != $Awfif::memes-> {snnh} {casrelay})) {

              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {disassoccspon}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$desci] [2]);
              }#if
            else {

              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {disassoccrel}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$desci] [2]);
              };
            };
# if this is the last subpid, or its not a subpid, then
          if (($Awfif::codelet-> {l} [$myli] [36] == 0) or (!anysubpidcsponsor ($myli, $atelhwso))) {

            if ($Awfif::workspace-> {l} [$desci][3] == (0 + $Awfif::memes-> {snnh}{wsi})) {

              $Awfif::workspace-> {l} [$desci][3]++;
              };#if
            $Awfif::codelet-> {l} [$myli] [32] = 0;
            $found = 't';
            if (defined ($Awfif::workspace-> {l} [$desci] [2])) {

              $href = ($Awfif::workspace-> {l} [$desci] [2] - $Awfif::memes-> {snnh}{wsi});
              while ($href != 0) {

                if ($href > 0) {

                  $lhref = $href;
                  $href = freecswso ($href);
                  }#if
                else {#some how its unexpectedly gone negative - look into it

                  &break ();
                  };#else
                };#while
              $Awfif::workspace-> {l} [$desci] [2] = $Awfif::memes-> {snnh}{wsi};
              }#if
            else {

              &break();
              };#else
            }#if
          elsif ($Awfif::codelet-> {l} [$myli] [36] > 0) {#set this instance to '0'

            $Awfif::workspace-> {l} [$desci] [2] = $Awfif::memes-> {snnh}{wsi}; };#elsif
          };#if
        $desci = $Awfif::workspace-> {l} [$desci][0];
        };#while
# cascumaskbo2
# since giving up ownership of cascade mask the suppressor descriptor link
      if (($option == $Awfif::memes-> {snnh}{wascassponsor})
      ){

        &mdropsalience ($asponsor);
        if ((defined ( $$transid)) && (defined ($$transtatus)) ){

          $$transid = transalloc ($myli, $Awfif::memes-> {snnh} {wascassponsor}, undef(), $$transid, \$$transtatus);
          };#if
        }#if
      else {

        if ((defined ( $$transid)) && (defined ($$transtatus)) ){

          $$transid = transalloc ($myli, $Awfif::memes-> {snnh} {wascasrelay}, undef(), $$transid, \$$transtatus);
          };#if
        };#else relay
      }#elsif
    elsif (($realsponsor != 0)
    && ($option == $Awfif::memes-> {snnh}{getcassponsor})
    ){
      $desci = $Awfif::wsol-> {l} [$asponsor][2];

      while (($desci != 0) && ($result == 0)) {
        if (($Awfif::workspace-> {l} [$desci][4] == $Awfif::memes-> {snnh}{cassponsor})
        && ($Awfif::workspace-> {l} [$desci][3] == (0+ $Awfif::memes-> {snnh}{wsi}))
        ){

          $result = 1;
          };
        $desci = $Awfif::workspace-> {l} [$desci][0];
        };
      }#elsif
    else {# reached here in error

      &break ();
      };#else
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("cascadesponsorx ret ($result)\n");
      };
    return $result
    }#cascadesponsor
#
#<!-- end tag ds -->
#<!-- start tag uts -->
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#<!-- start tag vbt -->
#
sub freecodelet {
    my ($codelet, $mode, $rcantd) = @_;
    my ($plink, $tt, $h, $f, $cantd, $ws, $cwsbi, $bcindex, $transmgd, $doremarrent, $response, $ctype);
#
# move the codelet datastructure to the inactive list
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $codelet;
      print ("freecodelet codelet $pr ");
      $pr = $Awfif::codelet-> {l} [$codelet] [19];
      print ("ws($pr) mode ($mode)\n");
      };
    $response = 1;#can keep deleting
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
# break if codelet matches breakcodelet
    if ( (($bcindex = matchbreakcodelet ($codelet)) > 0)
    && (($mode != 1) #this has been run
    or ($Awfif::codelet-> {l} [$codelet][23] == 0)
    or ( ($Awfif::codelet-> {l} [$codelet][23] != 0) && ($Awfif::memes-> {snw} [$ws]-> {snna} {$Awfif::memes-> {snnih} {$Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet] [23]] [6]}} > $Awfif::memes-> {killth}) ) )
    ){

      break ();
      $doremarrent = $bcindex;
      };#if
    $Awfif::memes-> {listrelinking} = 't';
    $ctype = $Awfif::codelet-> {t} [$codelet];
# freectmu1
# note if codelet is transaction managed
    if ($Awfif::codelet->{l} [$codelet] [37] > 0) {

      $transmgd = 't';
      }#if
    else {

      $transmgd = '';
      };#else
# handle codelets that can't be deleted due to activation or inhibition
# freecmdfup4

      if ((defined ($Awfif::memes-> {usetdfmod}))
      && ($Awfif::memes-> {usetdfmod})
      && ((!defined ($mode)) or ($mode != 1)) #failed to run
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgroupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tmodelscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnuclabmscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnsdepscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgoalscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'goalevaluator')
      ){#update transactional deployment failures

        if ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        && ($Awfif::codelet-> {l} [$codelet][36] > 0)
        ){#update transactional deployment failures

          if ($Awfif::subpl-> {q} [1] [ $Awfif::codelet-> {l} [$codelet][36] ] < $Awfif::memes-> {freeampth}) {
            $Awfif::subpl-> {q} [1] [ $Awfif::codelet-> {l} [$codelet][36] ]++;
            }#if
          else {

            if ( (defined ($Awfif::memes-> {freecabreak}))
            && ($Awfif::memes-> {freecabreak} )
            ){

              &break();
              };#if
            $Awfif::subpl-> {q} [1] [ $Awfif::codelet-> {l} [$codelet][36] ] = 0;
            $Awfif::subpl-> {q} [0] [ $Awfif::codelet-> {l} [$codelet][36] ] ++;
            };#else
          }#if
        elsif ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        ){

          $Awfif::memes-> {mainco} = $Awfif::memes-> {mainco} + 1;
          };#elsif
        }#if

      my ($nlink);
# freecmtailup1
      if (($Awfif::codelet->{l} [$codelet] [34] == 0)
      && (($codelet != $Awfif::memes-> {codeleth})
      or ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth}))) {# move to head
        if ($codelet == $Awfif::memes-> {codelett}) {#tail so special move

          $nlink = $Awfif::codelet-> {l} [$codelet][1];#nearer the head
          $Awfif::codelet-> {l} [$codelet][0] = $Awfif::memes->{codeleth};
          $Awfif::codelet-> {l} [$Awfif::memes->{codeleth}][1] = $codelet;
          $Awfif::memes->{codeleth} = $codelet;
          $Awfif::codelet-> {l} [$codelet][1] = 0;
          $Awfif::memes-> {codelett} = $nlink;
          $Awfif::codelet-> {l} [$nlink][0] = 0;
          }#if
        else {

          $plink = $Awfif::codelet-> {l} [$codelet][0];#towards the tail
          $nlink = $Awfif::codelet-> {l} [$codelet][1];#nearer the head
          $Awfif::codelet-> {l} [$codelet][0] = $Awfif::memes->{codeleth};
          $Awfif::codelet-> {l} [$Awfif::memes->{codeleth}][1] = $codelet;
          $Awfif::memes->{codeleth} = $codelet;
          $Awfif::codelet-> {l} [$codelet][1] = 0;
          $Awfif::codelet-> {l} [$plink][1] = $nlink;
          $Awfif::codelet-> {l} [$nlink][0] = $plink;
          };#else general move
        }# if can move
# frees34tup1
      elsif ( ($Awfif::codelet->{l} [$codelet] [34] != 0)
      && ($codelet == $Awfif::memes-> {codelett})
      && (freeswitch34tail ($codelet, $mode))
      ){

        my ($ltail);
        $ltail = $Awfif::memes-> {codelett};
        if ((freescheckcantd ($ltail)) ){

          if (($Awfif::memes-> {freectcantdbreak}) ){ &break ()};
          $response = 0;#stop delete or will just loop
          }#if
        else {

          $response = -1;
          };#else
        }#elsif
      else {

        $response = 0;#should stop trying to delete as waste of time
        };#else failed to move undeletable tail
      }#$cantd
    else {
# freecmdfup1

      if ((defined ($Awfif::memes-> {usetdfmod}))
      && ($Awfif::memes-> {usetdfmod})
      && ((!defined ($mode)) or ($mode != 1)) #failed to run
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgroupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tmodelscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnuclabmscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnsdepscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgoalscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'goalevaluator')
      ){#update transactional deployment failures

        if ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        && ($Awfif::codelet-> {l} [$codelet][36] > 0)
        ){#update transactional deployment failures

          $Awfif::subpl-> {q} [0] [ $Awfif::codelet-> {l} [$codelet][36] ]++;
          }#if
# freecmdfup2
        elsif ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        ){

          $Awfif::memes-> {mainco} = $Awfif::memes-> {mainco} + $Awfif::memes-> {maininc};
          };#elsif
        }#if
      elsif ((defined ($Awfif::memes-> {usetdfmod}))
      && ($Awfif::memes-> {usetdfmod})
      && ($mode == 1) #codelet has run
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgroupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tmodelscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnuclabmscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnsdepscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgoalscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'goalevaluator')
      ){

        if ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        && ($Awfif::codelet-> {l} [$codelet][36] == 0)
        && ($Awfif::memes-> {mainco} > 0)
        ){#update transactional deployment failures
# freecmdfup3

          $Awfif::memes-> {mainco} --;
          }#if
        };#elsif
      &trackcodelet ($codelet, $codelet, $Awfif::memes-> {snnh} {free}, $mode);
# freecfbu1

      if (($ctype == $Awfif::memes-> {snnh} {active})
      && ($Awfif::codelet-> {l} [$codelet] [2] eq 'groupbuilder')
      ){

        &freefb ($codelet);
        };#if its a free from the active list
# freecupoolup1
      if ($Awfif::codelet-> {l} [$codelet] [38] > 0) {#remove the initial pool reference

        my ($i, $found, $linki);
        $found = '';
        for ($i = 0;((!$found) && ($i < $Awfif::memes-> {totup})); $i++){#use head reference to check the list of elements for a match
          $linki = $Awfif::subpl-> {q} [3] [$i] [$Awfif::codelet-> {l} [$codelet] [36] ];#linki is an index into $Awfif::poolcl-> {l} list
          while (($linki != 0 ) && (!$found)){
            if ($Awfif::poolcl-> {l} [$linki ][2] == $codelet){#found this codelet

              if ((defined ($Awfif::memes-> {freecupoolb})) && ($Awfif::memes-> {freecupoolb} == $Awfif::codelet-> {l} [$codelet] [36]) ){

                &break ();
                };#if
              $found = 't';
              $Awfif::subpl-> {q} [3] [$i] [$Awfif::codelet-> {l} [$codelet] [36] ] = freepoolc ($linki);
              }#if
            else {

              $linki = $Awfif::poolcl-> {l} [$linki ][0];
              };#
            };#while
          };#for
        $Awfif::codelet-> {l} [$codelet] [38] = 0;
        };#if
      if ($doremarrent > 0) {

        &remarrent ($doremarrent, \@{$Awfif::memes-> {breakcodelet}});
        &remarrent ($doremarrent, \@{$Awfif::memes-> {breaksubp}});
        };#if
# freecjhlsoiup2
      if (($Awfif::codelet-> {l} [$codelet][30] != 0)
      && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] > 0)
      ) {

        $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] --;
        };#if
      &transmgr (undef(), $codelet, $Awfif::memes-> {snnh} {end}, $Awfif::memes-> {snnh} {indequiv});
# freecjhlsoiup3
      my ($sgdi, $gsponsor, $telni, $dcount, $dtelcount, $atelni, $ntelni, $transmgrid, $currentwsbi);

      $cwsbi = $Awfif::memes-> {currentwsbi};
      if (($Awfif::codelet-> {l} [$codelet][19] > 0)
      && ($Awfif::codelet-> {l} [$codelet][19] != $Awfif::codelet-> {l} [$codelet][20])
      ){

        $currentwsbi = $Awfif::codelet-> {l} [$codelet][19];
        }#if
      else {

        $currentwsbi = $Awfif::codelet-> {l} [$codelet][20];
        };#else
      $dcount = 0;
      $dtelcount = 0;
      if (($Awfif::codelet-> {l} [$codelet][37] > 0)
      ){

        $transmgrid = $Awfif::codelet-> {l} [$codelet][37];
        };
      $Awfif::codelet-> {l} [$codelet][32] = 0; #don't leave tfree floating in the free codelets
      if (($Awfif::codelet-> {l} [$codelet][30] != 0)
      && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] <= 0)
      && (($Awfif::memes-> {currentwsbi} = $currentwsbi) != 0)
# and this codelets sponsoring wso has group complete set
      && (fgrpd ($codelet, $Awfif::codelet-> {l} [$codelet][21], \$sgdi, $Awfif::memes->{snnh}{groupcategory}))
      && (($gsponsor = fgrpsponsor ($Awfif::codelet-> {l} [$codelet][21], $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory})) != 0)
      && (gcompleted ($gsponsor, $transmgrid))
      && (($telni = trwsoadr ($gsponsor, -1)) != 0)
      && (($ntelni = $telni) != 0)
# and is telomeric
      && (istelwso (\$ntelni, \$dcount, \$dtelcount))
# freectmu2
      && (!$transmgd)
      ) {
# write a destruction ok descriptor

        $atelni = awsoadr ($telni);
        $Awfif::wsol-> {l} [$atelni][2]
          = setupdesc ( $Awfif::memes-> {snnh} {destroyok},
              ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$codelet] [30]),
              $Awfif::memes-> {snnh} {telomere},
              $Awfif::wsol-> {l} [$atelni][2],
              $atelni);
        };#if
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      &countcdel ($codelet, $mode);# count the deletion
# get the current free head

      $tt = $Awfif::memes-> {codelett};
      $h = $Awfif::memes-> {codeleth};
      $f = $Awfif::memes-> {codeletf};
      &mactcodelettolist ($codelet, 't', $f);

      $tt = $Awfif::memes-> {codelett};
      $h = $Awfif::memes-> {codeleth};
      $f = $Awfif::memes-> {codeletf};
      };#can delete
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references
    if ( ($Awfif::codelet-> {t} [$codelet] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$codelet] [2]))
    ){

      break ();
      }#if
    if (defined ($$rcantd)){

      $$rcantd = $cantd;
      };#if
    $Awfif::memes-> {listrelinking} = '';
    return $response
    }#freecodelet
#
#<!-- end tag ds -->
#<!-- start tag scc -->
#<!-- start tag aso -->
#
sub mactcodelettolist {
    my ($codelet, $tofree, $oldhead, $type) = @_;
    my ($pflink, $plink, $pt, $ph, $cstate);
#
# move an active codelet datastructure to another list - if old head is not free list then reply is the new head value
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $codelet;
      print ("mactcodelettolist codelet $pr ");
      $pr = $Awfif::codelet-> {l} [$codelet] [19];
      print ("ws($pr)");
      $pr = $Awfif::memes-> {snnih} {$Awfif::codelet-> {t} [$codelet]};
      print ("-$pr");
      $pr = $Awfif::memes-> {acodelets};
      print ("as($pr)");
      };
    $cstate = $Awfif::codelet-> {t} [$codelet];
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
# get the current free head

    $pflink = $oldhead;
    if ( ( (($tofree) or (!defined ($oldhead)) or (($oldhead == $Awfif::memes-> {codeletf}) && ($oldhead != 0))) && ($Awfif::codelet-> {t} [$codelet] == $Awfif::memes-> {snnh} {free}))
    or ( ((($oldhead == $Awfif::memes-> {codeletdef}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {deferred})) && ($Awfif::codelet-> {t} [$codelet] == $Awfif::memes-> {snnh} {deferred}))
    or ( ((($oldhead == $Awfif::memes-> {codeletw}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {wait})) && ($Awfif::codelet-> {t} [$codelet] == $Awfif::memes-> {snnh} {wait}))
    ){#don't move its already in the desired queue
      }#if
    elsif ($codelet != 0 ) {

      $pt = $Awfif::memes-> {codelett};
      $ph = $Awfif::memes-> {codeleth};

      if ( (($tofree) or (!defined ($oldhead)) or (($oldhead == $Awfif::memes-> {codeletf}) && ($oldhead != 0)) ) ){
        $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {free};
        }#if
      elsif ( ((($oldhead == $Awfif::memes-> {codeletdef}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {deferred})) ){
        $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {deferred};
        }#elsif
      elsif ( ((($oldhead == $Awfif::memes-> {codeletw}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {wait})) ){
        $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {wait};
        };#elsif
      if ($cstate == $Awfif::memes-> {snnh} {active}) {
        $Awfif::memes-> {acodelets}--;
        };#if
      if ($tofree) {
# can reclaim it to the inactive list

        $Awfif::memes-> {fcodelets}++;
        }#freeing codelet
      else {
# this is no longer directly active so better remove it from the active count

        $Awfif::memes-> {tcodeletmax}++;
        };#else
# link its neighbours together
      $plink = $Awfif::codelet-> {l} [$codelet][0];
      if (($plink != 0)
      && ($codelet == $pt)
      ){#tail but has tail link - corrupt

        &break ();
        };#if
      if ($plink != 0) {

        if ($Awfif::codelet-> {l} [$codelet][1] == 0) {
# This is a head sentinal relink head
# did check if the $oldhead == codeleth but that makes no sense

          if (($codelet == $Awfif::memes-> {codeleth})
          && ($tofree)
          ){

            $Awfif::memes-> {codeleth} = $plink;
            };
          $Awfif::codelet-> {l} [$plink ][1] = 0;
          }
        else {# normal case - not either sentinal

          $Awfif::codelet-> {l} [$plink ][1] =
            $Awfif::codelet-> {l} [$codelet][1];
          $Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$codelet][1] ][0] =
            $Awfif::codelet-> {l} [$codelet][0];
          };
        }#if
      else {
# this is a tail sentinal

        if ($Awfif::codelet-> {l} [$codelet][1] == 0) {
# This is a head sentinal as well relink head
# did check if the $oldhead == codeleth but that makes no sense

          if (($codelet == $Awfif::memes-> {codeleth})
          && ($tofree)
          ){

            $Awfif::memes-> {codeleth} = $plink;
            };#if
          }#if
        else {# just tail sentinal
# did check if the $oldhead == codeleth but that makes no sense

          if (($codelet == $pt)
          && ($tofree)
          ){

            $Awfif::memes-> {codelett} = $Awfif::codelet-> {l} [$codelet][1];
            };#if
          $Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$codelet][1] ][0] = 0;
          };#else
        };#else
# relink this to become the head of the inactive list
      if ($tofree) {

        $Awfif::codelet-> {l} [$codelet] [1] = 0; #sentinal
        $Awfif::codelet-> {l} [$codelet] [0] = $pflink;
        if ($pflink != 0) {

          $Awfif::codelet-> {l} [$pflink][1] = $codelet;
          };# if
        $Awfif::codelet-> {l} [$codelet] [2] = 0;
        $Awfif::codelet-> {l} [$codelet] [3] = 0;
        $Awfif::memes-> {codeletf} = $codelet;
        }#if
      else {

        $Awfif::codelet-> {l} [$codelet] [1] = 0; #sentinal
        $Awfif::codelet-> {l} [$codelet] [0] = $oldhead;
        if ($oldhead != 0) {

          $Awfif::codelet-> {l} [$oldhead][1] = $codelet;
          };# if
        };#else
      };# ok to relink

    if (($codelet == $Awfif::memes-> {codeleth})
    && ($codelet == $Awfif::memes-> {codelett})
    ){

      &break ();
      };#if
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
    if ( (($codelet > 0) && ($Awfif::codelet-> {l} [$codelet][0] == $codelet))
    or (($codelet > 0) && ($Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$codelet][1] ][1] == $codelet)) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references
    if ( ($Awfif::codelet-> {t} [$codelet] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$codelet] [2]))
    ){

      break ();
      }#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("mactcodelettolistx ");
      $pr = $Awfif::memes-> {acodelets};
      print ("as($pr) ret($codelet)\n");
      };
    return $codelet
    }#mactcodelettolist
#
#<!-- end tag vbt -->
#<!-- end tag uts -->
#<!-- end tag inh -->
#
sub mhcodelettoactltail {
    my ($codelet) = @_;
    my ($ot, $oh, $pc, $nc);
#
# move a grabbed codelet datastructure to the tail of the active list
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $codelet;
      print ("mhcodelettoactltail codelet $pr ");
      $pr = $Awfif::codelet-> {l} [$codelet] [19];
      print ("ws($pr)\n");
      };
    $pc = 0;
    if ($codelet != 0 ) {

      $oh = $Awfif::memes-> {codeleth};
      $ot = $Awfif::memes-> {codelett};
      $pc = $Awfif::codelet-> {l} [$codelet][0];
      $nc = $Awfif::codelet-> {l} [$codelet][1];
      $Awfif::memes-> {codelett} = $codelet;
# check if the active list head must be altered
      if ($Awfif::memes-> {codeleth} == 0) {

        $Awfif::memes-> {codeleth} = $codelet;
        };
      if ($Awfif::codelet-> {t} [$codelet] != $Awfif::memes-> {snnh} {active}) {

        $Awfif::memes-> {acodelets}++;
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        };#if
      $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {active};
# relink the codelets previous partners
      if ($pc != 0) {

        $Awfif::codelet-> {l} [$pc][1] = $nc;
        };
      if ($nc != 0) {

        $Awfif::codelet-> {l} [$nc][0] = $pc;
        };
# link the codelet in at the tail of the active list
      $Awfif::codelet-> {l} [$codelet][0] = 0;
      if ($ot == 0) {
# This is a head sentinal

        $Awfif::codelet-> {l} [$codelet][1] = 0;
        }#if
      else {# make the link

        $Awfif::codelet-> {l} [$codelet][1] = $ot;
        $Awfif::codelet-> {l} [$ot][0] = $codelet;
        };#else
      };# ok to relink
    if ( (($ot > 0) && ($Awfif::codelet-> {l} [$ot][0] == $ot)) or (($codelet > 0) && ($Awfif::codelet-> {l} [$codelet][0] == $codelet)) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references

    return $pc
    }#mhcodelettoactltail
#
#<!-- end tag aso -->
#<!-- start tag vbt -->
#
sub mdefscodelettolist {
    my ($oldhead, $singleton) = @_;

#
sub mdefhcodelettolist {
    my ($oldhead, $singleton) = @_;#index of the head of the list to move too
    my ($plink, $ph);
#
# move deferred head codelet datastructure to another list - if old head is not free list then reply is the new head value
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mdefhcodelettolist oldhead($oldhead) ");
      if (defined ($singleton)){
        print ("singleton($singleton) ");
        };#if
      print ("\n");
      };

    if (defined ($singleton) ){
      $ph = $singleton;
      }#if
    else {
      $ph = $Awfif::memes-> {codeletdef};
      };#else

    if ( (defined ($singleton))
    or ($Awfif::memes-> {codeletdef} > 0)
    ){#worth doing the move

      if ($Awfif::codelet-> {t} [$ph] != $Awfif::memes-> {snnh}{deferred}) {&break ();};
      if ((defined ($singleton))
      && ($Awfif::codelet-> {l} [$ph] [0] == 0)
      && ($Awfif::codelet-> {l} [$ph] [1] == 0)
      ){#no relinking needed

        }#if
      elsif ((defined ($singleton)) ){

        &break ();#singleton had friends
        }#elsif
      else {#standard deferred
# link its neighbours together

        $plink = $Awfif::codelet-> {l} [$ph][0];
        $Awfif::memes-> {codeletdef} = $plink;
        if ($plink != 0) {

          if ($Awfif::codelet-> {l} [$ph][1] == 0) {
# This is a head sentinal relink head
            $Awfif::codelet-> {l} [$plink ][1] = 0;
            }
          else {# normal case - not either sentinal

            &break();#should not occur since we are working with codeletdef
            };
          }#if plink non 0
        else {#codeletdef was singleton

# this is a tail sentinal
          if ($Awfif::codelet-> {l} [$ph][1] != 0) {

            &break();#should not occur since we are working with codeletdef
            };#if
          };#else
        };#else
# relink this to become the head of the oldhead list

      $Awfif::codelet-> {l} [$ph] [1] = 0; #sentinal
      $Awfif::codelet-> {l} [$ph] [0] = $oldhead;

      if ((defined ($singleton)) && ($Awfif::codelet-> {l} [$ph] [0] == 0)) { &break ();};
      if ($oldhead != 0) {

        $Awfif::codelet-> {l} [$oldhead][1] = $ph;
        };# if

      if ( (($ph > 0) && ($Awfif::codelet-> {l} [$ph][0] == $ph))
      or (($ph > 0) && ($Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$ph][1] ][1] == $ph)) ) {

        &break ();
        };# check for circular references
      if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
      or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

        &break ();
        };# check for circular references
      };#if codelet to move
    if ( ( ($singleton > 0)
    && ($Awfif::codelet-> {t} [$singleton] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$singleton] [2])) )
    or ( ($Awfif::memes-> {codeletdef} > 0)
    && ($Awfif::codelet-> {t} [$Awfif::memes-> {codeletdef}] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletdef}] [2])) )
    ){

      break ();
      }#if

    if ((defined ($singleton)) && ($Awfif::codelet-> {l} [$ph] [0] == 0) && ($Awfif::codelet-> {l} [$ph] [1] == 0)) { &break ();};
    return $ph
    }#mdefhcodelettolist
#
#<!-- end tag vbt -->
#<!-- end tag sia -->
#
sub newdescl {
    my ($dlinkh) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($link);
#
# checked for merged workspaces

    $link = newlink ($dlinkh, \$Awfif::workspace);
    return $link;
    }#newdescl
#
#<!-- start tag ds -resweb -->
#<!-- start tag inh -->
#<!-- start tag phe -->
#<!-- start tag vbt -->
#
sub setupdesc {
    my ($ltype, $to, $from, $dlinkh, $awso, $synccod) = @_;# must be the workspace head's index for this descriptor list or 0

# create an active descriptor
#
# checked for merged workspaces
    my ($ndlinkh);
# setupdescuf

    $Awfif::wsolfbs [$awso] [23 - $Awfif::memes-> {flagsoffset}] = 2;
    $Awfif::wsolfbs [$awso] [24 - $Awfif::memes-> {flagsoffset}] = 2;
    if (($Awfif::wsolfbs [$awso] [25 - $Awfif::memes-> {flagsoffset}]) != 3) {

      $Awfif::wsolfbs [$awso] [25 - $Awfif::memes-> {flagsoffset}] = 2;
      };
    $Awfif::wsolfbs [$awso] [27 - $Awfif::memes-> {flagsoffset}] = 2;
    $Awfif::wsolfbs [$awso] [28 - $Awfif::memes-> {flagsoffset}] = 2;
    $ndlinkh = addhli ($dlinkh, \$Awfif::workspace);
# setup the links data
    $Awfif::workspace-> {l} [$ndlinkh][2] = $to;
    $Awfif::workspace-> {l} [$ndlinkh][3] = $ltype;
    $Awfif::workspace-> {l} [$ndlinkh][4] = $from;
# setupdsyncu1
    &isetupsync ($ltype, $to, $from, $awso, $synccod);
# setupdsyncu2
# setupdsyncu3
# setupd34u2
# setupdsyncu4
## inverted in isetupsync
    return $ndlinkh
    }# setupdesc
#
sub isetupsync {
    my ($ltype, $to, $from, $awso, $synccod) = @_;# must be the workspace head's index for this descriptor list or 0

    if ((defined ($synccod))
    && ($synccod)
    && ((defined ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}])) && ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] > 0))
    ) {
# isetupdsyncu2

      my ($linki, $found);
      $found = 0;
      $linki = $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}];

      while (($found == 0) && ($linki != 0)) {
        if (($Awfif::syncl-> {l} [$linki] [2] == $to)
        && ($Awfif::syncl-> {l} [$linki] [3] == $ltype)
        && ($Awfif::syncl-> {l} [$linki] [4] == $from)
        ){

          $found = $linki;
          };#if
        $linki = $Awfif::syncl-> {l} [$linki] [0];
        };#while
# isetupdsyncu3
# Move codelet's from the sublist associated with the specific descriptor to the active list.
      if ($found != 0) {

        $linki = $Awfif::syncl-> {l} [$found] [5];# index of synccodl element
# isetupd34u2

        &ilwaiting ($linki, 't', \$Awfif::syncl-> {l} [$found] [5], \$Awfif::syncl-> {l} [$found] [6]);#
# isetupdsyncu4
## inverted in ilwaiting
        };#if
      };#if
    }# isetupsync
#
#<!-- end tag vbt -->
#<!-- end tag phe -->
#<!-- end tag ds -->
#
sub isetupdescc {
    my ($awso) = @_;# must be the workspace head's index for this descriptor list or 0

# set the wso cache for addition of an active descriptor

    &setwsbf ($awso, 23, 2);
    &setwsbf ($awso, 24, 2);
# isetupdescu253
    if (checkwsbf ( $awso, 25) != 3) {
      &setwsbf ($awso, 25, 2);
      };#if
    &setwsbf ($awso, 27, 2);
    &setwsbf ($awso, 28, 2);
    }# isetupdescc
#
#<!-- end tag inh -->
#<!-- start tag ds -resweb -->
#<!-- start tag sca -->
#
sub setupframe {
    my ($ltype, $to, $from, $dlinkh, $awso) = @_;# must be the workspace head's index for this descriptor list or 0

# if the frame descriptor exists in the ws:wso defined and frame ref [2] is initialised to 0 then initialise the frame array for use, set descriptor [2] to 1 and set descriptor [3] to 0 (so will be sentinal for addframe)
#
# checked for merged workspaces
    my ($ndlinkh, $dlinki);
    $ndlinkh = 0;
    if ( ((findtdesc ($dlinkh, $from)) == 0) ){

      $dlinki
      = setupdesc ( 0,
          0, #indicates no frame in use yet
          $from,
          $dlinkh,
          $awso);
      $Awfif::workspace-> {l} [$dlinki] [2] = 0;
      $Awfif::workspace-> {l} [$dlinki] [3] = 0;
      &addframe ($dlinki, $ltype, $to);
      }#if
    else {

      $dlinki = $dlinkh;
      };#else
    return $dlinki
    }# setupframe
#
sub addframe {
    my ($framedi, $ltype, $to) = @_;
# setup the structures to support linked frames
    my ($nslinkh);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr2, $pr3);
      $pr2 = $Awfif::workspace-> {l} [$framedi] [2];
      $pr3 = $Awfif::workspace-> {l} [$framedi] [3];
      print ("addframe framedi($framedi)->2[$pr2]3[$pr3] ltype($ltype) to($to) ");
      };
# create an active descriptor
    $nslinkh = addhli ($Awfif::workspace-> {l} [$framedi] [3], \$Awfif::framel);
    $Awfif::workspace-> {l} [$framedi] [2]++;
    $Awfif::workspace-> {l} [$framedi] [3] = $nslinkh;
    $Awfif::framel-> {l} [$nslinkh][2] = $to;
    $Awfif::framel-> {l} [$nslinkh][3] = $ltype;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addframex ret $nslinkh\n");
      };

    return $nslinkh
    }# addframe
#
sub freeframe {
    my ($framedi) = @_;
#
# checked for merged workspaces

# move the codelet datastructure to the inactive list
    my ($framei);
    $Awfif::workspace-> {l} [$framedi] [3] = freehli (($framei = $Awfif::workspace-> {l} [$framedi] [3]), \$Awfif::framel);#slipnet cache manager coordinates the head of the list
    $Awfif::workspace-> {l} [$framedi] [2]--;
    $Awfif::framel-> {l} [$framei] [2] = 0;
    $Awfif::framel-> {l} [$framei] [3] = 0;
    $Awfif::framel-> {l} [$framei] [14] = ();
    $Awfif::framel-> {l} [$framei] [15] = ();
    return $Awfif::workspace-> {l} [$framedi] [3]
    }#freeframe
#
#<!-- end tag sca -->
#<!-- start tag al -resweb -->
#
sub addifb {
    my ($myli, $strategy, $sarraylength, $sarray, $biceid, $subp, $stws, $srws, $erws) = @_;

# create an active ifindb cache element
#
# checked for merged workspaces
    my ($ndlinkh);

    $ndlinkh = iaddifb ($myli, $strategy, $sarraylength, \@$sarray, $biceid, $subp, \$Awfif::ifbhcl, $stws, $srws, $erws);

    return $ndlinkh
    }# addifb
#
sub iaddifb {
    my ($myli, $strategy, $sarraylength, $sarray, $biceid, $subp, $larrayref, $stws, $srws, $erws) = @_;

# create an active ifindb/ilaunchnc cache element
#
# checked for merged workspaces
    my ($ndlinkh, $hchain, $i);

    $ndlinkh = 0;
    $ndlinkh = igetifb ($myli, $strategy, $sarraylength, \@$sarray, \$hchain, $subp, \$$larrayref, $stws, $srws, $erws);
    if ($ndlinkh == 0) {

      $ndlinkh = addhli ($hchain, \$$larrayref);
# setup the links data
      $$larrayref-> {l} [$ndlinkh][2] = $sarraylength;
      for ($i = 1; $i <= $sarraylength; $i++) {

        $$larrayref-> {l} [$ndlinkh][3][$i] = $$sarray[$i];
        };#for
      $$larrayref-> {l} [$ndlinkh][4] = $biceid;
# handle sub-program structures
      if ((defined ($subp)) && ($subp > 0) ) {

        $$larrayref-> {l} [$ndlinkh][5] = $subp;
        }#if
      elsif ((defined ($myli)) && ($Awfif::codelet-> {l} [$myli] [36] > 0)) {

        $$larrayref-> {l} [$ndlinkh][5] = $Awfif::codelet-> {l} [$myli] [36];
        }#elsif
      else {

        $$larrayref-> {l} [$ndlinkh][5] = 0;
        };#else
# handle specific workspace filter
      if ((defined ($stws)) && ($stws > 0) ) {

        $$larrayref-> {l} [$ndlinkh][6] = $stws;
        }#if
# handle relative workspace sequence filter
      if ((defined ($srws)) && ($srws > 0) && (defined ($erws)) && ($erws > 0)) {

        $$larrayref-> {l} [$ndlinkh][7] = $srws;
        $$larrayref-> {l} [$ndlinkh][8] = $erws;
        }#if

      $$larrayref-> {hc} {$strategy} = $ndlinkh;
      };#if

    return $ndlinkh
    }# iaddifb
#
sub addilab {
    my ($myli, $strategy, $sarraylength, $sarray, $biceid, $subp) = @_;
    my ($ndlinkh);

# create an active ilaunchnc cache element
#
    $ndlinkh = iaddifb ($myli, $strategy, $sarraylength, \@$sarray, $biceid, $subp, \$Awfif::ilabhcl);

    return $ndlinkh
    }# addilab
#
sub getifb {
    my ($myli, $strategy, $sarraylength, $sarray, $hchain, $subp, $stws, $srws, $erws) = @_;

# create an active ifindb cache element
#
# checked for merged workspaces
    my ($ndlinkh);

    $ndlinkh = igetifb ($myli, $strategy, $sarraylength, \@$sarray, \$$hchain, $subp, \$Awfif::ifbhcl, $stws, $srws, $erws);

    return $ndlinkh
    }# getifb
#
sub igetifb {
    my ($myli, $strategy, $sarraylength, $sarray, $hchain, $subp, $larrayref, $stws, $srws, $erws) = @_;

# create an active ifindb/ilaunchnc cache element
#
# checked for merged workspaces
    my ($nomatch, $linki, $ndlinkh, $i, $failed);

    $ndlinkh = 0;
    $nomatch = 't';
    $$hchain = 0;
    if (defined ($$larrayref-> {hc} {$strategy})) {# larrayref (ifbhcl/ ilabhcl) l 2 -> sarraylength, 3 -> sarray contents == strategy string to match, 4 -> biceid, 5 -> subpid, 6 -> stws, 7 -> srws, 8 -> erws

      $$hchain = $$larrayref-> {hc} {$strategy};
      $linki = $$hchain;
      while (($nomatch) && ($linki != 0)) {
        if ( ($$larrayref-> {l} [$linki][2] == $sarraylength)
        && ( (!defined ($stws)) or ( (defined ($stws)) && ($$larrayref-> {l} [$linki][6] == $stws) ) )
        && ( ( (defined ($subp)) && ($subp != 0) && ($$larrayref-> {l} [$linki][5] == $subp) )
          or ( (!defined ($subp)) && (defined ($myli)) && ($$larrayref-> {l} [$linki][5] == $Awfif::codelet-> {l} [$myli] [36]) && ($$larrayref-> {l} [$linki][5] != 0) )
          or ( (!defined ($subp)) && (defined ($myli)) && ($$larrayref-> {l} [$linki][5] == $Awfif::codelet-> {l} [$myli] [36]) && ($$larrayref-> {l} [$linki][5] == 0) ) )
        or ((!defined ($subp)) && (!defined ($myli)) && ($$larrayref-> {l} [$linki][5] == 0) )
        or (checkrhc ($sarraylength, $linki, $subp, \$$larrayref, $stws, $srws, $erws))
        ){

          $failed = '';
          for ($i = 1; (($i <= $sarraylength) && (!$failed)); $i++) {
            if ($$larrayref-> {l} [$linki][3][$i] != $$sarray[$i]) {

              $failed = 't';
              };
            };#for
          if (!$failed) {

            $ndlinkh = $linki;
            $nomatch = '';
            };#if
          };#if
        $linki = $$larrayref-> {l} [$linki][0];
        };#while
      };# if

    return $ndlinkh
    }# igetifb
#
sub getilab {
    my ($myli, $strategy, $sarraylength, $sarray, $hchain, $subp) = @_;
    my ($ndlinkh);

# get an active ilaunchnc cache element
#
    $ndlinkh = igetifb ($myli, $strategy, $sarraylength, \@$sarray, \$$hchain, $subp, \$Awfif::ilabhcl);

    return $ndlinkh
    }# getilab
#
sub checkrhc {
    my ($sarraylength, $linki, $subp, $larrayref, $stws, $srws, $erws) = @_;
    my ($found);

    $found = '';
# match relative hash chain entry
#
    if ( (defined ($srws)) && (defined ($erws))
    && ($$larrayref-> {l} [$linki][2] == $sarraylength)
    && ( (!defined ($stws)) )
    && ((!defined ($subp)) && ($$larrayref-> {l} [$linki][5] == 0) )
    && ( ($$larrayref-> {l} [$linki][7] == $srws) && ($$larrayref-> {l} [$linki][8] == $erws))
    ){

      $found = 't';
      };#if

    return $found
    }# checkrhc
#
sub relifindb {
    my ($myli, $larrayref, $srws, $erws) = @_;
    my ($found, $extdsc, $nucdsc, $stwso, $astwso);

    $found = '';
# if this ifindb is in a statement relative situation setup srws(external) and erws(nuclear)
#
    if ( (defined ($$srws)) && (defined ($$erws)) && ($Awfif::wsbl-> {relorabs} [ $Awfif::memes-> {currentwsbi} ] == $Awfif::memes-> {snnh} {relative}) && (defined ($astwso = $$larrayref-> {astwso} { $Awfif::memes-> {currentwsbi} }) ) && (defined ($nucdsc = $$larrayref-> {nuclear} {($astwso)}) ) && (defined ($extdsc = $$larrayref-> {external} {($astwso)}) )
    ){

      $found = 't';
      $$srws = $Awfif::workspace-> {l} [$extdsc] [2] - $Awfif::memes-> {snnh} {wsi};
      $$erws = $Awfif::workspace-> {l} [$nucdsc] [2] - $Awfif::memes-> {snnh} {wsi};
      }#if
    elsif ( (defined ($$srws)) && (defined ($$erws)) && ($Awfif::wsbl-> {relorabs} [ $Awfif::memes-> {currentwsbi} ] == $Awfif::memes-> {snnh} {relative})
    ){#its relative but the cache data is not setup so need to find the statement descriptors
# first find the statement wso

      $stwso = getnstatement ($myli, $Awfif::wsbl-> {wsot} [$Awfif::memes-> {currentwsbi}], $Awfif::memes-> {currentwsbi});
      $astwso = awsoadr ($stwso);
# then read the descriptors from the statement

      if ( ( ($nucdsc = findtdesc ($Awfif::wsol-> {l} [ $astwso] [2], $Awfif::memes-> {snnh} {membrane}, $Awfif::memes-> {snnh} {nuclear})) != 0 )#indicating that the nuclear membrane has been described
      && ( ($extdsc = findtdesc ($Awfif::wsol-> {l} [ $astwso] [2], $Awfif::memes-> {snnh} {membrane}, $Awfif::memes-> {snnh} {external})) != 0 )#indicating that the external membrane has been described
      ){
# then setup the cache elements and the return values

        $$larrayref-> {astwso} { $Awfif::memes-> {currentwsbi} } = $astwso;
        $$larrayref-> {nuclear} {($astwso)} = $nucdsc;
        $$larrayref-> {external} {($astwso)} = $extdsc;
        $found = 't';
        $$srws = $Awfif::workspace-> {l} [$extdsc] [2] - $Awfif::memes-> {snnh} {wsi};
        $$erws = $Awfif::workspace-> {l} [$nucdsc] [2] - $Awfif::memes-> {snnh} {wsi};
        }#if
      else {#not supposed to happen

        &break ();
        };#else
      }#elseif
    elsif ( (defined ($$srws)) && ($$srws == 0) && (defined ($$erws)) && ($$erws == 0) && ($Awfif::wsbl-> {relorabs} [ $Awfif::memes-> {currentwsbi} ] != $Awfif::memes-> {snnh} {relative}) #not a relative case so undefine the envelope parameters
    ){

      $$srws = undef ();
      $$erws = undef ();
      };#elsif

    return $found
    }# relifindb
#
#<!-- end tag al -->
#<!-- start tag aso -->
#
sub storeds {
    my ($myli, $p, $filestring) = @_;
    my ($result, $unlinked);

# store all key data sets to files for later resume
#
    use Storable qw (store);
    if (defined ($$p)) {

      $result = eval { store ($$p, $filestring)};
      if ($@){

        &break ();#serious error from storable
        print ("storeds myli $myli storable error($@)");
        }
      elsif (!defined ($result)) {

        &break ();#i/o error from storable
        print ("storeds myli $myli storable i/o error($!)");
        };#elsif
      }#if defined
# storedsunlinku1
    else {#unlink the file

      $unlinked = unlink ($filestring);
      };#else

    return $result
    }# storeds
#
sub storetofiles {
    my ($myli, $dirprefix) = @_;
    my ($result, $testfname, $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks);
# store all key data sets to files for later resume
#

    print ("storetofiles started\n");
    $Awfif::mapped-> {scalers} [0] = $Awfif::memes-> {codeleth};
    $Awfif::mapped-> {scalers} [1] = $Awfif::memes-> {codeletw};
    $Awfif::mapped-> {scalers} [2] = $Awfif::memes-> {codelett};
    $Awfif::mapped-> {scalers} [3] = $Awfif::memes-> {codeletf};
    $Awfif::mapped-> {scalers} [4] = $Awfif::codelet-> {p};
    $Awfif::mapped-> {scalers} [5] = $Awfif::wsbl-> {h};
    $Awfif::mapped-> {scalers} [6] = $Awfif::wsbl-> {t};
    $Awfif::mapped-> {scalers} [7] = $Awfif::wsbl-> {f};
    $Awfif::mapped-> {scalers} [8] = $Awfif::wsbl-> {flistl};
    $Awfif::mapped-> {scalers} [9] = $Awfif::wsbl-> {tlistl};
    $Awfif::mapped-> {scalers} [10] = $Awfif::wsbl-> {p};
    $Awfif::mapped-> {scalers} [11] = $Awfif::wsol-> {h};
    $Awfif::mapped-> {scalers} [12] = $Awfif::wsol-> {t};
    $Awfif::mapped-> {scalers} [13] = $Awfif::wsol-> {f};
    $Awfif::mapped-> {scalers} [14] = $Awfif::wsol-> {flistl};
    $Awfif::mapped-> {scalers} [15] = $Awfif::wsol-> {tlistl};
    $Awfif::mapped-> {scalers} [16] = $Awfif::wsol-> {p};
    $Awfif::mapped-> {scalers} [17] = $Awfif::workspace-> {h};
    $Awfif::mapped-> {scalers} [18] = $Awfif::workspace-> {t};
    $Awfif::mapped-> {scalers} [19] = $Awfif::workspace-> {f};
    $Awfif::mapped-> {scalers} [20] = $Awfif::workspace-> {flistl};
    $Awfif::mapped-> {scalers} [21] = $Awfif::workspace-> {tlistl};
    $Awfif::mapped-> {scalers} [22] = $Awfif::workspace-> {p};
    $Awfif::mapped-> {scalers} [23] = $Awfif::wontgroupc-> {h};
    $Awfif::mapped-> {scalers} [24] = $Awfif::wontgroupc-> {t};
    $Awfif::mapped-> {scalers} [25] = $Awfif::wontgroupc-> {f};
    $Awfif::mapped-> {scalers} [26] = $Awfif::wontgroupc-> {flistl};
    $Awfif::mapped-> {scalers} [27] = $Awfif::wontgroupc-> {tlistl};
    $Awfif::mapped-> {scalers} [28] = $Awfif::wontgroupc-> {caller};
    $Awfif::mapped-> {scalers} [29] = $Awfif::wontgroupc-> {p};
    $Awfif::mapped-> {scalers} [30] = $Awfif::bicl-> {h};
    $Awfif::mapped-> {scalers} [31] = $Awfif::bicl-> {t};
    $Awfif::mapped-> {scalers} [32] = $Awfif::bicl-> {f};
    $Awfif::mapped-> {scalers} [33] = $Awfif::bicl-> {flistl};
    $Awfif::mapped-> {scalers} [34] = $Awfif::bicl-> {tlistl};
    $Awfif::mapped-> {scalers} [35] = $Awfif::bicl-> {cp};
    $Awfif::mapped-> {scalers} [36] = $Awfif::bicl-> {p};
    $Awfif::mapped-> {scalers} [37] = $Awfif::norml-> {f};
    $Awfif::mapped-> {scalers} [38] = $Awfif::norml-> {flistl};
    $Awfif::mapped-> {scalers} [39] = $Awfif::norml-> {tlistl};
    $Awfif::mapped-> {scalers} [40] = $Awfif::norml-> {p};
    $Awfif::mapped-> {scalers} [41] = $Awfif::ifbhcl-> {h};
    $Awfif::mapped-> {scalers} [42] = $Awfif::ifbhcl-> {t};
    $Awfif::mapped-> {scalers} [43] = $Awfif::ifbhcl-> {f};
    $Awfif::mapped-> {scalers} [44] = $Awfif::ifbhcl-> {flistl};
    $Awfif::mapped-> {scalers} [45] = $Awfif::ifbhcl-> {tlistl};
    $Awfif::mapped-> {scalers} [46] = $Awfif::ifbhcl-> {p};
    $Awfif::mapped-> {scalers} [47] = $Awfif::ilabhcl-> {h};
    $Awfif::mapped-> {scalers} [48] = $Awfif::ilabhcl-> {t};
    $Awfif::mapped-> {scalers} [49] = $Awfif::ilabhcl-> {f};
    $Awfif::mapped-> {scalers} [50] = $Awfif::ilabhcl-> {flistl};
    $Awfif::mapped-> {scalers} [51] = $Awfif::ilabhcl-> {tlistl};
    $Awfif::mapped-> {scalers} [52] = $Awfif::ilabhcl-> {p};
    $Awfif::mapped-> {scalers} [53] = $Awfif::framel-> {h};
    $Awfif::mapped-> {scalers} [54] = $Awfif::framel-> {t};
    $Awfif::mapped-> {scalers} [55] = $Awfif::framel-> {f};
    $Awfif::mapped-> {scalers} [56] = $Awfif::framel-> {flistl};
    $Awfif::mapped-> {scalers} [57] = $Awfif::framel-> {tlistl};
    $Awfif::mapped-> {scalers} [58] = $Awfif::framel-> {p};
    $Awfif::mapped-> {scalers} [59] = $Awfif::subpl-> {h};
    $Awfif::mapped-> {scalers} [60] = $Awfif::subpl-> {t};
    $Awfif::mapped-> {scalers} [61] = $Awfif::subpl-> {f};
    $Awfif::mapped-> {scalers} [62] = $Awfif::subpl-> {flistl};
    $Awfif::mapped-> {scalers} [63] = $Awfif::subpl-> {tlistl};
    $Awfif::mapped-> {scalers} [64] = $Awfif::subpl-> {p};
    $Awfif::mapped-> {scalers} [65] = $Awfif::amoffl-> {h};
    $Awfif::mapped-> {scalers} [66] = $Awfif::amoffl-> {t};
    $Awfif::mapped-> {scalers} [67] = $Awfif::amoffl-> {f};
    $Awfif::mapped-> {scalers} [68] = $Awfif::amoffl-> {flistl};
    $Awfif::mapped-> {scalers} [69] = $Awfif::amoffl-> {tlistl};
    $Awfif::mapped-> {scalers} [70] = $Awfif::amoffl-> {p};
    $Awfif::mapped-> {scalers} [71] = $Awfif::poolcl-> {h};
    $Awfif::mapped-> {scalers} [72] = $Awfif::poolcl-> {t};
    $Awfif::mapped-> {scalers} [73] = $Awfif::poolcl-> {f};
    $Awfif::mapped-> {scalers} [74] = $Awfif::poolcl-> {flistl};
    $Awfif::mapped-> {scalers} [75] = $Awfif::poolcl-> {tlistl};
    $Awfif::mapped-> {scalers} [76] = $Awfif::poolcl-> {p};
    $Awfif::mapped-> {scalers} [77] = $Awfif::syncl-> {h};
    $Awfif::mapped-> {scalers} [78] = $Awfif::syncl-> {t};
    $Awfif::mapped-> {scalers} [79] = $Awfif::syncl-> {f};
    $Awfif::mapped-> {scalers} [80] = $Awfif::syncl-> {flistl};
    $Awfif::mapped-> {scalers} [81] = $Awfif::syncl-> {tlistl};
    $Awfif::mapped-> {scalers} [82] = $Awfif::syncl-> {p};
    $Awfif::mapped-> {scalers} [83] = $Awfif::synccodl-> {h};
    $Awfif::mapped-> {scalers} [84] = $Awfif::synccodl-> {t};
    $Awfif::mapped-> {scalers} [85] = $Awfif::synccodl-> {f};
    $Awfif::mapped-> {scalers} [86] = $Awfif::synccodl-> {flistl};
    $Awfif::mapped-> {scalers} [87] = $Awfif::synccodl-> {tlistl};
    $Awfif::mapped-> {scalers} [88] = $Awfif::synccodl-> {p};
    $Awfif::mapped-> {scalers} [89] = $Awfif::cswsol-> {h};
    $Awfif::mapped-> {scalers} [90] = $Awfif::cswsol-> {t};
    $Awfif::mapped-> {scalers} [91] = $Awfif::cswsol-> {f};
    $Awfif::mapped-> {scalers} [92] = $Awfif::cswsol-> {flistl};
    $Awfif::mapped-> {scalers} [93] = $Awfif::cswsol-> {tlistl};
    $Awfif::mapped-> {scalers} [94] = $Awfif::cswsol-> {p};
    $Awfif::mapped-> {scalers} [95] = $Awfif::subpscdefl-> {h};
    $Awfif::mapped-> {scalers} [96] = $Awfif::subpscdefl-> {t};
    $Awfif::mapped-> {scalers} [97] = $Awfif::subpscdefl-> {f};
    $Awfif::mapped-> {scalers} [98] = $Awfif::subpscdefl-> {flistl};
    $Awfif::mapped-> {scalers} [99] = $Awfif::subpscdefl-> {tlistl};
    $Awfif::mapped-> {scalers} [100] = $Awfif::subpscdefl-> {p};
    $Awfif::mapped-> {scalers} [101] = $Awfif::veccol-> {h};
    $Awfif::mapped-> {scalers} [102] = $Awfif::veccol-> {t};
    $Awfif::mapped-> {scalers} [103] = $Awfif::veccol-> {f};
    $Awfif::mapped-> {scalers} [104] = $Awfif::veccol-> {flistl};
    $Awfif::mapped-> {scalers} [105] = $Awfif::veccol-> {tlistl};
    $Awfif::mapped-> {scalers} [106] = $Awfif::veccol-> {p};
    $Awfif::mapped-> {scalers} [107] = $Awfif::veccol-> {vcstate};
    $Awfif::mapped-> {scalers} [108] = $Awfif::histonel-> {h};
    $Awfif::mapped-> {scalers} [109] = $Awfif::histonel-> {t};
    $Awfif::mapped-> {scalers} [110] = $Awfif::histonel-> {f};
    $Awfif::mapped-> {scalers} [111] = $Awfif::histonel-> {flistl};
    $Awfif::mapped-> {scalers} [112] = $Awfif::histonel-> {tlistl};
    $Awfif::mapped-> {scalers} [113] = $Awfif::histonel-> {p};
    $Awfif::mapped-> {scalers} [114] = $Awfif::hnamel-> {h};
    $Awfif::mapped-> {scalers} [115] = $Awfif::hnamel-> {t};
    $Awfif::mapped-> {scalers} [116] = $Awfif::hnamel-> {f};
    $Awfif::mapped-> {scalers} [117] = $Awfif::hnamel-> {flistl};
    $Awfif::mapped-> {scalers} [118] = $Awfif::hnamel-> {tlistl};
    $Awfif::mapped-> {scalers} [119] = $Awfif::hnamel-> {p};
    $Awfif::mapped-> {scalers} [120] = $Awfif::itswsall-> {h};
    $Awfif::mapped-> {scalers} [121] = $Awfif::itswsall-> {t};
    $Awfif::mapped-> {scalers} [122] = $Awfif::itswsall-> {f};
    $Awfif::mapped-> {scalers} [123] = $Awfif::itswsall-> {flistl};
    $Awfif::mapped-> {scalers} [124] = $Awfif::itswsall-> {tlistl};
    $Awfif::mapped-> {scalers} [125] = $Awfif::itswsall-> {p};
    $Awfif::mapped-> {scalers} [126] = $Awfif::inhibl-> {h};
    $Awfif::mapped-> {scalers} [127] = $Awfif::inhibl-> {t};
    $Awfif::mapped-> {scalers} [128] = $Awfif::inhibl-> {f};
    $Awfif::mapped-> {scalers} [129] = $Awfif::inhibl-> {flistl};
    $Awfif::mapped-> {scalers} [130] = $Awfif::inhibl-> {tlistl};
    $Awfif::mapped-> {scalers} [131] = $Awfif::inhibl-> {p};
    $Awfif::mapped-> {scalers} [132] = $Awfif::trfl-> {h};
    $Awfif::mapped-> {scalers} [133] = $Awfif::trfl-> {t};
    $Awfif::mapped-> {scalers} [134] = $Awfif::trfl-> {f};
    $Awfif::mapped-> {scalers} [135] = $Awfif::trfl-> {flistl};
    $Awfif::mapped-> {scalers} [136] = $Awfif::trfl-> {tlistl};
    $Awfif::mapped-> {scalers} [137] = $Awfif::trfl-> {p};
# $Awfif::mapped-> {scalers} [138] = $Awfif::kmbracketd-> {bmec};- 437
# $Awfif::mapped-> {scalers} [139] = $Awfif::kmbracketd-> {ibmec};
# $Awfif::mapped-> {scalers} [140] = $Awfif::kmbracketd-> {smsc};
# $Awfif::mapped-> {scalers} [141] = $Awfif::kmbracketd-> {incb};
# $Awfif::mapped-> {scalers} [142] = $Awfif::kmbracketd-> {incs};
    $Awfif::mapped-> {scalers} [143] = $Awfif::tral-> {h};
    $Awfif::mapped-> {scalers} [144] = $Awfif::tral-> {t};
    $Awfif::mapped-> {scalers} [145] = $Awfif::tral-> {f};
    $Awfif::mapped-> {scalers} [146] = $Awfif::tral-> {flistl};
    $Awfif::mapped-> {scalers} [147] = $Awfif::tral-> {tlistl};
    $Awfif::mapped-> {scalers} [148] = $Awfif::tral-> {p};
    $Awfif::mapped-> {scalers} [149] = $Awfif::tmassl-> {h};
    $Awfif::mapped-> {scalers} [150] = $Awfif::tmassl-> {t};
    $Awfif::mapped-> {scalers} [151] = $Awfif::tmassl-> {f};
    $Awfif::mapped-> {scalers} [152] = $Awfif::tmassl-> {flistl};
    $Awfif::mapped-> {scalers} [153] = $Awfif::tmassl-> {tlistl};
    $Awfif::mapped-> {scalers} [154] = $Awfif::tmassl-> {p};
    $Awfif::mapped-> {scalers} [155] = $Awfif::kwl-> {h};
    $Awfif::mapped-> {scalers} [156] = $Awfif::kwl-> {t};
    $Awfif::mapped-> {scalers} [157] = $Awfif::kwl-> {f};
    $Awfif::mapped-> {scalers} [158] = $Awfif::kwl-> {flistl};
    $Awfif::mapped-> {scalers} [159] = $Awfif::kwl-> {tlistl};
    $Awfif::mapped-> {scalers} [160] = $Awfif::kwl-> {p};
    $Awfif::mapped-> {scalers} [161] = $Awfif::mkwl-> {h};
    $Awfif::mapped-> {scalers} [162] = $Awfif::mkwl-> {t};
    $Awfif::mapped-> {scalers} [163] = $Awfif::mkwl-> {f};
    $Awfif::mapped-> {scalers} [164] = $Awfif::mkwl-> {flistl};
    $Awfif::mapped-> {scalers} [165] = $Awfif::mkwl-> {tlistl};
    $Awfif::mapped-> {scalers} [166] = $Awfif::mkwl-> {p};
    $Awfif::mapped-> {scalers} [167] = $Awfif::aspl-> {h};
    $Awfif::mapped-> {scalers} [168] = $Awfif::aspl-> {t};
    $Awfif::mapped-> {scalers} [169] = $Awfif::aspl-> {f};
    $Awfif::mapped-> {scalers} [170] = $Awfif::aspl-> {flistl};
    $Awfif::mapped-> {scalers} [171] = $Awfif::aspl-> {tlistl};
    $Awfif::mapped-> {scalers} [172] = $Awfif::aspl-> {p};
# clp is transient
    $Awfif::mapped-> {scalers} [173] = $Awfif::sametl-> {h};
    $Awfif::mapped-> {scalers} [174] = $Awfif::sametl-> {t};
    $Awfif::mapped-> {scalers} [175] = $Awfif::sametl-> {f};
    $Awfif::mapped-> {scalers} [176] = $Awfif::sametl-> {flistl};
    $Awfif::mapped-> {scalers} [177] = $Awfif::sametl-> {tlistl};
    $Awfif::mapped-> {scalers} [178] = $Awfif::sametl-> {p};
    $Awfif::mapped-> {scalers} [179] = $Awfif::memes-> {actamp};
    $Awfif::mapped-> {scalers} [180] = $Awfif::memes-> {actth};
    $Awfif::mapped-> {scalers} [181] = $Awfif::memes-> {actramp};
    $Awfif::mapped-> {scalers} [182] = $Awfif::memes-> {actmax};
    $Awfif::mapped-> {scalers} [183] = $Awfif::memes-> {actdamper};
    $Awfif::mapped-> {scalers} [184] = $Awfif::memes-> {acteu};
    $Awfif::mapped-> {scalers} [185] = $Awfif::memes-> {actfocus};
    $Awfif::mapped-> {scalers} [186] = $Awfif::memes-> {actweight};
    $Awfif::mapped-> {scalers} [187] = $Awfif::memes-> {batp};
    $Awfif::mapped-> {scalers} [188] = $Awfif::memes-> {bondafrom};
    $Awfif::mapped-> {scalers} [189] = $Awfif::memes-> {bondato};
    $Awfif::mapped-> {scalers} [190] = $Awfif::memes-> {bondatype};
    $Awfif::mapped-> {scalers} [191] = $Awfif::memes-> {bondamp};
    $Awfif::mapped-> {scalers} [192] = $Awfif::memes-> {bondbar};
    $Awfif::mapped-> {scalers} [193] = $Awfif::memes-> {bondrwd};
    $Awfif::mapped-> {scalers} [194] = $Awfif::memes-> {usedesc};
    $Awfif::mapped-> {scalers} [195] = $Awfif::memes-> {igdesc};
    $Awfif::mapped-> {scalers} [196] = $Awfif::memes-> {userel};
    $Awfif::mapped-> {scalers} [197] = $Awfif::memes-> {igrel};
    $Awfif::mapped-> {scalers} [198] = $Awfif::memes-> {buscu};
    $Awfif::mapped-> {scalers} [199] = $Awfif::memes-> {budescu};
    $Awfif::mapped-> {scalers} [200] = $Awfif::memes-> {tdbsurg};
    $Awfif::mapped-> {scalers} [201] = $Awfif::memes-> {tddsurg};
    $Awfif::mapped-> {scalers} [202] = $Awfif::memes-> {tdgsurg};
    $Awfif::mapped-> {scalers} [203] = $Awfif::memes-> {coordmax};
    $Awfif::mapped-> {scalers} [204] = $Awfif::memes-> {coordamp};
    $Awfif::mapped-> {scalers} [205] = $Awfif::memes-> {critical};
    $Awfif::mapped-> {scalers} [206] = $Awfif::memes-> {crwait};
    $Awfif::mapped-> {scalers} [207] = $Awfif::memes-> {csehih};
    $Awfif::mapped-> {scalers} [208] = $Awfif::memes-> {cpmax};
    $Awfif::mapped-> {scalers} [209] = $Awfif::memes-> {currentwsbi};
    $Awfif::mapped-> {scalers} [210] = $Awfif::memes-> {depthamp};
    $Awfif::mapped-> {scalers} [211] = $Awfif::memes-> {depthslp};
    $Awfif::mapped-> {scalers} [212] = $Awfif::memes-> {depththamp};
    $Awfif::mapped-> {scalers} [213] = $Awfif::memes-> {desbar};
    $Awfif::mapped-> {scalers} [214] = $Awfif::memes-> {desrwd};
    $Awfif::mapped-> {scalers} [215] = $Awfif::memes-> {descafrom};
    $Awfif::mapped-> {scalers} [216] = $Awfif::memes-> {descato};
    $Awfif::mapped-> {scalers} [217] = $Awfif::memes-> {descatype};
    $Awfif::mapped-> {scalers} [218] = $Awfif::memes-> {datp};
    $Awfif::mapped-> {scalers} [219] = $Awfif::memes-> {fatigue};
    $Awfif::mapped-> {scalers} [220] = $Awfif::memes-> {fatp};
    $Awfif::mapped-> {scalers} [221] = $Awfif::memes-> {fcodelets};
    $Awfif::mapped-> {scalers} [222] = $Awfif::memes-> {gatp};
    $Awfif::mapped-> {scalers} [223] = $Awfif::memes-> {halomax};
    $Awfif::mapped-> {scalers} [224] = $Awfif::memes-> {ldav};
    $Awfif::mapped-> {scalers} [225] = $Awfif::memes-> {ldoav};
    $Awfif::mapped-> {scalers} [226] = $Awfif::memes-> {lderr};
    $Awfif::mapped-> {scalers} [227] = $Awfif::memes-> {ldlcycle};
    $Awfif::mapped-> {scalers} [228] = $Awfif::memes-> {ldlcyclemax};
    $Awfif::mapped-> {scalers} [229] = $Awfif::memes-> {ldmcycle};
    $Awfif::mapped-> {scalers} [230] = $Awfif::memes-> {ldmcyclemax};
    $Awfif::mapped-> {scalers} [231] = $Awfif::memes-> {ldsignal};
    $Awfif::mapped-> {scalers} [232] = $Awfif::memes-> {iphase};
    $Awfif::mapped-> {scalers} [233] = $Awfif::memes-> {iphasecomp};
    $Awfif::mapped-> {scalers} [234] = $Awfif::memes-> {minnorm};
    $Awfif::mapped-> {scalers} [235] = $Awfif::memes-> {mrework};
    $Awfif::mapped-> {scalers} [236] = $Awfif::memes-> {maxact};
    $Awfif::mapped-> {scalers} [237] = $Awfif::memes-> {maxoper};
    $Awfif::mapped-> {scalers} [238] = $Awfif::memes-> {ndecay};
    $Awfif::mapped-> {scalers} [239] = $Awfif::memes-> {ntact};
    $Awfif::mapped-> {scalers} [240] = $Awfif::memes-> {openafrom};
    $Awfif::mapped-> {scalers} [241] = $Awfif::memes-> {openato};
    $Awfif::mapped-> {scalers} [242] = $Awfif::memes-> {openatype};
    $Awfif::mapped-> {scalers} [243] = $Awfif::memes-> {pstream};
    $Awfif::mapped-> {scalers} [244] = $Awfif::memes-> {peaksal};
    $Awfif::mapped-> {scalers} [245] = $Awfif::memes-> {groupsponsor};
    $Awfif::mapped-> {scalers} [246] = $Awfif::memes-> {jhlp};
    $Awfif::mapped-> {scalers} [247] = $Awfif::memes-> {lbbase};
    $Awfif::mapped-> {scalers} [248] = $Awfif::memes-> {lebase};
    $Awfif::mapped-> {scalers} [249] = $Awfif::memes-> {lsbase};
    $Awfif::mapped-> {scalers} [250] = $Awfif::memes-> {lsnbase};
    $Awfif::mapped-> {scalers} [251] = $Awfif::memes-> {log};
    $Awfif::mapped-> {scalers} [252] = $Awfif::memes-> {logentry};
    $Awfif::mapped-> {scalers} [253] = $Awfif::memes-> {relafrom};
    $Awfif::mapped-> {scalers} [254] = $Awfif::memes-> {relato};
    $Awfif::mapped-> {scalers} [255] = $Awfif::memes-> {relatype};
    $Awfif::mapped-> {scalers} [256] = $Awfif::memes-> {relamp};
    $Awfif::mapped-> {scalers} [257] = $Awfif::memes-> {relbar};
    $Awfif::mapped-> {scalers} [258] = $Awfif::memes-> {relrwd};
    $Awfif::mapped-> {scalers} [259] = $Awfif::memes-> {rtemp};
    $Awfif::mapped-> {scalers} [260] = $Awfif::memes-> {bondthreshold};
    $Awfif::mapped-> {scalers} [261] = $Awfif::memes-> {descthreshold};
    $Awfif::mapped-> {scalers} [262] = $Awfif::memes-> {destthreshold};
    $Awfif::mapped-> {scalers} [263] = $Awfif::memes-> {structamp};
    $Awfif::mapped-> {scalers} [264] = $Awfif::memes-> {strbcont};
    $Awfif::mapped-> {scalers} [265] = $Awfif::memes-> {strnbcont};
    $Awfif::mapped-> {scalers} [266] = $Awfif::memes-> {tcodelets};
    $Awfif::mapped-> {scalers} [267] = $Awfif::memes-> {tcodeletmax};
    $Awfif::mapped-> {scalers} [268] = $Awfif::memes-> {trace};
    $Awfif::mapped-> {scalers} [269] = $Awfif::memes-> {traceentry};
    $Awfif::mapped-> {scalers} [270] = $Awfif::memes-> {tracetemp};
    $Awfif::mapped-> {scalers} [271] = $Awfif::memes-> {traceurg};
    $Awfif::mapped-> {scalers} [272] = $Awfif::memes-> {tracefull};
    $Awfif::mapped-> {scalers} [273] = $Awfif::memes-> {tracephase};
    $Awfif::mapped-> {scalers} [274] = $Awfif::memes-> {tracetree};
    $Awfif::mapped-> {scalers} [275] = $Awfif::memes-> {tracemcache};
    $Awfif::mapped-> {scalers} [276] = $Awfif::memes-> {tracescache};
    $Awfif::mapped-> {scalers} [277] = $Awfif::memes-> {tracewscache};
    $Awfif::mapped-> {scalers} [278] = $Awfif::memes-> {tmcacheth};
    $Awfif::mapped-> {scalers} [279] = $Awfif::memes-> {tscacheth};
    $Awfif::mapped-> {scalers} [280] = $Awfif::memes-> {twscacheth};
    $Awfif::mapped-> {scalers} [281] = $Awfif::memes-> {kwmi};
    $Awfif::mapped-> {scalers} [282] = $Awfif::memes-> {kwmir};
    $Awfif::mapped-> {scalers} [283] = $Awfif::memes-> {kwwsbi};
    $Awfif::mapped-> {scalers} [284] = $Awfif::memes-> {kwp};
    $Awfif::mapped-> {scalers} [285] = $Awfif::memes-> {kwpr};
    $Awfif::mapped-> {scalers} [286] = $Awfif::memes-> {mtsnlvl};
    $Awfif::mapped-> {scalers} [287] = $Awfif::memes-> {mtsnstate};
    $Awfif::mapped-> {scalers} [288] = $Awfif::memes-> {shout};
    $Awfif::mapped-> {scalers} [289] = $Awfif::memes-> {slipth};
    $Awfif::mapped-> {scalers} [290] = $Awfif::memes-> {snehih};
    $Awfif::mapped-> {scalers} [291] = $Awfif::memes-> {uhmax};
    $Awfif::mapped-> {scalers} [292] = $Awfif::memes-> {uhth};
    $Awfif::mapped-> {scalers} [293] = $Awfif::memes-> {wsohih};
    $Awfif::mapped-> {scalers} [294] = $Awfif::slipnet-> {p};
    $Awfif::mapped-> {scalers} [295] = $Awfif::slehist-> {p};
    $Awfif::mapped-> {scalers} [296] = $Awfif::wsohist-> {p};
    $Awfif::mapped-> {scalers} [297] = $Awfif::jhls-> {p};
    $Awfif::mapped-> {scalers} [298] = $Awfif::attribs-> {p};
    $Awfif::mapped-> {scalers} [299] = $Awfif::csehist-> {p};
    $Awfif::mapped-> {scalers} [300] = $Awfif::clnk-> {h};
    $Awfif::mapped-> {scalers} [301] = $Awfif::clnk-> {t};
    $Awfif::mapped-> {scalers} [302] = $Awfif::clnk-> {f};
    $Awfif::mapped-> {scalers} [303] = $Awfif::clnk-> {flistl};
    $Awfif::mapped-> {scalers} [304] = $Awfif::clnk-> {p};
    $Awfif::mapped-> {scalers} [305] = $Awfif::memes-> {loopcheck};
    $Awfif::mapped-> {scalers} [306] = $Awfif::memes-> {loopth};
    $Awfif::mapped-> {scalers} [307] = $Awfif::memes-> {ptrace};
    $Awfif::mapped-> {scalers} [308] = $Awfif::memes-> {failatpr};
    $Awfif::mapped-> {scalers} [309] = $Awfif::memes-> {traceadentry};
    $Awfif::mapped-> {scalers} [310] = $Awfif::memes-> {telomeretrace};
    $Awfif::mapped-> {scalers} [311] = $Awfif::memes-> {tracedpcache};
    $Awfif::mapped-> {scalers} [312] = $Awfif::memes-> {tracevcentry};
    $Awfif::mapped-> {scalers} [313] = $Awfif::memes-> {traceclogentry};
    $Awfif::mapped-> {scalers} [314] = $Awfif::memes-> {ratcoth};
    $Awfif::mapped-> {scalers} [315] = $Awfif::memes-> {abscoth};
    $Awfif::mapped-> {scalers} [316] = $Awfif::memes-> {nomcrsmgrab};
    $Awfif::mapped-> {scalers} [317] = $Awfif::memes-> {ssiasslncusetmass};
    $Awfif::mapped-> {scalers} [318] = $Awfif::memes-> {tracetime};
    $Awfif::mapped-> {scalers} [319] = $Awfif::memes-> {tracehrtime};
    $Awfif::mapped-> {scalers} [320] = $Awfif::memes-> {tellifeth};
    $Awfif::mapped-> {scalers} [321] = $Awfif::memes-> {telcountth};
    $Awfif::mapped-> {scalers} [322] = $Awfif::memes-> {inhuramp};
    $Awfif::mapped-> {scalers} [323] = $Awfif::memes-> {usewcf1d};
    $Awfif::mapped-> {scalers} [324] = $Awfif::memes-> {usetdfmod};
    $Awfif::mapped-> {scalers} [325] = $Awfif::memes-> {tdfsampth};
    $Awfif::mapped-> {scalers} [326] = $Awfif::memes-> {tdfsampds};
    $Awfif::mapped-> {scalers} [327] = $Awfif::memes-> {tdfsampacc};
    $Awfif::mapped-> {scalers} [328] = $Awfif::memes-> {mainco};
    $Awfif::mapped-> {scalers} [329] = $Awfif::memes-> {maininc};
    $Awfif::mapped-> {scalers} [330] = $Awfif::memes-> {freeampth};
    $Awfif::mapped-> {scalers} [331] = $Awfif::memes-> {maxusefree};
    $Awfif::mapped-> {scalers} [332] = $Awfif::memes-> {bcsubpsindex};
    $Awfif::mapped-> {scalers} [333] = $Awfif::memes-> {ivalwindex};
    $Awfif::mapped-> {scalers} [334] = $Awfif::memes-> {crsmindex};
    $Awfif::mapped-> {scalers} [335] = $Awfif::memes-> {totup};
    $Awfif::mapped-> {scalers} [336] = $Awfif::memes-> {bugsmax};
    $Awfif::mapped-> {scalers} [337] = $Awfif::memes-> {killth};
    $Awfif::mapped-> {scalers} [338] = $Awfif::memes-> {ampramp};
    $Awfif::mapped-> {scalers} [339] = $Awfif::memes-> {waitamp};
    $Awfif::mapped-> {scalers} [340] = $Awfif::memes-> {convfrom};
    $Awfif::mapped-> {scalers} [341] = $Awfif::memes-> {groupatype};
    $Awfif::mapped-> {scalers} [342] = $Awfif::memes-> {groupato};
    $Awfif::mapped-> {scalers} [343] = $Awfif::memes-> {groupafrom};
    $Awfif::mapped-> {scalers} [344] = $Awfif::memes-> {bumscu};
    $Awfif::mapped-> {scalers} [345] = $Awfif::memes-> {tdgsramp};
    $Awfif::mapped-> {scalers} [346] = $Awfif::memes-> {geramp};
    $Awfif::mapped-> {scalers} [347] = $Awfif::memes-> {gerhiamp};
    $Awfif::mapped-> {scalers} [348] = $Awfif::memes-> {budestscu};
    $Awfif::mapped-> {scalers} [349] = $Awfif::memes-> {pappbu};
    $Awfif::mapped-> {scalers} [350] = $Awfif::memes-> {parteu};
    $Awfif::mapped-> {scalers} [351] = $Awfif::memes-> {evlaunchm};
    $Awfif::mapped-> {scalers} [352] = $Awfif::memes-> {evlaunchhim};
    $Awfif::mapped-> {scalers} [353] = $Awfif::memes-> {blaunchm};
    $Awfif::mapped-> {scalers} [354] = $Awfif::memes-> {ilaunchm};
    $Awfif::mapped-> {scalers} [355] = $Awfif::memes-> {icompdlaunchm};
    $Awfif::mapped-> {scalers} [356] = $Awfif::memes-> {manthreshold};
    $Awfif::mapped-> {scalers} [357] = $Awfif::memes-> {pstment};
    $Awfif::mapped-> {scalers} [358] = $Awfif::memes-> {pactive};
    $Awfif::mapped-> {scalers} [359] = $Awfif::memes-> {psubprogram};
    $Awfif::mapped-> {scalers} [360] = $Awfif::memes-> {acodelets};
    $Awfif::mapped-> {scalers} [361] = $Awfif::memes-> {mincodelets};
    $Awfif::mapped-> {scalers} [362] = $Awfif::memes-> {breakmyli};
    $Awfif::mapped-> {scalers} [363] = $Awfif::memes-> {bmbcindex};
    $Awfif::mapped-> {scalers} [364] = $Awfif::memes-> {drwait};
    $Awfif::mapped-> {scalers} [365] = $Awfif::memes-> {crfocuswin};
    $Awfif::mapped-> {scalers} [366] = $Awfif::memes-> {grcompaward};
    $Awfif::mapped-> {scalers} [367] = $Awfif::memes-> {salthr};
    $Awfif::mapped-> {scalers} [368] = $Awfif::memes-> {mmratio};
    $Awfif::mapped-> {scalers} [369] = $Awfif::memes-> {dmratio};
    $Awfif::mapped-> {scalers} [370] = $Awfif::memes-> {verbsrcws};
    $Awfif::mapped-> {scalers} [371] = $Awfif::memes-> {verbtaws};
    $Awfif::mapped-> {scalers} [372] = $Awfif::memes-> {clogbplist};
    $Awfif::mapped-> {scalers} [373] = $Awfif::memes-> {clogeplist};
    $Awfif::mapped-> {scalers} [374] = $Awfif::memes-> {clogs};
    $Awfif::mapped-> {scalers} [375] = $Awfif::memes-> {comprocessing};
    $Awfif::mapped-> {scalers} [376] = $Awfif::memes-> {cbprocessing};
    $Awfif::mapped-> {scalers} [377] = $Awfif::memes-> {maxnormitems};
    $Awfif::mapped-> {scalers} [378] = $Awfif::memes-> {cpcountth};
    $Awfif::mapped-> {scalers} [379] = $Awfif::memes-> {maxtdgloop};
    $Awfif::mapped-> {scalers} [380] = $Awfif::memes-> {itswsallc};
    $Awfif::mapped-> {scalers} [381] = $Awfif::memes-> {wsoname};
    $Awfif::mapped-> {scalers} [382] = $Awfif::memes-> {buildfbth};
    $Awfif::mapped-> {scalers} [383] = $Awfif::memes-> {delayselcount};
    $Awfif::mapped-> {scalers} [384] = $Awfif::memes-> {delayamp};
    $Awfif::mapped-> {scalers} [385] = $Awfif::memes-> {tgnth};
    $Awfif::mapped-> {scalers} [386] = $Awfif::memes-> {doprsib};
    $Awfif::mapped-> {scalers} [387] = $Awfif::memes-> {chckadd};
    $Awfif::mapped-> {scalers} [388] = $Awfif::memes-> {checktransidnz};
    $Awfif::mapped-> {scalers} [389] = $Awfif::memes-> {checksubpidnz};
    $Awfif::mapped-> {scalers} [390] = $Awfif::memes-> {tral};
    $Awfif::mapped-> {scalers} [391] = $Awfif::memes-> {applycmin};
    $Awfif::mapped-> {scalers} [392] = $Awfif::memes-> {iapplycth};
    $Awfif::mapped-> {scalers} [393] = $Awfif::memes-> {applycth};
    $Awfif::mapped-> {scalers} [394] = $Awfif::memes-> {iapplyramp};
    $Awfif::mapped-> {scalers} [395] = $Awfif::memes-> {applyramp};
    $Awfif::mapped-> {scalers} [396] = $Awfif::memes-> {applycount};
    $Awfif::mapped-> {scalers} [397] = $Awfif::memes-> {applyactive};
    $Awfif::mapped-> {scalers} [398] = $Awfif::memes-> {applyspigdiv};
    $Awfif::mapped-> {scalers} [399] = $Awfif::memes-> {newdep};
    $Awfif::mapped-> {scalers} [400] = $Awfif::memes-> {bnotsalient};
    $Awfif::mapped-> {scalers} [401] = $Awfif::memes-> {bsalient};
    $Awfif::mapped-> {scalers} [402] = $Awfif::memes-> {submult};
    $Awfif::mapped-> {scalers} [403] = $Awfif::memes-> {submitted};
    $Awfif::mapped-> {scalers} [404] = $Awfif::memes-> {casetrmcws};
    $Awfif::mapped-> {scalers} [405] = $Awfif::memes-> {casetrmbcwso};
    $Awfif::mapped-> {scalers} [406] = $Awfif::memes-> {subptrachcount};
    $Awfif::mapped-> {scalers} [407] = $Awfif::memes-> {acaseoutputps};
    $Awfif::mapped-> {scalers} [408] = $Awfif::memes-> {subprefctr};
    $Awfif::mapped-> {scalers} [409] = $Awfif::memes-> {allowspigrabmax};
    $Awfif::mapped-> {scalers} [410] = $Awfif::memes-> {veccah};
    $Awfif::mapped-> {scalers} [411] = $Awfif::memes-> {veccab};
    $Awfif::mapped-> {scalers} [412] = $Awfif::memes-> {usewsodirect};
    $Awfif::mapped-> {scalers} [413] = $Awfif::memes-> {usewsobfdirect};

    $Awfif::mapped-> {scalers} [414] = $Awfif::cstruct-> {istringf};
    $Awfif::mapped-> {scalers} [415] = $Awfif::memes-> {codeletdef};
    $Awfif::mapped-> {scalers} [416] = $Awfif::memes-> {jhldesf};
    $Awfif::mapped-> {scalers} [417] = $Awfif::memes-> {attribdesf};
    $Awfif::mapped-> {scalers} [418] = $Awfif::memes-> {attribdesh};
    $Awfif::mapped-> {scalers} [419] = $Awfif::costatel-> {fclnk};
    $Awfif::mapped-> {scalers} [420] = $Awfif::costatel-> {h};
    $Awfif::mapped-> {scalers} [421] = $Awfif::costatel-> {t};
    $Awfif::mapped-> {scalers} [422] = $Awfif::costatel-> {f};
    $Awfif::mapped-> {scalers} [423] = $Awfif::costatel-> {flistl};
    $Awfif::mapped-> {scalers} [424] = $Awfif::costatel-> {tlistl};
    $Awfif::mapped-> {scalers} [425] = $Awfif::costatel-> {p};
    $Awfif::mapped-> {scalers} [426] = $Awfif::memes-> {allwsstr};
    $Awfif::mapped-> {scalers} [427] = $Awfif::memes-> {npconc};
    $Awfif::mapped-> {scalers} [428] = $Awfif::memes-> {maxpconcs};
    $Awfif::mapped-> {scalers} [429] = $Awfif::memes-> {smlscstate};
    $Awfif::mapped-> {scalers} [430] = $Awfif::memes-> {srfsmcstate};
    $Awfif::mapped-> {scalers} [431] = $Awfif::memes-> {trfsmcstate};
    $Awfif::mapped-> {scalers} [432] = $Awfif::memes-> {nfsmcstate};
    $Awfif::mapped-> {scalers} [433] = $Awfif::kwbracketd->{incb};
    $Awfif::mapped-> {scalers} [434] = $Awfif::kwbracketd->{incs};
    $Awfif::mapped-> {scalers} [435] = $Awfif::kwbracketd->{bmec};
    $Awfif::mapped-> {scalers} [436] = $Awfif::kwbracketd->{ibmec};
    $Awfif::mapped-> {scalers} [437] = $Awfif::kwbracketd->{smsc};
    $Awfif::mapped-> {scalers} [438] = $Awfif::kwjhl-> {jhlp};
    $Awfif::mapped-> {scalers} [439] = $Awfif::starttime-> {sec};
    $Awfif::mapped-> {scalers} [440] = $Awfif::starttime-> {min};
    $Awfif::mapped-> {scalers} [441] = $Awfif::starttime-> {hour};
    $Awfif::mapped-> {scalers} [442] = $Awfif::starttime-> {mday};
    $Awfif::mapped-> {scalers} [443] = $Awfif::starttime-> {mon};
    $Awfif::mapped-> {scalers} [444] = $Awfif::starttime-> {year};
    $Awfif::mapped-> {scalers} [445] = $Awfif::starttime-> {wday};
    $Awfif::mapped-> {scalers} [446] = $Awfif::starttime-> {yday};
    $Awfif::mapped-> {scalers} [447] = $Awfif::starttime-> {isdat};
    $Awfif::mapped-> {scalers} [448] = $Awfif::memes-> {fjhls8};
    $Awfif::mapped-> {scalers} [449] = $Awfif::memes-> {nwsi};
# storetofilesvbtu01
    $Awfif::mapped-> {scalers} [450] = $Awfif::wfcdefl-> {h};
    $Awfif::mapped-> {scalers} [451] = $Awfif::wfcdefl-> {t};
    $Awfif::mapped-> {scalers} [452] = $Awfif::wfcdefl-> {f};
    $Awfif::mapped-> {scalers} [453] = $Awfif::wfcdefl-> {flistl};
    $Awfif::mapped-> {scalers} [454] = $Awfif::wfcdefl-> {tlistl};
    $Awfif::mapped-> {scalers} [455] = $Awfif::wfcdefl-> {p};
    $Awfif::mapped-> {scalers} [456] = $Awfif::jhlchl-> {h};
    $Awfif::mapped-> {scalers} [457] = $Awfif::jhlchl-> {t};
    $Awfif::mapped-> {scalers} [458] = $Awfif::jhlchl-> {f};
    $Awfif::mapped-> {scalers} [459] = $Awfif::jhlchl-> {flistl};
    $Awfif::mapped-> {scalers} [460] = $Awfif::jhlchl-> {tlistl};
    $Awfif::mapped-> {scalers} [461] = $Awfif::jhlchl-> {p};
    $Awfif::mapped-> {scalers} [462] = $Awfif::memes-> {worldews};
    $Awfif::mapped-> {scalers} [463] = $Awfif::memes-> {worldsws};
    $Awfif::mapped-> {scalers} [464] = $Awfif::memes-> {worldewso};
    $Awfif::mapped-> {scalers} [465] = $Awfif::memes-> {worldswso};
    $Awfif::mapped-> {scalers} [466] = $Awfif::memes-> {vbotwspdsc};
    $Awfif::mapped-> {scalers} [467] = $Awfif::memes-> {vbotatpdsc};
    $Awfif::mapped-> {scalers} [468] = $Awfif::memes-> {vbotfitnessdsc};
    $Awfif::mapped-> {scalers} [469] = $Awfif::memes-> {candsc};
    $Awfif::mapped-> {scalers} [470] = $Awfif::memes-> {iwfccountdelbreak};
    $Awfif::mapped-> {scalers} [471] = $Awfif::memes-> {listrelinking};
    $Awfif::mapped-> {scalers} [472] = $Awfif::memes-> {msublnocop};
    $Awfif::mapped-> {scalers} [473] = $Awfif::memes-> {vbottstepsmax};
    $Awfif::mapped-> {scalers} [474] = $Awfif::memes-> {vbottgenmax};
    $Awfif::mapped-> {scalers} [475] = $Awfif::memes-> {vbottpopmax};
    $Awfif::mapped-> {scalers} [476] = $Awfif::memes-> {vbotwspdsc};
    $Awfif::mapped-> {scalers} [477] = $Awfif::memes-> {vbotatpdsc};
    $Awfif::mapped-> {scalers} [478] = $Awfif::memes-> {vbotfitnessdsc};
    $Awfif::mapped-> {scalers} [479] = $Awfif::memes-> {vbottrialmax};
    $Awfif::mapped-> {scalers} [480] = $Awfif::memes-> {vbotpgdsc};
    $Awfif::mapped-> {scalers} [481] = $Awfif::memes-> {vbotgacat};
    $Awfif::mapped-> {scalers} [482] = $Awfif::memes-> {usewaitonsquare};
    $Awfif::mapped-> {scalers} [483] = $Awfif::memes-> {usewaitonsbreak};
    $Awfif::mapped-> {scalers} [484] = $Awfif::memes-> {wfscdef};
    $Awfif::mapped-> {scalers} [485] = $Awfif::memes-> {selcptrbreak};
    $Awfif::mapped-> {scalers} [486] = $Awfif::memes-> {vbttoamxmult};
    $Awfif::mapped-> {scalers} [487] = $Awfif::memes-> {vbtcmaxamp};
    $Awfif::mapped-> {scalers} [488] = $Awfif::memes-> {iteratejhlchbreak};

    $testfname = 'test/'. $Awfif::cstruct-> {istringf};
    ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat ($testfname);
    $Awfif::mapped-> {scalers} [439] = $mtime;

    $result = storeds ($myli, \$Awfif::mapped-> {scalers}, $dirprefix . 'dcache/mapped_scalers.dat');

    $result = storeds ($myli, \$Awfif::harray-> {tce}, $dirprefix . 'dcache/harray_tce.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {statement}, $dirprefix . 'dcache/wsbl_statement.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {sgmfile}, $dirprefix . 'dcache/wsbl_sgmfile.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {l}, $dirprefix . 'dcache/wsbl_l.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {winkwp}, $dirprefix . 'dcache/wsbl_winkwp.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {winkwpr}, $dirprefix . 'dcache/wsbl_winkwpr.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsactive}, $dirprefix . 'dcache/wsbl_wsactive.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsoh}, $dirprefix . 'dcache/wsbl_wsoh.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsot}, $dirprefix . 'dcache/wsbl_wsot.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsoto}, $dirprefix . 'dcache/wsbl_wsoto.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsft}, $dirprefix . 'dcache/wsbl_wsft.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsbloh}, $dirprefix . 'dcache/wsbl_wsbloh.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsblot}, $dirprefix . 'dcache/wsbl_wsblot.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsohih}, $dirprefix . 'dcache/wsbl_wsohih.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsas}, $dirprefix . 'dcache/wsbl_wsas.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsss}, $dirprefix . 'dcache/wsbl_wsss.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {newhead}, $dirprefix . 'dcache/wsbl_newhead.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {ofssum}, $dirprefix . 'dcache/wsbl_ofssum.dat');

    $result = storeds ($myli, \$Awfif::wsol-> {l}, $dirprefix . 'dcache/wsol_l.dat');

    $result = storeds ($myli, \$Awfif::wsol-> {ni}, $dirprefix . 'dcache/wsol_ni.dat');

    $result = storeds ($myli, \$Awfif::workspace-> {l}, $dirprefix . 'dcache/workspace_l.dat');

    $result = storeds ($myli, \$Awfif::wontgroupc-> {l}, $dirprefix . 'dcache/wontgroupc_l.dat');

    $result = storeds ($myli, \$Awfif::wontgroupc-> {i}, $dirprefix . 'dcache/wontgroupc_i.dat');

    $result = storeds ($myli, \$Awfif::bicl-> {l}, $dirprefix . 'dcache/bicl_l.dat');

    $result = storeds ($myli, \$Awfif::bicl-> {rec}, $dirprefix . 'dcache/bicl_rec.dat');

    $result = storeds ($myli, \$Awfif::norml-> {h}, $dirprefix . 'dcache/norml_h.dat');

    $result = storeds ($myli, \$Awfif::norml-> {t}, $dirprefix . 'dcache/norml_t.dat');

    $result = storeds ($myli, \$Awfif::norml-> {l}, $dirprefix . 'dcache/norml_l.dat');

    $result = storeds ($myli, \$Awfif::norml-> {min}, $dirprefix . 'dcache/norml_min.dat');

    $result = storeds ($myli, \$Awfif::norml-> {max}, $dirprefix . 'dcache/norml_max.dat');

    $result = storeds ($myli, \$Awfif::ifbhcl-> {l}, $dirprefix . 'dcache/ifbhcl_l.dat');

    $result = storeds ($myli, \$Awfif::ifbhcl-> {hc}, $dirprefix . 'dcache/ifbhcl_hc.dat');

    $result = storeds ($myli, \$Awfif::ilabhcl-> {l}, $dirprefix . 'dcache/ilabhcl_l.dat');

    $result = storeds ($myli, \$Awfif::ilabhcl-> {hc}, $dirprefix . 'dcache/ilabhcl_hc.dat');

    $result = storeds ($myli, \$Awfif::framel-> {l}, $dirprefix . 'dcache/framel_l.dat');

    $result = storeds ($myli, \$Awfif::subpl-> {l}, $dirprefix . 'dcache/subpl_l.dat');

    $result = storeds ($myli, \$Awfif::subpl-> {q}, $dirprefix . 'dcache/subpl_q.dat');

    $result = storeds ($myli, \$Awfif::subpl-> {w}, $dirprefix . 'dcache/subpl_w.dat');

    $result = storeds ($myli, \$Awfif::costatel-> {l}, $dirprefix . 'dcache/costatel_l.dat');

    $result = storeds ($myli, \$Awfif::costatel-> {hash}, $dirprefix . 'dcache/costatel_hash.dat');

    $result = storeds ($myli, \$Awfif::amoffl-> {l}, $dirprefix . 'dcache/amoffl_l.dat');

    $result = storeds ($myli, \$Awfif::poolcl-> {l}, $dirprefix . 'dcache/poolcl_l.dat');

    $result = storeds ($myli, \$Awfif::syncl-> {l}, $dirprefix . 'dcache/syncl_l.dat');

    $result = storeds ($myli, \$Awfif::synccodl-> {l}, $dirprefix . 'dcache/synccodl_l.dat');

    $result = storeds ($myli, \$Awfif::cswsol-> {l}, $dirprefix . 'dcache/cswsol_l.dat');

    $result = storeds ($myli, \$Awfif::subpscdefl-> {l}, $dirprefix . 'dcache/subpscdefl_l.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {l}, $dirprefix . 'dcache/veccol_l.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {head}, $dirprefix . 'dcache/veccol_head.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {index}, $dirprefix . 'dcache/veccol_index.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {strategy}, $dirprefix . 'dcache/veccol_strategy.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {ststate}, $dirprefix . 'dcache/veccol_ststate.dat');

    $result = storeds ($myli, \$Awfif::histonel-> {l}, $dirprefix . 'dcache/histonel_l.dat');

    $result = storeds ($myli, \$Awfif::hnamel-> {l}, $dirprefix . 'dcache/hnamel_l.dat');

    $result = storeds ($myli, \$Awfif::itswsall-> {l}, $dirprefix . 'dcache/itswsall_l.dat');

    $result = storeds ($myli, \$Awfif::inhibl-> {l}, $dirprefix . 'dcache/inhibl_l.dat');

    $result = storeds ($myli, \$Awfif::inhibl-> {clpa}, $dirprefix . 'dcache/inhibl_clpa.dat');

    $result = storeds ($myli, \$Awfif::trfl-> {l}, $dirprefix . 'dcache/trfl_l.dat');

    $result = storeds ($myli, \$Awfif::trfl-> {clpa}, $dirprefix . 'dcache/trfl_clpa.dat');

    $result = storeds ($myli, \$Awfif::tral-> {l}, $dirprefix . 'dcache/tral_l.dat');

    $result = storeds ($myli, \$Awfif::tral-> {i}, $dirprefix . 'dcache/tral_i.dat');

    $result = storeds ($myli, \$Awfif::tral-> {w}, $dirprefix . 'dcache/tral_w.dat');

    $result = storeds ($myli, \$Awfif::tral-> {wt}, $dirprefix . 'dcache/tral_wt.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameash}, $dirprefix . 'dcache/tral_sameash.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameast}, $dirprefix . 'dcache/tral_sameast.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameas}, $dirprefix . 'dcache/tral_sameas.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameasaadd}, $dirprefix . 'dcache/tral_sameasaadd.dat');

    $result = storeds ($myli, \$Awfif::tral-> {c}, $dirprefix . 'dcache/tral_c.dat');

    $result = storeds ($myli, \$Awfif::tral-> {r}, $dirprefix . 'dcache/tral_r.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {l}, $dirprefix . 'dcache/tmassl_l.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {r}, $dirprefix . 'dcache/tmassl_r.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {s}, $dirprefix . 'dcache/tmassl_s.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {wsoh}, $dirprefix . 'dcache/tmassl_wsoh.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {wsot}, $dirprefix . 'dcache/tmassl_wsot.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {first}, $dirprefix . 'dcache/tmassl_first.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {salience}, $dirprefix . 'dcache/tmassl_salience.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {submitted}, $dirprefix . 'dcache/tmassl_submitted.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {proc}, $dirprefix . 'dcache/tmassl_proc.dat');

    $result = storeds ($myli, \$Awfif::kwl-> {l}, $dirprefix . 'dcache/kwl_l.dat');

    $result = storeds ($myli, \$Awfif::kwl-> {i}, $dirprefix . 'dcache/kwl_i.dat');

    $result = storeds ($myli, \$Awfif::kwl-> {w}, $dirprefix . 'dcache/kwl_w.dat');

    $result = storeds ($myli, \$Awfif::mkwl-> {l}, $dirprefix . 'dcache/mkwl_l.dat');

    $result = storeds ($myli, \$Awfif::mkwl-> {i}, $dirprefix . 'dcache/mkwl_i.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {l}, $dirprefix . 'dcache/aspl_l.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {i}, $dirprefix . 'dcache/aspl_i.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {ws}, $dirprefix . 'dcache/aspl_ws.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {nws}, $dirprefix . 'dcache/aspl_nws.dat');
# clp is transient so no reason to store

    $result = storeds ($myli, \$Awfif::sametl-> {l}, $dirprefix . 'dcache/sametl_l.dat');

    $result = storeds ($myli, \$Awfif::memes-> {backoffactive}, $dirprefix . 'dcache/memes_backoffactive.dat');

    $result = storeds ($myli, \$Awfif::memes-> {backoffactives}, $dirprefix . 'dcache/memes_backoffactives.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breakcodelet}, $dirprefix . 'dcache/memes_breakcodelet.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breaksubp}, $dirprefix . 'dcache/memes_breaksubp.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breakthwso}, $dirprefix . 'dcache/memes_breakthwso.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breakthsubp}, $dirprefix . 'dcache/memes_breakthsubp.dat');

    $result = storeds ($myli, \$Awfif::memes-> {ldbuffer}, $dirprefix . 'dcache/memes_ldbuffer.dat');

    $result = storeds ($myli, \$Awfif::memes-> {jhip}, $dirprefix . 'dcache/memes_jhip.dat');

    $result = storeds ($myli, \$Awfif::memes-> {jhlabel}, $dirprefix . 'dcache/memes_jhlabel.dat');

    $result = storeds ($myli, \$Awfif::memes-> {jhlg}, $dirprefix . 'dcache/memes_jhlg.dat');

    $result = storeds ($myli, \$Awfif::memes-> {temp}, $dirprefix . 'dcache/memes_temp.dat');

    $result = storeds ($myli, \$Awfif::memes-> {time}, $dirprefix . 'dcache/memes_time.dat');

    $result = storeds ($myli, \$Awfif::memes-> {keywordh}, $dirprefix . 'dcache/memes_keywordh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {keywordl}, $dirprefix . 'dcache/memes_keywordl.dat');

    $result = storeds ($myli, \$Awfif::memes-> {keywordwsih}, $dirprefix . 'dcache/memes_keywordwsih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {mtsnlc}, $dirprefix . 'dcache/memes_mtsnlc.dat');

    $result = storeds ($myli, \$Awfif::memes-> {sactset}, $dirprefix . 'dcache/memes_sactset.dat');

    $result = storeds ($myli, \$Awfif::memes-> {snnh}, $dirprefix . 'dcache/memes_snnh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {snnih}, $dirprefix . 'dcache/memes_snnih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {snw}, $dirprefix . 'dcache/memes_snw.dat');

    $result = storeds ($myli, \$Awfif::memes-> {wsm}, $dirprefix . 'dcache/memes_wsm.dat');

    $result = storeds ($myli, \$Awfif::memes-> {wslocality}, $dirprefix . 'dcache/memes_wslocality.dat');

    $result = storeds ($myli, \$Awfif::slipnet-> {l}, $dirprefix . 'dcache/slipnet_l.dat');

    $result = storeds ($myli, \$Awfif::slehist-> {l}, $dirprefix . 'dcache/slehist_l.dat');

    $result = storeds ($myli, \$Awfif::wsohist-> {l}, $dirprefix . 'dcache/wsohist_l.dat');

    $result = storeds ($myli, \$Awfif::jhls-> {l}, $dirprefix . 'dcache/jhls_l.dat');

    $result = storeds ($myli, \$Awfif::attribs-> {l}, $dirprefix . 'dcache/attribs_l.dat');

    $result = storeds ($myli, \$Awfif::codelet-> {l}, $dirprefix . 'dcache/codelet_l.dat');

    $result = storeds ($myli, \$Awfif::codelet-> {t}, $dirprefix . 'dcache/codelet_t.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {cseh}, $dirprefix . 'dcache/csehist_cseh.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {cseih}, $dirprefix . 'dcache/csehist_cseih.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {d}, $dirprefix . 'dcache/csehist_d.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {l}, $dirprefix . 'dcache/csehist_l.dat');

    $result = storeds ($myli, \$Awfif::cache-> {l}, $dirprefix . 'dcache/cache_l.dat');

    $result = storeds ($myli, \$Awfif::cache-> {h}, $dirprefix . 'dcache/cache_h.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {l}, $dirprefix . 'dcache/pcache_l.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {t}, $dirprefix . 'dcache/pcache_t.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {accessed}, $dirprefix . 'dcache/pcache_accessed.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {p}, $dirprefix . 'dcache/pcache_p.dat');

    $result = storeds ($myli, \$Awfif::clnk-> {l}, $dirprefix . 'dcache/clnk_l.dat');

    $result = storeds ($myli, \$Awfif::memes-> {crsmesubpspbreak}, $dirprefix . 'dcache/memes_crsmesubpspbreak.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cruna}, $dirprefix . 'dcache/memes_cruna.dat');

    $result = storeds ($myli, \$Awfif::memes-> {activationchange}, $dirprefix . 'dcache/memes_activationchange.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breaksalwso}, $dirprefix . 'dcache/memes_breaksalwso.dat');

    $result = storeds ($myli, \$Awfif::memes-> {leavein}, $dirprefix . 'dcache/memes_leavein.dat');

    $result = storeds ($myli, \$Awfif::memes-> {ch}, $dirprefix . 'dcache/memes_ch.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cseh}, $dirprefix . 'dcache/memes_cseh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cseih}, $dirprefix . 'dcache/memes_cseih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {streh}, $dirprefix . 'dcache/memes_streh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {streih}, $dirprefix . 'dcache/memes_streih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {strbool}, $dirprefix . 'dcache/memes_strbool.dat');

    $result = storeds ($myli, \$Awfif::cussnl, $dirprefix . 'dcache/cussnl.dat');

    $result = storeds ($myli, \$Awfif::kwjhl-> {jhip}, $dirprefix . 'dcache/kwjhl_jhip.dat');

    $result = storeds ($myli, \$Awfif::kwjhl-> {jhlabel}, $dirprefix . 'dcache/kwjhl_jhlabel.dat');

    $result = storeds ($myli, \$Awfif::kwjhl-> {jhlg}, $dirprefix . 'dcache/kwjhl_jhlg.dat');

    $result = storeds ($myli, \$Awfif::memes-> {dcodeletc}, $dirprefix . 'dcache/memes_dcodeletc.dat');

    $result = storeds ($myli, \$Awfif::memes-> {ieowner}, $dirprefix . 'dcache/memes_ieowner.dat');

    $result = storeds ($myli, \$Awfif::memes-> {gdeltachange}, $dirprefix . 'dcache/memes_gdeltachange.dat');
# storetofilesvbtu02

    $result = storeds ($myli, \$Awfif::wfcdefl-> {l}, $dirprefix . 'dcache/wfcdefl_l.dat');

    $result = storeds ($myli, \$Awfif::wfcdefl-> {hash}, $dirprefix . 'dcache/wfcdefl_hash.dat');

    $result = storeds ($myli, \$Awfif::wfcdefl-> {hashb}, $dirprefix . 'dcache/wfcdefl_hashb.dat');

    $result = storeds ($myli, \$Awfif::wfcdefl-> {operon}, $dirprefix . 'dcache/wfcdefl_operon.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {l}, $dirprefix . 'dcache/jhlchl_l.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {chash}, $dirprefix . 'dcache/jhlchl_chash.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {chasht}, $dirprefix . 'dcache/jhlchl_chasht.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {pchash}, $dirprefix . 'dcache/jhlchl_pchash.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {pchasht}, $dirprefix . 'dcache/jhlchl_pchasht.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhclmax}, $dirprefix . 'dcache/jhlchl_jhclmax.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhclmin}, $dirprefix . 'dcache/jhlchl_jhclmin.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhpclmax}, $dirprefix . 'dcache/jhlchl_jhpclmax.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhpclmin}, $dirprefix . 'dcache/jhlchl_jhpclmin.dat');

    $result = storeds ($myli, \$Awfif::memes-> {canx}, $dirprefix . 'dcache/memes_canx.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cany}, $dirprefix . 'dcache/memes_cany.dat');
# storetofilesscmapu1

# scmap, fitness and gens are stored in vbot with storecscmap and should not be stored here

    print ("storetofiles completed\n");
    return $result
    }# storetofiles
#
#<!-- end tag aso -->
#
sub retrieveds {
    my ($myli, $p, $filestring) = @_;
    my ($result);

# store all key data sets to files for later resume
#
    use Storable qw (retrieve);
    $$p = eval { retrieve ($filestring)};
    if ($@){

      if ($@ !~ /No such file or directory/) {
        &break ();#serious error from storable
        };
      print ("retrieveds myli $myli storable retrieve error($@)");
      }
    elsif (!defined ($$p)) {

      &break ();#i/o error from storable
      print ("retrieveds myli $myli storable i/o error($!)");
      }#elsif
    else {

      $result = 't';
      };#else

    return $result
    }# retrieveds
#
sub retrievefromfiles {
    my ($myli) = @_;
    my ($test, $proceed, $result, $testfname, $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks, $dirprefix);
# retrieve all key data sets to files for later resume
#

    $test = chdir("My Documents");
    $proceed = '';
    $dirprefix = '';#change to vbt for vbot
    &retrieveds ($myli, \$Awfif::mapped-> {scalers}, $dirprefix . 'dcache/mapped_scalers.dat');
    if (($test) && ($proceed) && (defined ($Awfif::mapped-> {scalers} [414])) ){

      $testfname = 'test/'. $Awfif::mapped-> {scalers} [414];
      ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat ($testfname);
      if (
      ($mtime == $Awfif::mapped-> {scalers} [439])
      ){#retrieve from persisted state

        $result = 't';
        $Awfif::memes-> {codeleth} = $Awfif::mapped-> {scalers} [0];
        $Awfif::memes-> {codeletw} = $Awfif::mapped-> {scalers} [1];
        $Awfif::memes-> {codelett} = $Awfif::mapped-> {scalers} [2];
        $Awfif::memes-> {codeletf} = $Awfif::mapped-> {scalers} [3];
        $Awfif::codelet-> {p} = $Awfif::mapped-> {scalers} [4];
        $Awfif::wsbl-> {h} = $Awfif::mapped-> {scalers} [5];
        $Awfif::wsbl-> {t} = $Awfif::mapped-> {scalers} [6];
        $Awfif::wsbl-> {f} = $Awfif::mapped-> {scalers} [7];
        $Awfif::wsbl-> {flistl} = $Awfif::mapped-> {scalers} [8];
        $Awfif::wsbl-> {tlistl} = $Awfif::mapped-> {scalers} [9];
        $Awfif::wsbl-> {p} = $Awfif::mapped-> {scalers} [10];
        $Awfif::wsol-> {h} = $Awfif::mapped-> {scalers} [11];
        $Awfif::wsol-> {t} = $Awfif::mapped-> {scalers} [12];
        $Awfif::wsol-> {f} = $Awfif::mapped-> {scalers} [13];
        $Awfif::wsol-> {flistl} = $Awfif::mapped-> {scalers} [14];
        $Awfif::wsol-> {tlistl} = $Awfif::mapped-> {scalers} [15];
        $Awfif::wsol-> {p} = $Awfif::mapped-> {scalers} [16];
        $Awfif::workspace-> {h} = $Awfif::mapped-> {scalers} [17];
        $Awfif::workspace-> {t} = $Awfif::mapped-> {scalers} [18];
        $Awfif::workspace-> {f} = $Awfif::mapped-> {scalers} [19];
        $Awfif::workspace-> {flistl} = $Awfif::mapped-> {scalers} [20];
        $Awfif::workspace-> {tlistl} = $Awfif::mapped-> {scalers} [21];
        $Awfif::workspace-> {p} = $Awfif::mapped-> {scalers} [22];
        $Awfif::wontgroupc-> {h} = $Awfif::mapped-> {scalers} [23];
        $Awfif::wontgroupc-> {t} = $Awfif::mapped-> {scalers} [24];
        $Awfif::wontgroupc-> {f} = $Awfif::mapped-> {scalers} [25];
        $Awfif::wontgroupc-> {flistl} = $Awfif::mapped-> {scalers} [26];
        $Awfif::wontgroupc-> {tlistl} = $Awfif::mapped-> {scalers} [27];
        $Awfif::wontgroupc-> {caller} = $Awfif::mapped-> {scalers} [28];
        $Awfif::wontgroupc-> {p} = $Awfif::mapped-> {scalers} [29];
        $Awfif::bicl-> {h} = $Awfif::mapped-> {scalers} [30];
        $Awfif::bicl-> {t} = $Awfif::mapped-> {scalers} [31];
        $Awfif::bicl-> {f} = $Awfif::mapped-> {scalers} [32];
        $Awfif::bicl-> {flistl} = $Awfif::mapped-> {scalers} [33];
        $Awfif::bicl-> {tlistl} = $Awfif::mapped-> {scalers} [34];
        $Awfif::bicl-> {cp} = $Awfif::mapped-> {scalers} [35];
        $Awfif::bicl-> {p} = $Awfif::mapped-> {scalers} [36];
        $Awfif::norml-> {f} = $Awfif::mapped-> {scalers} [37];
        $Awfif::norml-> {flistl} = $Awfif::mapped-> {scalers} [38];
        $Awfif::norml-> {tlistl} = $Awfif::mapped-> {scalers} [39];
        $Awfif::norml-> {p} = $Awfif::mapped-> {scalers} [40];
        $Awfif::ifbhcl-> {h} = $Awfif::mapped-> {scalers} [41];
        $Awfif::ifbhcl-> {t} = $Awfif::mapped-> {scalers} [42];
        $Awfif::ifbhcl-> {f} = $Awfif::mapped-> {scalers} [43];
        $Awfif::ifbhcl-> {flistl} = $Awfif::mapped-> {scalers} [44];
        $Awfif::ifbhcl-> {tlistl} = $Awfif::mapped-> {scalers} [45];
        $Awfif::ifbhcl-> {p} = $Awfif::mapped-> {scalers} [46];
        $Awfif::ilabhcl-> {h} = $Awfif::mapped-> {scalers} [47];
        $Awfif::ilabhcl-> {t} = $Awfif::mapped-> {scalers} [48];
        $Awfif::ilabhcl-> {f} = $Awfif::mapped-> {scalers} [49];
        $Awfif::ilabhcl-> {flistl} = $Awfif::mapped-> {scalers} [50];
        $Awfif::ilabhcl-> {tlistl} = $Awfif::mapped-> {scalers} [51];
        $Awfif::ilabhcl-> {p} = $Awfif::mapped-> {scalers} [52];
        $Awfif::framel-> {h} = $Awfif::mapped-> {scalers} [53];
        $Awfif::framel-> {t} = $Awfif::mapped-> {scalers} [54];
        $Awfif::framel-> {f} = $Awfif::mapped-> {scalers} [55];
        $Awfif::framel-> {flistl} = $Awfif::mapped-> {scalers} [56];
        $Awfif::framel-> {tlistl} = $Awfif::mapped-> {scalers} [57];
        $Awfif::framel-> {p} = $Awfif::mapped-> {scalers} [58];
        $Awfif::subpl-> {h} = $Awfif::mapped-> {scalers} [59];
        $Awfif::subpl-> {t} = $Awfif::mapped-> {scalers} [60];
        $Awfif::subpl-> {f} = $Awfif::mapped-> {scalers} [61];
        $Awfif::subpl-> {flistl} = $Awfif::mapped-> {scalers} [62];
        $Awfif::subpl-> {tlistl} = $Awfif::mapped-> {scalers} [63];
        $Awfif::subpl-> {p} = $Awfif::mapped-> {scalers} [64];
        $Awfif::amoffl-> {h} = $Awfif::mapped-> {scalers} [65];
        $Awfif::amoffl-> {t} = $Awfif::mapped-> {scalers} [66];
        $Awfif::amoffl-> {f} = $Awfif::mapped-> {scalers} [67];
        $Awfif::amoffl-> {flistl} = $Awfif::mapped-> {scalers} [68];
        $Awfif::amoffl-> {tlistl} = $Awfif::mapped-> {scalers} [69];
        $Awfif::amoffl-> {p} = $Awfif::mapped-> {scalers} [70];
        $Awfif::poolcl-> {h} = $Awfif::mapped-> {scalers} [71];
        $Awfif::poolcl-> {t} = $Awfif::mapped-> {scalers} [72];
        $Awfif::poolcl-> {f} = $Awfif::mapped-> {scalers} [73];
        $Awfif::poolcl-> {flistl} = $Awfif::mapped-> {scalers} [74];
        $Awfif::poolcl-> {tlistl} = $Awfif::mapped-> {scalers} [75];
        $Awfif::poolcl-> {p} = $Awfif::mapped-> {scalers} [76];
        $Awfif::syncl-> {h} = $Awfif::mapped-> {scalers} [77];
        $Awfif::syncl-> {t} = $Awfif::mapped-> {scalers} [78];
        $Awfif::syncl-> {f} = $Awfif::mapped-> {scalers} [79];
        $Awfif::syncl-> {flistl} = $Awfif::mapped-> {scalers} [80];
        $Awfif::syncl-> {tlistl} = $Awfif::mapped-> {scalers} [81];
        $Awfif::syncl-> {p} = $Awfif::mapped-> {scalers} [82];
        $Awfif::synccodl-> {h} = $Awfif::mapped-> {scalers} [83];
        $Awfif::synccodl-> {t} = $Awfif::mapped-> {scalers} [84];
        $Awfif::synccodl-> {f} = $Awfif::mapped-> {scalers} [85];
        $Awfif::synccodl-> {flistl} = $Awfif::mapped-> {scalers} [86];
        $Awfif::synccodl-> {tlistl} = $Awfif::mapped-> {scalers} [87];
        $Awfif::synccodl-> {p} = $Awfif::mapped-> {scalers} [88];
        $Awfif::cswsol-> {h} = $Awfif::mapped-> {scalers} [89];
        $Awfif::cswsol-> {t} = $Awfif::mapped-> {scalers} [90];
        $Awfif::cswsol-> {f} = $Awfif::mapped-> {scalers} [91];
        $Awfif::cswsol-> {flistl} = $Awfif::mapped-> {scalers} [92];
        $Awfif::cswsol-> {tlistl} = $Awfif::mapped-> {scalers} [93];
        $Awfif::cswsol-> {p} = $Awfif::mapped-> {scalers} [94];
        $Awfif::subpscdefl-> {h} = $Awfif::mapped-> {scalers} [95];
        $Awfif::subpscdefl-> {t} = $Awfif::mapped-> {scalers} [96];
        $Awfif::subpscdefl-> {f} = $Awfif::mapped-> {scalers} [97];
        $Awfif::subpscdefl-> {flistl} = $Awfif::mapped-> {scalers} [98];
        $Awfif::subpscdefl-> {tlistl} = $Awfif::mapped-> {scalers} [99];
        $Awfif::subpscdefl-> {p} = $Awfif::mapped-> {scalers} [100];
        $Awfif::veccol-> {h} = $Awfif::mapped-> {scalers} [101];
        $Awfif::veccol-> {t} = $Awfif::mapped-> {scalers} [102];
        $Awfif::veccol-> {f} = $Awfif::mapped-> {scalers} [103];
        $Awfif::veccol-> {flistl} = $Awfif::mapped-> {scalers} [104];
        $Awfif::veccol-> {tlistl} = $Awfif::mapped-> {scalers} [105];
        $Awfif::veccol-> {p} = $Awfif::mapped-> {scalers} [106];
        $Awfif::veccol-> {vcstate} = $Awfif::mapped-> {scalers} [107];
        $Awfif::histonel-> {h} = $Awfif::mapped-> {scalers} [108];
        $Awfif::histonel-> {t} = $Awfif::mapped-> {scalers} [109];
        $Awfif::histonel-> {f} = $Awfif::mapped-> {scalers} [110];
        $Awfif::histonel-> {flistl} = $Awfif::mapped-> {scalers} [111];
        $Awfif::histonel-> {tlistl} = $Awfif::mapped-> {scalers} [112];
        $Awfif::histonel-> {p} = $Awfif::mapped-> {scalers} [113];
        $Awfif::hnamel-> {h} = $Awfif::mapped-> {scalers} [114];
        $Awfif::hnamel-> {t} = $Awfif::mapped-> {scalers} [115];
        $Awfif::hnamel-> {f} = $Awfif::mapped-> {scalers} [116];
        $Awfif::hnamel-> {flistl} = $Awfif::mapped-> {scalers} [117];
        $Awfif::hnamel-> {tlistl} = $Awfif::mapped-> {scalers} [118];
        $Awfif::hnamel-> {p} = $Awfif::mapped-> {scalers} [119];
        $Awfif::itswsall-> {h} = $Awfif::mapped-> {scalers} [120];
        $Awfif::itswsall-> {t} = $Awfif::mapped-> {scalers} [121];
        $Awfif::itswsall-> {f} = $Awfif::mapped-> {scalers} [122];
        $Awfif::itswsall-> {flistl} = $Awfif::mapped-> {scalers} [123];
        $Awfif::itswsall-> {tlistl} = $Awfif::mapped-> {scalers} [124];
        $Awfif::itswsall-> {p} = $Awfif::mapped-> {scalers} [125];
        $Awfif::inhibl-> {h} = $Awfif::mapped-> {scalers} [126];
        $Awfif::inhibl-> {t} = $Awfif::mapped-> {scalers} [127];
        $Awfif::inhibl-> {f} = $Awfif::mapped-> {scalers} [128];
        $Awfif::inhibl-> {flistl} = $Awfif::mapped-> {scalers} [129];
        $Awfif::inhibl-> {tlistl} = $Awfif::mapped-> {scalers} [130];
        $Awfif::inhibl-> {p} = $Awfif::mapped-> {scalers} [131];
        $Awfif::trfl-> {h} = $Awfif::mapped-> {scalers} [132];
        $Awfif::trfl-> {t} = $Awfif::mapped-> {scalers} [133];
        $Awfif::trfl-> {f} = $Awfif::mapped-> {scalers} [134];
        $Awfif::trfl-> {flistl} = $Awfif::mapped-> {scalers} [135];
        $Awfif::trfl-> {tlistl} = $Awfif::mapped-> {scalers} [136];
        $Awfif::trfl-> {p} = $Awfif::mapped-> {scalers} [137];
- 142 missing
        $Awfif::tral-> {h} = $Awfif::mapped-> {scalers} [143];
        $Awfif::tral-> {t} = $Awfif::mapped-> {scalers} [144];
        $Awfif::tral-> {f} = $Awfif::mapped-> {scalers} [145];
        $Awfif::tral-> {flistl} = $Awfif::mapped-> {scalers} [146];
        $Awfif::tral-> {tlistl} = $Awfif::mapped-> {scalers} [147];
        $Awfif::tral-> {p} = $Awfif::mapped-> {scalers} [148];
        $Awfif::tmassl-> {h} = $Awfif::mapped-> {scalers} [149];
        $Awfif::tmassl-> {t} = $Awfif::mapped-> {scalers} [150];
        $Awfif::tmassl-> {f} = $Awfif::mapped-> {scalers} [151];
        $Awfif::tmassl-> {flistl} = $Awfif::mapped-> {scalers} [152];
        $Awfif::tmassl-> {tlistl} = $Awfif::mapped-> {scalers} [153];
        $Awfif::tmassl-> {p} = $Awfif::mapped-> {scalers} [154];
        $Awfif::kwl-> {h} = $Awfif::mapped-> {scalers} [155];
        $Awfif::kwl-> {t} = $Awfif::mapped-> {scalers} [156];
        $Awfif::kwl-> {f} = $Awfif::mapped-> {scalers} [157];
        $Awfif::kwl-> {flistl} = $Awfif::mapped-> {scalers} [158];
        $Awfif::kwl-> {tlistl} = $Awfif::mapped-> {scalers} [159];
        $Awfif::kwl-> {p} = $Awfif::mapped-> {scalers} [160];
        $Awfif::mkwl-> {h} = $Awfif::mapped-> {scalers} [161];
        $Awfif::mkwl-> {t} = $Awfif::mapped-> {scalers} [162];
        $Awfif::mkwl-> {f} = $Awfif::mapped-> {scalers} [163];
        $Awfif::mkwl-> {flistl} = $Awfif::mapped-> {scalers} [164];
        $Awfif::mkwl-> {tlistl} = $Awfif::mapped-> {scalers} [165];
        $Awfif::mkwl-> {p} = $Awfif::mapped-> {scalers} [166];
        $Awfif::aspl-> {h} = $Awfif::mapped-> {scalers} [167];
        $Awfif::aspl-> {t} = $Awfif::mapped-> {scalers} [168];
        $Awfif::aspl-> {f} = $Awfif::mapped-> {scalers} [169];
        $Awfif::aspl-> {flistl} = $Awfif::mapped-> {scalers} [170];
        $Awfif::aspl-> {tlistl} = $Awfif::mapped-> {scalers} [171];
        $Awfif::aspl-> {p} = $Awfif::mapped-> {scalers} [172];
# clp is transient
        $Awfif::sametl-> {h} = $Awfif::mapped-> {scalers} [173];
        $Awfif::sametl-> {t} = $Awfif::mapped-> {scalers} [174];
        $Awfif::sametl-> {f} = $Awfif::mapped-> {scalers} [175];
        $Awfif::sametl-> {flistl} = $Awfif::mapped-> {scalers} [176];
        $Awfif::sametl-> {tlistl} = $Awfif::mapped-> {scalers} [177];
        $Awfif::sametl-> {p} = $Awfif::mapped-> {scalers} [178];
        $Awfif::memes-> {actamp} = $Awfif::mapped-> {scalers} [179];
        $Awfif::memes-> {actth} = $Awfif::mapped-> {scalers} [180];
        $Awfif::memes-> {actramp} = $Awfif::mapped-> {scalers} [181];
        $Awfif::memes-> {actmax} = $Awfif::mapped-> {scalers} [182];
        $Awfif::memes-> {actdamper} = $Awfif::mapped-> {scalers} [183];
        $Awfif::memes-> {acteu} = $Awfif::mapped-> {scalers} [184];
        $Awfif::memes-> {actfocus} = $Awfif::mapped-> {scalers} [185];
        $Awfif::memes-> {actweight} = $Awfif::mapped-> {scalers} [186];
        $Awfif::memes-> {batp} = $Awfif::mapped-> {scalers} [187];
        $Awfif::memes-> {bondafrom} = $Awfif::mapped-> {scalers} [188];
        $Awfif::memes-> {bondato} = $Awfif::mapped-> {scalers} [189];
        $Awfif::memes-> {bondatype} = $Awfif::mapped-> {scalers} [190];
        $Awfif::memes-> {bondamp} = $Awfif::mapped-> {scalers} [191];
        $Awfif::memes-> {bondbar} = $Awfif::mapped-> {scalers} [192];
        $Awfif::memes-> {bondrwd} = $Awfif::mapped-> {scalers} [193];
        $Awfif::memes-> {usedesc} = $Awfif::mapped-> {scalers} [194];
        $Awfif::memes-> {igdesc} = $Awfif::mapped-> {scalers} [195];
        $Awfif::memes-> {userel} = $Awfif::mapped-> {scalers} [196];
        $Awfif::memes-> {igrel} = $Awfif::mapped-> {scalers} [197];
        $Awfif::memes-> {buscu} = $Awfif::mapped-> {scalers} [198];
        $Awfif::memes-> {budescu} = $Awfif::mapped-> {scalers} [199];
        $Awfif::memes-> {tdbsurg} = $Awfif::mapped-> {scalers} [200];
        $Awfif::memes-> {tddsurg} = $Awfif::mapped-> {scalers} [201];
        $Awfif::memes-> {tdgsurg} = $Awfif::mapped-> {scalers} [202];
        $Awfif::memes-> {coordmax} = $Awfif::mapped-> {scalers} [203];
        $Awfif::memes-> {coordamp} = $Awfif::mapped-> {scalers} [204];
        $Awfif::memes-> {critical} = $Awfif::mapped-> {scalers} [205];
        $Awfif::memes-> {crwait} = $Awfif::mapped-> {scalers} [206];
        $Awfif::memes-> {csehih} = $Awfif::mapped-> {scalers} [207];
        $Awfif::memes-> {cpmax} = $Awfif::mapped-> {scalers} [208];
        $Awfif::memes-> {currentwsbi} = $Awfif::mapped-> {scalers} [209];
        $Awfif::memes-> {depthamp} = $Awfif::mapped-> {scalers} [210];
        $Awfif::memes-> {depthslp} = $Awfif::mapped-> {scalers} [211];
        $Awfif::memes-> {depththamp} = $Awfif::mapped-> {scalers} [212];
        $Awfif::memes-> {desbar} = $Awfif::mapped-> {scalers} [213];
        $Awfif::memes-> {desrwd} = $Awfif::mapped-> {scalers} [214];
        $Awfif::memes-> {descafrom} = $Awfif::mapped-> {scalers} [215];
        $Awfif::memes-> {descato} = $Awfif::mapped-> {scalers} [216];
        $Awfif::memes-> {descatype} = $Awfif::mapped-> {scalers} [217];
        $Awfif::memes-> {datp} = $Awfif::mapped-> {scalers} [218];
        $Awfif::memes-> {fatigue} = $Awfif::mapped-> {scalers} [219];
        $Awfif::memes-> {fatp} = $Awfif::mapped-> {scalers} [220];
        $Awfif::memes-> {fcodelets} = $Awfif::mapped-> {scalers} [221];
        $Awfif::memes-> {gatp} = $Awfif::mapped-> {scalers} [222];
        $Awfif::memes-> {halomax} = $Awfif::mapped-> {scalers} [223];
        $Awfif::memes-> {ldav} = $Awfif::mapped-> {scalers} [224];
        $Awfif::memes-> {ldoav} = $Awfif::mapped-> {scalers} [225];
        $Awfif::memes-> {lderr} = $Awfif::mapped-> {scalers} [226];
        $Awfif::memes-> {ldlcycle} = $Awfif::mapped-> {scalers} [227];
        $Awfif::memes-> {ldlcyclemax} = $Awfif::mapped-> {scalers} [228];
        $Awfif::memes-> {ldmcycle} = $Awfif::mapped-> {scalers} [229];
        $Awfif::memes-> {ldmcyclemax} = $Awfif::mapped-> {scalers} [230];
        $Awfif::memes-> {ldsignal} = $Awfif::mapped-> {scalers} [231];
        $Awfif::memes-> {iphase} = $Awfif::mapped-> {scalers} [232];
        $Awfif::memes-> {iphasecomp} = $Awfif::mapped-> {scalers} [233];
        $Awfif::memes-> {minnorm} = $Awfif::mapped-> {scalers} [234];
        $Awfif::memes-> {mrework} = $Awfif::mapped-> {scalers} [235];
        $Awfif::memes-> {maxact} = $Awfif::mapped-> {scalers} [236];
        $Awfif::memes-> {maxoper} = $Awfif::mapped-> {scalers} [237];
        $Awfif::memes-> {ndecay} = $Awfif::mapped-> {scalers} [238];
        $Awfif::memes-> {ntact} = $Awfif::mapped-> {scalers} [239];
        $Awfif::memes-> {openafrom} = $Awfif::mapped-> {scalers} [240];
        $Awfif::memes-> {openato} = $Awfif::mapped-> {scalers} [241];
        $Awfif::memes-> {openatype} = $Awfif::mapped-> {scalers} [242];
        $Awfif::memes-> {pstream} = $Awfif::mapped-> {scalers} [243];
        $Awfif::memes-> {peaksal} = $Awfif::mapped-> {scalers} [244];
        $Awfif::memes-> {groupsponsor} = $Awfif::mapped-> {scalers} [245];
        $Awfif::memes-> {jhlp} = $Awfif::mapped-> {scalers} [246];
        $Awfif::memes-> {lbbase} = $Awfif::mapped-> {scalers} [247];
        $Awfif::memes-> {lebase} = $Awfif::mapped-> {scalers} [248];
        $Awfif::memes-> {lsbase} = $Awfif::mapped-> {scalers} [249];
        $Awfif::memes-> {lsnbase} = $Awfif::mapped-> {scalers} [250];
        $Awfif::memes-> {log} = $Awfif::mapped-> {scalers} [251];
        $Awfif::memes-> {logentry} = $Awfif::mapped-> {scalers} [252];
        $Awfif::memes-> {relafrom} = $Awfif::mapped-> {scalers} [253];
        $Awfif::memes-> {relato} = $Awfif::mapped-> {scalers} [254];
        $Awfif::memes-> {relatype} = $Awfif::mapped-> {scalers} [255];
        $Awfif::memes-> {relamp} = $Awfif::mapped-> {scalers} [256];
        $Awfif::memes-> {relbar} = $Awfif::mapped-> {scalers} [257];
        $Awfif::memes-> {relrwd} = $Awfif::mapped-> {scalers} [258];
        $Awfif::memes-> {rtemp} = $Awfif::mapped-> {scalers} [259];
        $Awfif::memes-> {bondthreshold} = $Awfif::mapped-> {scalers} [260];
        $Awfif::memes-> {descthreshold} = $Awfif::mapped-> {scalers} [261];
        $Awfif::memes-> {destthreshold} = $Awfif::mapped-> {scalers} [262];
        $Awfif::memes-> {structamp} = $Awfif::mapped-> {scalers} [263];
        $Awfif::memes-> {strbcont} = $Awfif::mapped-> {scalers} [264];
        $Awfif::memes-> {strnbcont} = $Awfif::mapped-> {scalers} [265];
        $Awfif::memes-> {tcodelets} = $Awfif::mapped-> {scalers} [266];
        $Awfif::memes-> {tcodeletmax} = $Awfif::mapped-> {scalers} [267];
        $Awfif::memes-> {trace} = $Awfif::mapped-> {scalers} [268];
        $Awfif::memes-> {traceentry} = $Awfif::mapped-> {scalers} [269];
        $Awfif::memes-> {tracetemp} = $Awfif::mapped-> {scalers} [270];
        $Awfif::memes-> {traceurg} = $Awfif::mapped-> {scalers} [271];
        $Awfif::memes-> {tracefull} = $Awfif::mapped-> {scalers} [272];
        $Awfif::memes-> {tracephase} = $Awfif::mapped-> {scalers} [273];
        $Awfif::memes-> {tracetree} = $Awfif::mapped-> {scalers} [274];
        $Awfif::memes-> {tracemcache} = $Awfif::mapped-> {scalers} [275];
        $Awfif::memes-> {tracescache} = $Awfif::mapped-> {scalers} [276];
        $Awfif::memes-> {tracewscache} = $Awfif::mapped-> {scalers} [277];
        $Awfif::memes-> {tmcacheth} = $Awfif::mapped-> {scalers} [278];
        $Awfif::memes-> {tscacheth} = $Awfif::mapped-> {scalers} [279];
        $Awfif::memes-> {twscacheth} = $Awfif::mapped-> {scalers} [280];
        $Awfif::memes-> {kwmi} = $Awfif::mapped-> {scalers} [281];
        $Awfif::memes-> {kwmir} = $Awfif::mapped-> {scalers} [282];
        $Awfif::memes-> {kwwsbi} = $Awfif::mapped-> {scalers} [283];
        $Awfif::memes-> {kwp} = $Awfif::mapped-> {scalers} [284];
        $Awfif::memes-> {kwpr} = $Awfif::mapped-> {scalers} [285];
        $Awfif::memes-> {mtsnlvl} = $Awfif::mapped-> {scalers} [286];
        $Awfif::memes-> {mtsnstate} = $Awfif::mapped-> {scalers} [287];
        $Awfif::memes-> {shout} = $Awfif::mapped-> {scalers} [288];
        $Awfif::memes-> {slipth} = $Awfif::mapped-> {scalers} [289];
        $Awfif::memes-> {snehih} = $Awfif::mapped-> {scalers} [290];
        $Awfif::memes-> {uhmax} = $Awfif::mapped-> {scalers} [291];
        $Awfif::memes-> {uhth} = $Awfif::mapped-> {scalers} [292];
        $Awfif::memes-> {wsohih} = $Awfif::mapped-> {scalers} [293];
        $Awfif::slipnet-> {p} = $Awfif::mapped-> {scalers} [294];
        $Awfif::slehist-> {p} = $Awfif::mapped-> {scalers} [295];
        $Awfif::wsohist-> {p} = $Awfif::mapped-> {scalers} [296];
        $Awfif::jhls-> {p} = $Awfif::mapped-> {scalers} [297];
        $Awfif::attribs-> {p} = $Awfif::mapped-> {scalers} [298];
        $Awfif::csehist-> {p} = $Awfif::mapped-> {scalers} [299];
        $Awfif::clnk-> {h} = $Awfif::mapped-> {scalers} [300];
        $Awfif::clnk-> {t} = $Awfif::mapped-> {scalers} [301];
        $Awfif::clnk-> {f} = $Awfif::mapped-> {scalers} [302];
        $Awfif::clnk-> {flistl} = $Awfif::mapped-> {scalers} [303];
        $Awfif::clnk-> {p} = $Awfif::mapped-> {scalers} [304];
        $Awfif::memes-> {loopcheck} = $Awfif::mapped-> {scalers} [305];
        $Awfif::memes-> {loopth} = $Awfif::mapped-> {scalers} [306];
        $Awfif::memes-> {ptrace} = $Awfif::mapped-> {scalers} [307];
        $Awfif::memes-> {failatpr} = $Awfif::mapped-> {scalers} [308];
        $Awfif::memes-> {traceadentry} = $Awfif::mapped-> {scalers} [309];
        $Awfif::memes-> {telomeretrace} = $Awfif::mapped-> {scalers} [310];
        $Awfif::memes-> {tracedpcache} = $Awfif::mapped-> {scalers} [311];
        $Awfif::memes-> {tracevcentry} = $Awfif::mapped-> {scalers} [312];
        $Awfif::memes-> {traceclogentry}= $Awfif::mapped-> {scalers} [313];
        $Awfif::memes-> {ratcoth} = $Awfif::mapped-> {scalers} [314];
        $Awfif::memes-> {abscoth} = $Awfif::mapped-> {scalers} [315];
        $Awfif::memes-> {nomcrsmgrab} = $Awfif::mapped-> {scalers} [316];
        $Awfif::memes-> {ssiasslncusetmass}= $Awfif::mapped-> {scalers} [317];
        $Awfif::memes-> {tracetime} = $Awfif::mapped-> {scalers} [318];
        $Awfif::memes-> {tracehrtime} = $Awfif::mapped-> {scalers} [319];
        $Awfif::memes-> {tellifeth} = $Awfif::mapped-> {scalers} [320];
        $Awfif::memes-> {telcountth} = $Awfif::mapped-> {scalers} [321];
        $Awfif::memes-> {inhuramp} = $Awfif::mapped-> {scalers} [322];
        $Awfif::memes-> {usewcf1d} = $Awfif::mapped-> {scalers} [323];
        $Awfif::memes-> {usetdfmod} = $Awfif::mapped-> {scalers} [324];
        $Awfif::memes-> {tdfsampth} = $Awfif::mapped-> {scalers} [325];
        $Awfif::memes-> {tdfsampds} = $Awfif::mapped-> {scalers} [326];
        $Awfif::memes-> {tdfsampacc} = $Awfif::mapped-> {scalers} [327];
        $Awfif::memes-> {mainco} = $Awfif::mapped-> {scalers} [328];
        $Awfif::memes-> {maininc} = $Awfif::mapped-> {scalers} [329];
        $Awfif::memes-> {freeampth} = $Awfif::mapped-> {scalers} [330];
        $Awfif::memes-> {maxusefree} = $Awfif::mapped-> {scalers} [331];
        $Awfif::memes-> {bcsubpsindex} = $Awfif::mapped-> {scalers} [332];
        $Awfif::memes-> {ivalwindex} = $Awfif::mapped-> {scalers} [333];
        $Awfif::memes-> {crsmindex} = $Awfif::mapped-> {scalers} [334];
        $Awfif::memes-> {totup} = $Awfif::mapped-> {scalers} [335];
        $Awfif::memes-> {bugsmax} = $Awfif::mapped-> {scalers} [336];
        $Awfif::memes-> {killth} = $Awfif::mapped-> {scalers} [337];
        $Awfif::memes-> {ampramp} = $Awfif::mapped-> {scalers} [338];
        $Awfif::memes-> {waitamp} = $Awfif::mapped-> {scalers} [339];
        $Awfif::memes-> {convfrom} = $Awfif::mapped-> {scalers} [340];
        $Awfif::memes-> {groupatype} = $Awfif::mapped-> {scalers} [341];
        $Awfif::memes-> {groupato} = $Awfif::mapped-> {scalers} [342];
        $Awfif::memes-> {groupafrom} = $Awfif::mapped-> {scalers} [343];
        $Awfif::memes-> {bumscu} = $Awfif::mapped-> {scalers} [344];
        $Awfif::memes-> {tdgsramp} = $Awfif::mapped-> {scalers} [345];
        $Awfif::memes-> {geramp} = $Awfif::mapped-> {scalers} [346];
        $Awfif::memes-> {gerhiamp} = $Awfif::mapped-> {scalers} [347];
        $Awfif::memes-> {budestscu} = $Awfif::mapped-> {scalers} [348];
        $Awfif::memes-> {pappbu} = $Awfif::mapped-> {scalers} [349];
        $Awfif::memes-> {parteu} = $Awfif::mapped-> {scalers} [350];
        $Awfif::memes-> {evlaunchm} = $Awfif::mapped-> {scalers} [351];
        $Awfif::memes-> {evlaunchhim} = $Awfif::mapped-> {scalers} [352];
        $Awfif::memes-> {blaunchm} = $Awfif::mapped-> {scalers} [353];
        $Awfif::memes-> {ilaunchm} = $Awfif::mapped-> {scalers} [354];
        $Awfif::memes-> {icompdlaunchm} = $Awfif::mapped-> {scalers} [355];
        $Awfif::memes-> {manthreshold} = $Awfif::mapped-> {scalers} [356];
        $Awfif::memes-> {pstment} = $Awfif::mapped-> {scalers} [357];
        $Awfif::memes-> {pactive} = $Awfif::mapped-> {scalers} [358];
        $Awfif::memes-> {psubprogram} = $Awfif::mapped-> {scalers} [359];
        $Awfif::memes-> {acodelets} = $Awfif::mapped-> {scalers} [360];
        $Awfif::memes-> {mincodelets} = $Awfif::mapped-> {scalers} [361];
        $Awfif::memes-> {breakmyli} = $Awfif::mapped-> {scalers} [362];
        $Awfif::memes-> {bmbcindex} = $Awfif::mapped-> {scalers} [363];
        $Awfif::memes-> {drwait} = $Awfif::mapped-> {scalers} [364];
        $Awfif::memes-> {crfocuswin} = $Awfif::mapped-> {scalers} [365];
        $Awfif::memes-> {grcompaward} = $Awfif::mapped-> {scalers} [366];
        $Awfif::memes-> {salthr} = $Awfif::mapped-> {scalers} [367];
        $Awfif::memes-> {mmratio} = $Awfif::mapped-> {scalers} [368];
        $Awfif::memes-> {dmratio} = $Awfif::mapped-> {scalers} [369];
        $Awfif::memes-> {verbsrcws} = $Awfif::mapped-> {scalers} [370];
        $Awfif::memes-> {verbtaws} = $Awfif::mapped-> {scalers} [371];
        $Awfif::memes-> {clogbplist} = $Awfif::mapped-> {scalers} [372];
        $Awfif::memes-> {clogeplist} = $Awfif::mapped-> {scalers} [373];
        $Awfif::memes-> {clogs} = $Awfif::mapped-> {scalers} [374];
        $Awfif::memes-> {comprocessing} = $Awfif::mapped-> {scalers} [375];
        $Awfif::memes-> {cbprocessing} = $Awfif::mapped-> {scalers} [376];
        $Awfif::memes-> {maxnormitems} = $Awfif::mapped-> {scalers} [377];
        $Awfif::memes-> {cpcountth} = $Awfif::mapped-> {scalers} [378];
        $Awfif::memes-> {maxtdgloop} = $Awfif::mapped-> {scalers} [379];
        $Awfif::memes-> {itswsallc} = $Awfif::mapped-> {scalers} [380];
        $Awfif::memes-> {wsoname} = $Awfif::mapped-> {scalers} [381];
        $Awfif::memes-> {buildfbth} = $Awfif::mapped-> {scalers} [382];
        $Awfif::memes-> {delayselcount} = $Awfif::mapped-> {scalers} [383];
        $Awfif::memes-> {delayamp} = $Awfif::mapped-> {scalers} [384];
        $Awfif::memes-> {tgnth} = $Awfif::mapped-> {scalers} [385];
        $Awfif::memes-> {doprsib} = $Awfif::mapped-> {scalers} [386];
        $Awfif::memes-> {chckadd} = $Awfif::mapped-> {scalers} [387];
        $Awfif::memes-> {checktransidnz}= $Awfif::mapped-> {scalers} [388];
        $Awfif::memes-> {checksubpidnz} = $Awfif::mapped-> {scalers} [389];
        $Awfif::memes-> {tral} = $Awfif::mapped-> {scalers} [390];
        $Awfif::memes-> {applycmin} = $Awfif::mapped-> {scalers} [391];
        $Awfif::memes-> {iapplycth} = $Awfif::mapped-> {scalers} [392];
        $Awfif::memes-> {applycth} = $Awfif::mapped-> {scalers} [393];
        $Awfif::memes-> {iapplyramp} = $Awfif::mapped-> {scalers} [394];
        $Awfif::memes-> {applyramp} = $Awfif::mapped-> {scalers} [395];
        $Awfif::memes-> {applycount} = $Awfif::mapped-> {scalers} [396];
        $Awfif::memes-> {applyactive} = $Awfif::mapped-> {scalers} [397];
        $Awfif::memes-> {applyspigdiv} = $Awfif::mapped-> {scalers} [398];
        $Awfif::memes-> {newdep} = $Awfif::mapped-> {scalers} [399];
        $Awfif::memes-> {bnotsalient} = $Awfif::mapped-> {scalers} [400];
        $Awfif::memes-> {bsalient} = $Awfif::mapped-> {scalers} [401];
        $Awfif::memes-> {submult} = $Awfif::mapped-> {scalers} [402];
        $Awfif::memes-> {submitted} = $Awfif::mapped-> {scalers} [403];
        $Awfif::memes-> {casetrmcws} = $Awfif::mapped-> {scalers} [404];
        $Awfif::memes-> {casetrmbcwso} = $Awfif::mapped-> {scalers} [405];
        $Awfif::memes-> {subptrachcount}= $Awfif::mapped-> {scalers} [406];
        $Awfif::memes-> {acaseoutputps} = $Awfif::mapped-> {scalers} [407];
        $Awfif::memes-> {subprefctr} = $Awfif::mapped-> {scalers} [408];
        $Awfif::memes-> {allowspigrabmax}= $Awfif::mapped-> {scalers} [409];
        $Awfif::memes-> {veccah} = $Awfif::mapped-> {scalers} [410];
        $Awfif::memes-> {veccab} = $Awfif::mapped-> {scalers} [411];
        $Awfif::memes-> {usewsodirect} = $Awfif::mapped-> {scalers} [412];
        $Awfif::memes-> {usewsobfdirect}= $Awfif::mapped-> {scalers} [413];

        $Awfif::cstruct-> {istringf} = $Awfif::mapped-> {scalers} [414];
        $Awfif::memes-> {codeletdef} = $Awfif::mapped-> {scalers} [415];
        $Awfif::memes-> {jhldesf} = $Awfif::mapped-> {scalers} [416];
        $Awfif::memes-> {attribdesf} = $Awfif::mapped-> {scalers} [417];
        $Awfif::memes-> {attribdesh} = $Awfif::mapped-> {scalers} [418];
        $Awfif::costatel-> {fclnk} = $Awfif::mapped-> {scalers} [419];
        $Awfif::costatel-> {h} = $Awfif::mapped-> {scalers} [420];
        $Awfif::costatel-> {t} = $Awfif::mapped-> {scalers} [421];
        $Awfif::costatel-> {f} = $Awfif::mapped-> {scalers} [422];
        $Awfif::costatel-> {flistl} = $Awfif::mapped-> {scalers} [423];
        $Awfif::costatel-> {tlistl} = $Awfif::mapped-> {scalers} [424];
        $Awfif::costatel-> {p} = $Awfif::mapped-> {scalers} [425];
        $Awfif::memes-> {allwsstr} = $Awfif::mapped-> {scalers} [426];
        $Awfif::memes-> {npconc} = $Awfif::mapped-> {scalers} [427];
        $Awfif::memes-> {maxpconcs} = $Awfif::mapped-> {scalers} [428];
        $Awfif::memes-> {smlscstate} = $Awfif::mapped-> {scalers} [429];
        $Awfif::memes-> {srfsmcstate} = $Awfif::mapped-> {scalers} [430];
        $Awfif::memes-> {trfsmcstate} = $Awfif::mapped-> {scalers} [431];
        $Awfif::memes-> {nfsmcstate} = $Awfif::mapped-> {scalers} [432];
        $Awfif::kwbracketd->{incb} = $Awfif::mapped-> {scalers} [433];
        $Awfif::kwbracketd->{incs} = $Awfif::mapped-> {scalers} [434];
        $Awfif::kwbracketd->{bmec} = $Awfif::mapped-> {scalers} [435];
        $Awfif::kwbracketd->{ibmec} = $Awfif::mapped-> {scalers} [436];
        $Awfif::kwbracketd->{smsc} = $Awfif::mapped-> {scalers} [437];
        $Awfif::kwjhl-> {jhlp} = $Awfif::mapped-> {scalers} [438];
        $Awfif::starttime-> {sec} = $Awfif::mapped-> {scalers} [439];
        $Awfif::starttime-> {min} = $Awfif::mapped-> {scalers} [440];
        $Awfif::starttime-> {hour} = $Awfif::mapped-> {scalers} [441];
        $Awfif::starttime-> {mday} = $Awfif::mapped-> {scalers} [442];
        $Awfif::starttime-> {mon} = $Awfif::mapped-> {scalers} [443];
        $Awfif::starttime-> {year} = $Awfif::mapped-> {scalers} [444];
        $Awfif::starttime-> {wday} = $Awfif::mapped-> {scalers} [445];
        $Awfif::starttime-> {yday} = $Awfif::mapped-> {scalers} [446];
        $Awfif::starttime-> {isdat} = $Awfif::mapped-> {scalers} [447];
        $Awfif::memes-> {fjhls8} = $Awfif::mapped-> {scalers} [448];
        $Awfif::memes-> {nwsi} = $Awfif::mapped-> {scalers} [449];

        &retrieveds ($myli, \$Awfif::memes-> {sactset}, $dirprefix . 'dcache/memes_sactset.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snnih}, $dirprefix . 'dcache/memes_snnih.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {l}, $dirprefix . 'dcache/codelet_l.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {t}, $dirprefix . 'dcache/codelet_t.dat');

        &retrieveds ($myli, \$Awfif::harray-> {tce}, $dirprefix . 'dcache/harray_tce.dat');

        &retrieveds ($myli, \$Awfif::mapped-> {scalers}, $dirprefix . 'dcache/mapped_scalers.dat');

        &retrieveds ($myli, \$Awfif::harray-> {tce}, $dirprefix . 'dcache/harray_tce.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {statement}, $dirprefix . 'dcache/wsbl_statement.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {sgmfile}, $dirprefix . 'dcache/wsbl_sgmfile.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {l}, $dirprefix . 'dcache/wsbl_l.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {winkwp}, $dirprefix . 'dcache/wsbl_winkwp.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {winkwpr}, $dirprefix . 'dcache/wsbl_winkwpr.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsactive}, $dirprefix . 'dcache/wsbl_wsactive.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsoh}, $dirprefix . 'dcache/wsbl_wsoh.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsot}, $dirprefix . 'dcache/wsbl_wsot.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsoto}, $dirprefix . 'dcache/wsbl_wsoto.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsft}, $dirprefix . 'dcache/wsbl_wsft.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsbloh}, $dirprefix . 'dcache/wsbl_wsbloh.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsblot}, $dirprefix . 'dcache/wsbl_wsblot.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsohih}, $dirprefix . 'dcache/wsbl_wsohih.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsas}, $dirprefix . 'dcache/wsbl_wsas.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsss}, $dirprefix . 'dcache/wsbl_wsss.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {newhead}, $dirprefix . 'dcache/wsbl_newhead.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {ofssum}, $dirprefix . 'dcache/wsbl_ofssum.dat');

        &retrieveds ($myli, \$Awfif::wsol-> {l}, $dirprefix . 'dcache/wsol_l.dat');

        &retrieveds ($myli, \$Awfif::wsol-> {ni}, $dirprefix . 'dcache/wsol_ni.dat');

        &retrieveds ($myli, \$Awfif::workspace-> {l}, $dirprefix . 'dcache/workspace_l.dat');

        &retrieveds ($myli, \$Awfif::wontgroupc-> {l}, $dirprefix . 'dcache/wontgroupc_l.dat');

        &retrieveds ($myli, \$Awfif::wontgroupc-> {i}, $dirprefix . 'dcache/wontgroupc_i.dat');

        &retrieveds ($myli, \$Awfif::bicl-> {l}, $dirprefix . 'dcache/bicl_l.dat');

        &retrieveds ($myli, \$Awfif::bicl-> {rec}, $dirprefix . 'dcache/bicl_rec.dat');

        &retrieveds ($myli, \$Awfif::norml-> {h}, $dirprefix . 'dcache/norml_h.dat');

        &retrieveds ($myli, \$Awfif::norml-> {t}, $dirprefix . 'dcache/norml_t.dat');

        &retrieveds ($myli, \$Awfif::norml-> {l}, $dirprefix . 'dcache/norml_l.dat');

        &retrieveds ($myli, \$Awfif::norml-> {min}, $dirprefix . 'dcache/norml_min.dat');

        &retrieveds ($myli, \$Awfif::norml-> {max}, $dirprefix . 'dcache/norml_max.dat');

        &retrieveds ($myli, \$Awfif::ifbhcl-> {l}, $dirprefix . 'dcache/ifbhcl_l.dat');

        &retrieveds ($myli, \$Awfif::ifbhcl-> {hc}, $dirprefix . 'dcache/ifbhcl_hc.dat');

        &retrieveds ($myli, \$Awfif::ilabhcl-> {l}, $dirprefix . 'dcache/ilabhcl_l.dat');

        &retrieveds ($myli, \$Awfif::ilabhcl-> {hc}, $dirprefix . 'dcache/ilabhcl_hc.dat');

        &retrieveds ($myli, \$Awfif::framel-> {l}, $dirprefix . 'dcache/framel_l.dat');

        &retrieveds ($myli, \$Awfif::subpl-> {l}, $dirprefix . 'dcache/subpl_l.dat');

        &retrieveds ($myli, \$Awfif::subpl-> {q}, $dirprefix . 'dcache/subpl_q.dat');

        &retrieveds ($myli, \$Awfif::subpl-> {w}, $dirprefix . 'dcache/subpl_w.dat');

        &retrieveds ($myli, \$Awfif::costatel-> {l}, $dirprefix . 'dcache/costatel_l.dat');

        &retrieveds ($myli, \$Awfif::costatel-> {hash}, $dirprefix . 'dcache/costatel_hash.dat');

        &retrieveds ($myli, \$Awfif::amoffl-> {l}, $dirprefix . 'dcache/amoffl_l.dat');

        &retrieveds ($myli, \$Awfif::poolcl-> {l}, $dirprefix . 'dcache/poolcl_l.dat');

        &retrieveds ($myli, \$Awfif::syncl-> {l}, $dirprefix . 'dcache/syncl_l.dat');

        &retrieveds ($myli, \$Awfif::synccodl-> {l}, $dirprefix . 'dcache/synccodl_l.dat');

        &retrieveds ($myli, \$Awfif::cswsol-> {l}, $dirprefix . 'dcache/cswsol_l.dat');

        &retrieveds ($myli, \$Awfif::subpscdefl-> {l}, $dirprefix . 'dcache/subpscdefl_l.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {l}, $dirprefix . 'dcache/veccol_l.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {head}, $dirprefix . 'dcache/veccol_head.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {index}, $dirprefix . 'dcache/veccol_index.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {strategy}, $dirprefix . 'dcache/veccol_strategy.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {ststate}, $dirprefix . 'dcache/veccol_ststate.dat');

        &retrieveds ($myli, \$Awfif::histonel-> {l}, $dirprefix . 'dcache/histonel_l.dat');

        &retrieveds ($myli, \$Awfif::hnamel-> {l}, $dirprefix . 'dcache/hnamel_l.dat');

        &retrieveds ($myli, \$Awfif::itswsall-> {l}, $dirprefix . 'dcache/itswsall_l.dat');

        &retrieveds ($myli, \$Awfif::inhibl-> {l}, $dirprefix . 'dcache/inhibl_l.dat');

        &retrieveds ($myli, \$Awfif::inhibl-> {clpa}, $dirprefix . 'dcache/inhibl_clpa.dat');

        &retrieveds ($myli, \$Awfif::trfl-> {l}, $dirprefix . 'dcache/trfl_l.dat');

        &retrieveds ($myli, \$Awfif::trfl-> {clpa}, $dirprefix . 'dcache/trfl_clpa.dat');

        &retrieveds ($myli, \$Awfif::tral-> {l}, $dirprefix . 'dcache/tral_l.dat');

        &retrieveds ($myli, \$Awfif::tral-> {i}, $dirprefix . 'dcache/tral_i.dat');

        &retrieveds ($myli, \$Awfif::tral-> {w}, $dirprefix . 'dcache/tral_w.dat');

        &retrieveds ($myli, \$Awfif::tral-> {wt}, $dirprefix . 'dcache/tral_wt.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameash}, $dirprefix . 'dcache/tral_sameash.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameast}, $dirprefix . 'dcache/tral_sameast.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameas}, $dirprefix . 'dcache/tral_sameas.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameasaadd}, $dirprefix . 'dcache/tral_sameasaadd.dat');

        &retrieveds ($myli, \$Awfif::tral-> {c}, $dirprefix . 'dcache/tral_c.dat');

        &retrieveds ($myli, \$Awfif::tral-> {r}, $dirprefix . 'dcache/tral_r.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {l}, $dirprefix . 'dcache/tmassl_l.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {r}, $dirprefix . 'dcache/tmassl_r.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {s}, $dirprefix . 'dcache/tmassl_s.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {wsoh}, $dirprefix . 'dcache/tmassl_wsoh.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {wsot}, $dirprefix . 'dcache/tmassl_wsot.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {first}, $dirprefix . 'dcache/tmassl_first.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {salience}, $dirprefix . 'dcache/tmassl_salience.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {submitted}, $dirprefix . 'dcache/tmassl_submitted.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {proc}, $dirprefix . 'dcache/tmassl_proc.dat');

        &retrieveds ($myli, \$Awfif::kwl-> {l}, $dirprefix . 'dcache/kwl_l.dat');

        &retrieveds ($myli, \$Awfif::kwl-> {i}, $dirprefix . 'dcache/kwl_i.dat');

        &retrieveds ($myli, \$Awfif::kwl-> {w}, $dirprefix . 'dcache/kwl_w.dat');

        &retrieveds ($myli, \$Awfif::mkwl-> {l}, $dirprefix . 'dcache/mkwl_l.dat');

        &retrieveds ($myli, \$Awfif::mkwl-> {i}, $dirprefix . 'dcache/mkwl_i.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {l}, $dirprefix . 'dcache/aspl_l.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {i}, $dirprefix . 'dcache/aspl_i.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {ws}, $dirprefix . 'dcache/aspl_ws.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {nws}, $dirprefix . 'dcache/aspl_nws.dat');
# clp is transient so no reason to store

        &retrieveds ($myli, \$Awfif::sametl-> {l}, $dirprefix . 'dcache/sametl_l.dat');

        &retrieveds ($myli, \$Awfif::memes-> {backoffactive}, $dirprefix . 'dcache/memes_backoffactive.dat');

        &retrieveds ($myli, \$Awfif::memes-> {backoffactives}, $dirprefix . 'dcache/memes_backoffactives.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breakcodelet}, $dirprefix . 'dcache/memes_breakcodelet.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breaksubp}, $dirprefix . 'dcache/memes_breaksubp.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breakthwso}, $dirprefix . 'dcache/memes_breakthwso.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breakthsubp}, $dirprefix . 'dcache/memes_breakthsubp.dat');

        &retrieveds ($myli, \$Awfif::memes-> {ldbuffer}, $dirprefix . 'dcache/memes_ldbuffer.dat');

        &retrieveds ($myli, \$Awfif::memes-> {jhip}, $dirprefix . 'dcache/memes_jhip.dat');

        &retrieveds ($myli, \$Awfif::memes-> {jhlabel}, $dirprefix . 'dcache/memes_jhlabel.dat');

        &retrieveds ($myli, \$Awfif::memes-> {jhlg}, $dirprefix . 'dcache/memes_jhlg.dat');

        &retrieveds ($myli, \$Awfif::memes-> {temp}, $dirprefix . 'dcache/memes_temp.dat');

        &retrieveds ($myli, \$Awfif::memes-> {time}, $dirprefix . 'dcache/memes_time.dat');

        &retrieveds ($myli, \$Awfif::memes-> {keywordh}, $dirprefix . 'dcache/memes_keywordh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {keywordl}, $dirprefix . 'dcache/memes_keywordl.dat');

        &retrieveds ($myli, \$Awfif::memes-> {keywordwsih}, $dirprefix . 'dcache/memes_keywordwsih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {mtsnlc}, $dirprefix . 'dcache/memes_mtsnlc.dat');

        &retrieveds ($myli, \$Awfif::memes-> {sactset}, $dirprefix . 'dcache/memes_sactset.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snnh}, $dirprefix . 'dcache/memes_snnh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snnih}, $dirprefix . 'dcache/memes_snnih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snw}, $dirprefix . 'dcache/memes_snw.dat');

        &retrieveds ($myli, \$Awfif::memes-> {wsm}, $dirprefix . 'dcache/memes_wsm.dat');

        &retrieveds ($myli, \$Awfif::memes-> {wslocality}, $dirprefix . 'dcache/memes_wslocality.dat');

        &retrieveds ($myli, \$Awfif::slipnet-> {l}, $dirprefix . 'dcache/slipnet_l.dat');

        &retrieveds ($myli, \$Awfif::slehist-> {l}, $dirprefix . 'dcache/slehist_l.dat');

        &retrieveds ($myli, \$Awfif::wsohist-> {l}, $dirprefix . 'dcache/wsohist_l.dat');

        &retrieveds ($myli, \$Awfif::jhls-> {l}, $dirprefix . 'dcache/jhls_l.dat');

        &retrieveds ($myli, \$Awfif::attribs-> {l}, $dirprefix . 'dcache/attribs_l.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {l}, $dirprefix . 'dcache/codelet_l.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {t}, $dirprefix . 'dcache/codelet_t.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {cseh}, $dirprefix . 'dcache/csehist_cseh.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {cseih}, $dirprefix . 'dcache/csehist_cseih.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {d}, $dirprefix . 'dcache/csehist_d.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {l}, $dirprefix . 'dcache/csehist_l.dat');

        &retrieveds ($myli, \$Awfif::cache-> {l}, $dirprefix . 'dcache/cache_l.dat');

        &retrieveds ($myli, \$Awfif::cache-> {h}, $dirprefix . 'dcache/cache_h.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {l}, $dirprefix . 'dcache/pcache_l.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {t}, $dirprefix . 'dcache/pcache_t.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {accessed}, $dirprefix . 'dcache/pcache_accessed.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {p}, $dirprefix . 'dcache/pcache_p.dat');

        &retrieveds ($myli, \$Awfif::clnk-> {l}, $dirprefix . 'dcache/clnk_l.dat');

        &retrieveds ($myli, \$Awfif::memes-> {crsmesubpspbreak}, $dirprefix . 'dcache/memes_crsmesubpspbreak.dat');

        &retrieveds ($myli, \$Awfif::memes-> {cruna}, $dirprefix . 'dcache/memes_cruna.dat');

        &retrieveds ($myli, \$Awfif::memes-> {activationchange}, $dirprefix . 'dcache/memes_activationchange.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breaksalwso}, $dirprefix . 'dcache/memes_breaksalwso.dat');

        &retrieveds ($myli, \$Awfif::memes-> {leavein}, $dirprefix . 'dcache/memes_leavein.dat');

        &retrieveds ($myli, \$Awfif::memes-> {ch}, $dirprefix . 'dcache/memes_ch.dat');

        &retrieveds ($myli, \$Awfif::memes-> {cseh}, $dirprefix . 'dcache/memes_cseh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {cseih}, $dirprefix . 'dcache/memes_cseih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {streh}, $dirprefix . 'dcache/memes_streh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {streih}, $dirprefix . 'dcache/memes_streih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {strbool}, $dirprefix . 'dcache/memes_strbool.dat');

        &retrieveds ($myli, \$Awfif::cussnl, $dirprefix . 'dcache/cussnl.dat');

        &retrieveds ($myli, \$Awfif::kwjhl-> {jhip}, $dirprefix . 'dcache/kwjhl_jhip.dat');

        &retrieveds ($myli, \$Awfif::kwjhl-> {jhlabel}, $dirprefix . 'dcache/kwjhl_jhlabel.dat');

        &retrieveds ($myli, \$Awfif::kwjhl-> {jhlg}, $dirprefix . 'dcache/kwjhl_jhlg.dat');

        &retrieveds ($myli, \$Awfif::memes-> {dcodeletc}, $dirprefix . 'dcache/memes_dcodeletc.dat');

        &retrieveds ($myli, \$Awfif::memes-> {ieowner}, $dirprefix . 'dcache/memes_ieowner.dat');

        &retrieveds ($myli, \$Awfif::memes-> {gdeltachange}, $dirprefix . 'dcache/memes_gdeltachange.dat');
# retrieveffilesvbtu02


        &retrieveds ($myli, \$Awfif::wfcdefl-> {operon}, $dirprefix . 'dcache/wfcdefl_operon.dat');
        $test = chdir("..");
        };#if
      }#if
    elsif ($test) {
      $test = chdir("..");
      };#if

    return $result
    }# retrievefromfiles
#
#<!-- start tag vbt -->
#
sub storevbtgmtofiles {
    my ($dirprefix) = @_;
    my ($result);
# store all key data sets to files for later resume
#

    print ("storevbtgmtofiles started\n");

    $result = &storecscmap ($dirprefix . 'c' . 'dcache/vbotga_scmap.dac');

    $result = &storecfitness ($dirprefix . 'c' . 'dcache/vbotga_fitness.dat');

    $result = &storecparent ($dirprefix . 'c' . 'dcache/vbotga_parent.dat', 'parent');

    $result = &storecparent ($dirprefix . 'c' . 'dcache/vbotga_parent2.dat', 'parent2');

    print ("storevbtgmtofiles completed\n");
    return $result
    }# storevbtgmtofiles
#
sub retrievevbtgmfromfiles {
    my ($dirprefix) = @_;
    my ($result);
# retrieve all vbotga data sets from files
#

    $result = '';
    print ("retrievevbtgmfromfiles started\n");
    &retrievecscmap ($dirprefix . 'c' . 'dcache/vbotga_scmap.da');
    if ((defined ($Awfif::vbotga-> {scmap0} [0] [0])) ){

      $result = 't';
      &retrievecfitness ($dirprefix . 'c' . 'dcache/vbotga_fitness.dat');
      &retrievecparent ($dirprefix . 'c' . 'dcache/vbotga_parent.dat', 'parent');
      &retrievecparent ($dirprefix . 'c' . 'dcache/vbotga_parent2.dat', 'parent2');
      };#if
    print ("retrievevbtgmfromfiles completed\n");

    return $result
    }# retrievevbtgmfromfiles
#
sub storecscmap {
    my ($filestring) = @_;
# store scmap data set to comma seperated files for later resume
#
    my ($result, $i1, $i2, $i3, $i4);
    my (@file, %ssymbh);

    $result = '';
    print ("storecscmap entered\n");
# setup the output file

    $ssymbh {vbttoamnbuilder} = 'n';
    $ssymbh {vbttoamsbuilder} = 's';
    $ssymbh {vbttoamebuilder} = 'e';
    $ssymbh {vbttoamwbuilder} = 'w';
    $ssymbh {vbttoamrbuilder} = 'r';
    $ssymbh {vbttoapcbuilder} = 'c';
    $i3 = $Awfif::vbotga-> {gen};#new generation
    $i4 = 0; #output record counter
    $i1 = 0;#pop zero only exists in the 0 gen

    if ($Awfif::vbotga-> {gen} <= 0){
      $file [$i4] = '' . $i3;#generation number recorded at start of each of its records
      $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmap0} [$i1] [0];#count of items
      for ($i2 = 1; $i2 < $Awfif::vbotga-> {scmap0} [$i1] [0]; $i2++){

        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmap0} [$i1] [$i2];
        };#for
      $i1++;
      $i4++;
      while ( defined($Awfif::vbotga-> {scmap0} [1] [0]) ){# zero record is special

        while ( defined($Awfif::vbotga-> {scmap0} [$i1] [0]) ){

          $file [$i4] = '' . $i3;#generation number recorded at start of each of its records
          $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmap0} [$i1] [0];#count of items
          for ($i2 = 1; $i2 < $Awfif::vbotga-> {scmap0} [$i1] [0]; $i2++){

            $file [$i4] = $file [$i4] . ',' . $ssymbh {$Awfif::vbotga-> {scmap0} [$i1] [$i2]};
            };#for

          $file [$i4] = $file [$i4] . ";\n";#newline
          $i1++;
          $i4++;
          };#while

        $i3++;
        $i1 = 1;
        };#while
      }# gen 0
    else {

      $i1++;#vbot

      while ( defined($Awfif::vbotga-> {scmapn} [$i1] [0]) ){

        $file [$i4] = '' . $i3;#generation number recorded at start of each of its records
        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmapn} [$i1] [0];#count of items
        for ($i2 = 1; $i2 < $Awfif::vbotga-> {scmapn} [$i1] [0]; $i2++){

          $file [$i4] = $file [$i4] . ',' . $ssymbh {$Awfif::vbotga-> {scmapn} [$i1] [$i2]};
          };#for

        $file [$i4] = $file [$i4] . ";\n";#newline
        $i1++;
        $i4++;
        };#while

      $i3++;
      $i1 = 1;
      };#else

    open (FILE, ">>$filestring");#append
    if (-e FILE) {

# storecscmapapu1
      $result = 't';
      print ("storecscmap started\n");
      print FILE "@file";
      close (FILE);
      print ("storecscmap completed\n");
      } #got a file to output to
    else {

      print ("storecscmap failed\n");
      };

    return $result
    }# storecscmap
#
sub retrievecscmap {
    my ($ifilestring) = @_;
    my ($result, $records, $buffer, $filestring, $usedat, $othergen, $bgen, $gen, $bcount, $jhlsid, $i, $i2, $zerodone, $dset, $bname);
    my (@file, %ssymbh);
# retrieve vbotga scmap data sets from comma seperated files
#

    $result = '';
    print ("retrievecscmap started\n");
# get the records from the file

    @file = ();
    $records = 0;#no records yet
    $zerodone = '';#first data set is special
    $dset = 0;
    $gen = 0;
    $filestring = $ifilestring . 'c';#first see if there is a compressed .dac file

    &includesource (
      $filestring,
      \@file,
      \$records
      );
    if ($records <= 0) {

      $filestring = $ifilestring . 't';#if not see if there is a regular .dat file
      &includesource (
        $filestring,
        \@file,
        \$records
        );
      $usedat = 't';
      }#if
    else {#decompress the data

      $ssymbh {n} = 'vbttoamnbuilder';
      $ssymbh {s} = 'vbttoamsbuilder';
      $ssymbh {e} = 'vbttoamebuilder';
      $ssymbh {w} = 'vbttoamwbuilder';
      $ssymbh {r} = 'vbttoamrbuilder';
      $ssymbh {c} = 'vbttoapcbuilder';
      };#else
# load each record into the scmap structure

    $result = 't';
    $othergen = '';
    foreach $buffer (@file) {
# process the generation number

      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;
      if ($bgen != $gen){

        $dset = 0;
        $gen = $bgen;
        last;# break out of the loop
        };#other generations
# process generation zero

      do {#for each dataset in the buffer

        if (!$zerodone){

          $zerodone = 't';
# get the count
          $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
          $bcount = $2;
          $buffer =~ s/$1$2$3$4//;
# on initial record load count in item 0
          $Awfif::vbotga-> {scmap0} [0] [0] = $bcount;
# get each item and load into scmap
          for ($i = 1; $i <= $bcount; $i++) {

            $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
            $jhlsid = $2;
            $buffer =~ s/$1$2$3$4//;
            $Awfif::vbotga-> {scmap0} [0] [$i] = $jhlsid;
            };
          }#if 0 data set
# process other generations
        else {
# get the count

          $dset++;
          $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
          $bcount = $2;
          $buffer =~ s/$1$2$3$4//;
# on initial record load count in item 0
          if ($bgen == 0) {

            $Awfif::vbotga-> {scmap0} [$dset] [0] = $bcount;
            }#if
          else {

            $Awfif::vbotga-> {scmapc} [$dset] [0] = $bcount;
            };#else
# get each item and load into scmap
          for ($i = 1; $i <= $bcount; $i++) {

            $buffer =~ /(\W*)? (\w*) (^,)* (,)?/x;
            if (!$usedat){

              $bname = $ssymbh {$2};
              }#if
            else {#original uncompressed file format

              $bname = $2;
              };#else
            $buffer =~ s/$1$2$3$4//;
            if ($bgen == 0) {

              $Awfif::vbotga-> {scmap0} [$dset] [$i] = $bname;
              }#if
            else {

              $Awfif::vbotga-> {scmapc} [$dset] [$i] = $bname;
              };#else
            };
          };#else other generations

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $bcount = $2;
        } while ($bcount > 0);#may be more than one data set in the record
      };#for each
# walk back from the last record in the file finding the first record of the last generation. Then load all of that generation into scmapc

    my ($start, $end);
    $end = $#file;
    $start = 0;
    $buffer = $file [$end];
    $buffer =~ /(\d*) (^,)* (,)/x;
    $gen = $1;

    for ($i = $end; ($i > 0 & $start == 0);$i--){
      $buffer = $file [$i];
      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      if ($bgen != $gen){

        $start = $i + 1;
        };#other generations
      };# finished walk back

    $Awfif::vbotga-> {gen} = $gen;
# load the last generation found

    for ($i2 = $start; $i2 <= $end; $i2++) {
# process the generation number

      $buffer = $file [$i2];
      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;

      do {#for each dataset in the buffer
# process other generations
# get the count

        $dset++;
        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $bcount = $2;
        $buffer =~ s/$1$2$3$4//;
# on initial record load count in item 0
        $Awfif::vbotga-> {scmapc} [$dset] [0] = $bcount;
# get each item and load into scmap
        for ($i = 1; $i <= $bcount; $i++) {

          $buffer =~ /(\W*)? (\w*) (^,)* (,)?/x;
          if (!$usedat){

            $bname = $ssymbh {$2};
            }#if
          else {#original uncompressed file format

            $bname = $2;
            };#else
          $buffer =~ s/$1$2$3$4//;
          $Awfif::vbotga-> {scmapc} [$dset] [$i] = $bname;
          };

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $bcount = $2;
        } while ($bcount > 0);#may be more than one data set in the record
      };#for

    @file = ();#free up this large file
    print ("retrievecscmap completed\n");

    return $result
    }# retrievecscmap
#
sub storecfitness {
    my ($filestring) = @_;
# store fitness data set to comma seperated files for later resume
#
    my ($result, $vbot, $gen, $i4);
    my (@file);

    $result = '';
    print ("storecfitness entered\n");
# setup the output file

    $gen = 0;#generation
    $i4 = 0; #output record counter
    while ( defined($Awfif::vbotga-> {fitness} [$gen] [1]) ){#

      $file [$i4] = '' . $gen;#generation number recorded at start of each of its records
      for ($vbot = 1; $vbot <= $Awfif::memes-> {vbottpopmax}; $vbot++){

        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {fitness} [$gen] [$vbot];
        };#for

      $file [$i4] = $file [$i4] . ";\n";#newline
      $i4++;
      $gen++;
      };#while

    open (FILE, ">$filestring");
    if (-e FILE) {

      $result = 't';
      print ("storecfitness started\n");
      print FILE "@file";
      close (FILE);
      print ("storecfitness completed\n");
      } #got a file to output to
    else {

      print ("storecfitness failed\n");
      };

    return $result
    }# storecfitness
#
sub retrievecfitness {
    my ($filestring) = @_;
    my ($result, $records, $buffer, $bgen, $gen, $fitness, $vbot, $neg);
    my (@file);
# retrieve vbotga fitness data sets from comma seperated files
#

    $result = '';
    print ("retrievecfitness started\n");
# get the records from the file

    @file = ();
    $records = 0;#no records yet
    $gen = 0;
    &includesource (
      $filestring,
      \@file,
      \$records
      );
# load each record into the fitness structure

    $result = 't';
    foreach $buffer (@file) {
# process the generation number

      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;

# get each item and load into fitness
      for ($vbot = 1; $vbot <= $Awfif::memes-> {vbottpopmax}; $vbot++) {

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $fitness = $2;
        $neg = $1;
        if ((defined ($neg)) && ($neg eq '-') ){

          $fitness = -1 * $fitness;
          };#if
        $buffer =~ s/$1$2$3$4//;
        $Awfif::vbotga-> {fitness} [$bgen] [$vbot] = $fitness;
        };#for each vbot

      }; #for each record

    print ("retrievecfitness completed\n");

    return $result
    }# retrievecfitness
#
sub storecparent {
    my ($filestring, $parent) = @_;
# store fitness data set to comma seperated files for later resume
# $parent should be parent or parent2
    my ($result, $i1, $gen, $i4);
    my (@file);

    $result = '';
    print ("storecparent $parent entered\n");
# setup the output file

    $gen = 0;#generation
    $i4 = 0; #output record counter
# @p should be $Awfif::vbotga-> {parent[2]}
    while ( defined($Awfif::vbotga-> {$parent} [$gen] [1]) ){#

      $file [$i4] = '' . $gen;#generation number recorded at start of each of its records
      for ($i1 = 0; $i1 <= $Awfif::vbotga-> {$parent} [$gen] [0]; $i1++){

        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {$parent} [$gen] [$i1];
        };#for

      $file [$i4] = $file [$i4] . ";\n";#newline
      $i4++;
      $gen++;
      };#while

    open (FILE, ">$filestring");
    if (-e FILE) {

      $result = 't';
      print ("storecparent started\n");
      print FILE "@file";
      close (FILE);
      print ("storecparent completed\n");
      } #got a file to output to
    else {

      print ("storecparent failed\n");
      };

    return $result
    }# storecparent
#
sub retrievecparent {
    my ($filestring, $parent) = @_;
    my ($result, $records, $buffer, $bgen, $gen, $parentid, $i4, $neg);
    my (@file);
# retrieve vbotga parent data sets from comma seperated files
#

    $result = '';
    print ("retrievecparent $parent started\n");
# get the records from the file

    @file = ();
    $records = 0;#no records yet
    $gen = 0;
    &includesource (
      $filestring,
      \@file,
      \$records
      );
# load each record into the parent structure

    $result = 't';
    foreach $buffer (@file) {
# process the generation number

      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;

# get each item and load into parent
      $i4 = 0;
      do {

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $parentid = $2;
        $neg = $1;
        if ((defined ($neg)) && ($neg eq '-') ){

          $parentid = -1 * $parentid;
          };#if
        $buffer =~ s/$1$2$3$4//;
        $Awfif::vbotga-> {$parent} [$bgen] [$i4] = $parentid;
        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $parentid = $2;
        $i4++;
        } while ($parentid > 0);#may be more than one data set in the record

      $i4 = 0;
      }; #for each record

    print ("retrievecparent $parent completed\n");

    return $result
    }# retrievecparent
#
#<!-- start tag aso -->
#<!-- start tag inh -->
#<!-- start tag phe -->
#
sub waitondesc {
    my ($myli, $awso, $desc2, $desc3, $desc4, $iprocname, $kwp, $kwpr, $sactset, $codeletdef, $actref) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($trace, $nlinki);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a description event
# submitcodelet the caller, into a deferred codelet queue,
# waitondesciqu1

    &queinhordef ($myli, $iprocname, $kwp, $kwpr, \@$sactset, \$$codeletdef);

    if ((defined ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}])) && ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] > 0)) {
      my ($linki, $found);
      $found = '';
      $linki = $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}];
      while ((!$found) && ($linki != 0)) {
        if (($Awfif::syncl-> {l} [$linki] [2] == $desc2)
        && ($Awfif::syncl-> {l} [$linki] [3] == $desc3)
        && ($Awfif::syncl-> {l} [$linki] [4] == $desc4)
        ){
          $found = 't';
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

          $Awfif::syncl-> {l} [$linki] [5] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::syncl-> {l} [$linki] [5], \$Awfif::syncl-> {l} [$linki] [6]));
          if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = $$codeletdef;
            if (defined ($actref)){

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [3] = $actref;
              };#if
            }#if
          elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

            if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2])) {

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = 0;
              };#if
            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2]));
            if (defined ($actref)){

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [3] = $actref;
              };#if
            };#else
          };
        $linki = $Awfif::syncl-> {l} [$linki] [0];
        };#while
      if (!$found) {#new descriptor list to be setup

        $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = addli (\$Awfif::syncl, \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}], \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}]);
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [2] = $desc2;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [3] = $desc3;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [4] = $desc4;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = 0; #Each descriptor should have its own list of codelets with a unique head
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6] = 0; #Each descriptor should have its own list of codelets with a unique tail
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5], \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6]));
        if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = $$codeletdef;
          if (defined ($actref)){

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
            };#if
          }#if
        elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

          if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2])) {

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = 0;
            };#if
          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2]));
          if (defined ($actref)){

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
            };#if
          };#else
        };#if
      }#if
    else {

      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = 0;
      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}] = 0;
      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = addli (\$Awfif::syncl, \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}], \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}]);
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [2] = $desc2;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [3] = $desc3;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [4] = $desc4;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = 0; #Each descriptor should have its own list of codelets with a unique head
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6] = 0; #Each descriptor should have its own list of codelets with a unique tail
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = ($nlinki = addli ( \$Awfif::synccodl, \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5], \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6]));
      if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2])) {

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = 0;
        };#if
      if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = $$codeletdef;
        if (defined ($actref)){

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
          };#if
        }#if
      elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2]));
        if (defined ($actref)){

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
          };#if
        };#else
      };#else
    if ( ( ($$codeletdef > 0)
    && ($Awfif::codelet-> {t} [$$codeletdef] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$$codeletdef] [2])) )
    ){

      break ();
      }#if

    $Awfif::memes-> {trace} = $trace;
    return ($nlinki)
    }# waitondesc
#
#<!-- end tag vbt -->
#
sub waitonstrancomp {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#
    my ($trace, $nlinki, $stran, $subp11i, $cdef);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a sub transaction complete event
# submitcodelet the caller, into a deferred codelet queue,

    &queinhordef ($myli, undef(), $kwp, $kwpr, \@$sactset, \$cdef);
    if (($cdef != 0) && ($cdef == $Awfif::memes-> {codeletdef})) {#the submitted codelet has not been moved to its own queue yet

# find the sub transaction - its the tral entry referred in the subpl [11] set that has the requester referenced in the tral->{i} data structure
      $subp11i = findsubpicnm ($myli, $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [2]);
      $stran = $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli][36]] [11] [$subp11i];
# waitonstrancomh
# and get the head entry at the required tral identifying a synchronization list.
# its in the 0 item of the $Awfif::tral-> {w} if its present

      if ( (defined ($Awfif::tral-> {w} [$stran] [0]))
      && ($Awfif::tral-> {w} [$stran] [0] > 0)
      ){#already got a sync head setup
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::tral-> {w} [$stran] [0] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::tral-> {w} [$stran] [0], \$Awfif::tral-> {wt} [$stran] [0]));
        $Awfif::synccodl-> {l} [$nlinki] [2] = mdefhcodelettolist ($Awfif::synccodl-> {l} [$nlinki] [2]);
        }#if
      else {#setup a new sync head for the request

# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::tral-> {w} [$stran] [0] = 0;
        $Awfif::tral-> {wt} [$stran] [0] = 0;
        $Awfif::tral-> {w} [$stran] [0] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::tral-> {w} [$stran] [0], \$Awfif::tral-> {wt} [$stran] [0]));
        $Awfif::synccodl-> {l} [$nlinki] [2] = mdefhcodelettolist (0);
        };#else
      };#if

    $Awfif::memes-> {trace} = $trace;
    return ($nlinki)
    }# waitonstrancomp
#
#<!-- end tag ds -->
#<!-- start tag vbt -->
#
sub queinhordef {
    my ($myli, $iprocname, $kwp, $kwpr, $sactset, $codeletdef) = @_;#
    my ($trace, $procname, $submiticodelet);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a sub transaction complete event
# submitcodelet the caller, into a deferred codelet queue,

    $submiticodelet = '';
    $Awfif::clp = ();
    if ((defined ($iprocname)) ) {

      $submiticodelet = 't';
      }#if
    $procname = setupprocname ($myli, $iprocname);
    $$codeletdef = $Awfif::memes-> {codeletdef};
    if ($submiticodelet) {
# this codelet is going in the deferred queue. It is not active but won't age out until moved back to the active queue

      &loadclp ($myli, \$Awfif::clp, \@{$Awfif::inhibl-> {clpa}}, $Awfif::codelet-> {l} [$myli] [24]);
      $Awfif::clp-> {inhib}-> {ilinkp} = $Awfif::codelet-> {l} [$myli] [24];
      $Awfif::clp-> {urgency} = ($Awfif::clp-> {urgency} * $Awfif::memes-> {ilaunchm});
      $Awfif::clp-> {strategy} = $procname;
      &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $procname, $kwp, $kwpr, $sactset, 't');
# when the codelet is made active it won't age out and will be raised in priority until it runs
      if ($$codeletdef != $Awfif::memes-> {codeletdef}) {

        if (!defined ($Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3])) {

          $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3] = 0;
          };#if
        $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3] = ($$codeletdef = mdefhcodelettolist ($Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3]));
        $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [4] = $procname;
        }#if
      else {

        $$codeletdef = 0;
        };#else
      }#if
    else {

      $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
      $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$myli][3];
      $Awfif::clp-> {strategy} = $procname;
      $Awfif::clp-> {action}-> {sponsor} = $Awfif::codelet-> {l} [$myli][17];
      $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$myli][16];
      $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$myli][18];
      $Awfif::clp-> {action}-> {ref} = $Awfif::codelet-> {l} [$myli][4];
      $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$myli] [20];
      $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l} [$myli][21];
      $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$myli][22];
      &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $procname, $kwp, $kwpr, $sactset, 't');
      if ($$codeletdef != $Awfif::memes-> {codeletdef}) {

        $$codeletdef = $Awfif::memes-> {codeletdef};
        }#if
      else {

        $$codeletdef = 0;
        };#else
      };#else
    if ( ( ($$codeletdef > 0)
    && ($Awfif::codelet-> {t} [$$codeletdef] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$$codeletdef] [2])) )
    or ( ($Awfif::memes-> {codeletdef} > 0)
    && ($Awfif::codelet-> {t} [$Awfif::memes-> {codeletdef}] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletdef}] [2])) )
    ){

      break ();
      }#if

    $Awfif::memes-> {trace} = $trace;
    }# queinhordef
#
#<!-- end tag vbt -->
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#
sub notwaitonelkd {
    my ($myli, $sponsor, $grkwp, $grkwpr, $sactset) = @_;# start index into synccodl list of codelets all waiting on this event
    my ($dontwait, $cwsbi, $atelhwso, $asponsor, $stwso, $astwso);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notwaitonelkd sponsor($sponsor) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $dontwait = 't';
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $atelhwso = awsoadr (trwsoadr ($sponsor,-1));
    $asponsor = awsoadr ($sponsor);
# Find the statement wso and obtain the statement's wso type
    $stwso = igetmynowner ($myli, $sponsor, 'bustatement', $grkwp, $grkwpr);
    $astwso = awsoadr ($stwso);

    my ($bcount, $cws, $bcwso, $abcwso, $sldesc, $reportdesc, $areportwso, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $bcount = ifindb ($myli, $stwso, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $grkwp, $grkwpr, \@$sactset);
    $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
    $Awfif::memes-> {currentwsbi} = $cws;
    $abcwso = awsoadr ($bcwso);
# find the transcription factor binding
    if ($bcount == 1) {

      if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
      && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
      ){

        $Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi});
        $areportwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi}));
# if end list kw has not reached end of list then if not issued waitondesc do so
        if ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) == 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] == 0)
        ){#wait

          my ($bcindex);
          &waitondesc ($myli, $areportwso, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi}), $Awfif::memes-> {snnh} {found}, $Awfif::memes-> {snnh} {model}, undef(), undef(), undef(), undef(), \$Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]);
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [35] = $Awfif::codelet-> {l} [$myli] [35];
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [36] = $Awfif::codelet-> {l} [$myli] [36];
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [37] = $Awfif::codelet-> {l} [$myli] [37];
          $Awfif::subpl-> {q} [2] [0]++;#stops amplifier inhibition while positive
          $dontwait = '';
# notwaitbcu1
          $bcindex = matchbreakcodelet ($myli);
          if (($bcindex > 0) #handle break codelet
          && (matchbreakcodelet ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]) == 0) #not already in list
          ){

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]];
            }#if
          elsif ($bcindex > 0){#just remove the myli reference from the break datastructure

            &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
            if ($Awfif::codelet-> {l} [$myli] [36] > 0){#remove subprogram reference

              &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
              };#if
            };#elsif
          }#if
        elsif ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) == 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] != 0)
        ){#wait

          $dontwait = '';
          my ($bcindex);
          $bcindex = matchbreakcodelet ($myli);
          if (($bcindex > 0) #handle break codelet
          && (matchbreakcodelet ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]) == 0) #not already in list
          ){

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]];
            }#if
          elsif ($bcindex > 0){#just remove the myli reference from the break datastructure

            &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
            if ($Awfif::codelet-> {l} [$myli] [36] > 0){#remove subprogram reference

              &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
              };#if
            };#elsif
          }#elsif
        elsif ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) != 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] != 0)
        ){#wait

          $Awfif::subpl-> {q} [2] [$Awfif::codelet-> {l} [$myli] [36] ] = undef ();
          $Awfif::subpl-> {q} [2] [0]--;
          };#elsif
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notwaitonelkdx ret($dontwait) ");
      };
    return $dontwait;
    }# notwaitonelkd
#
#<!-- end tag ds -->
#<!-- end tag sia -->
#<!-- start tag vbt -->
#
sub ilwaiting {
    my ($ilinki, $set34, $head, $tail) = @_;# start index into synccodl list of codelets all waiting on this event
    my ($plinki,$linki);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ilwaiting ilinki($ilinki) ");
      };
    $linki = $ilinki;#modifiable local copy
    while ($linki != 0) {
# move the codelet to the active queue

      my ($linkp, $oh, $olp0, $olp1);
      $linkp = $Awfif::synccodl-> {l} [$linki][2];#the codelet id
# ilwaitactu1
      if (($Awfif::wfcdefl-> {hash} {$linkp} > 0)
      && (defined ($Awfif::synccodl-> {l} [$linki][3]))
      ){

        ${$Awfif::synccodl-> {l} [$linki][3]} = 't';
        };#if
      $oh = $Awfif::memes-> {codeleth};
      if ($oh != 0) {

        $Awfif::codelet-> {l} [$oh] [1] = $linkp;
        };#if
      $olp0 = $Awfif::codelet-> {l} [$linkp] [0];
      $olp1 = $Awfif::codelet-> {l} [$linkp] [1];
      $Awfif::codelet-> {l} [$linkp] [0] = $oh;
      $Awfif::codelet-> {l} [$linkp] [1] = 0;
      if ($Awfif::codelet-> {t} [$linkp] != $Awfif::memes-> {snnh} {active} ){

        $Awfif::codelet-> {t} [$linkp] = $Awfif::memes-> {snnh} {active};
        $Awfif::memes-> {acodelets} ++;
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        };#if
      if ($set34) {

        $Awfif::codelet-> {l} [$linkp] [34] = 1;
        };
      $Awfif::memes-> {codeleth} = $linkp;
      if (($Awfif::memes-> {codeletdef} == $linkp)) {

        if ($olp0 != 0) {

          $Awfif::codelet-> {l} [$olp0] [1] = 0;
          };#if
        $Awfif::memes-> {codeletdef} = $olp0;
        }#if
      else {

        if ($olp0 != 0) {

          $Awfif::codelet-> {l} [$olp0] [1] = $olp1;
          };#if
        if ($olp1 != 0) {

          $Awfif::codelet-> {l} [$olp1] [0] = $olp0;
          };#if
        }# else
# report if new active head is circular

      if (($Awfif::codelet-> {l} [$linkp] [0] == $Awfif::codelet-> {l} [$linkp] [1]) && ($linkp != $Awfif::memes-> {codelett})) { &break ();};
# and delete the synccodl entry

      $plinki = $linki;
      $linki = $Awfif::synccodl-> {l} [$linki] [0];
      &freeli ($plinki, \$Awfif::synccodl, \$$head, \$$tail);
      $Awfif::synccodl-> {l} [$plinki] [2] = 0;#remove the codelet index
      $Awfif::synccodl-> {l} [$plinki] [3] = ();#remove the activated pointer if set
      };#while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ilwaitingx ret($linki) ");
      };
    return $linki;
    }# ilwaiting
#
#<!-- end tag vbt -->
#<!-- end tag phe -->
#
sub setupprocname {
    my ($myli, $iprocname) = @_;#
    my ($trace, $procname);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;

    if ((defined ($iprocname)) ) {

      $procname = $iprocname;
      }#if
    elsif ((defined ($Awfif::codelet-> {l} [$myli] [27]) )
    && ($Awfif::codelet-> {l} [$myli] [27] =~ /evaluator/i)
    ){

      $procname = $Awfif::codelet-> {l} [$myli] [27];
      }#elsif
    else {

      $procname = $Awfif::codelet-> {l} [$myli] [2];
      };

    $Awfif::memes-> {trace} = $trace;
    return $procname
    }# setupprocname
#
sub setupbuildername {
    my ($procname) = @_;#
    my ($trace, $buildername, $f1);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;

    if ($procname =~ /^(.+)*evaluator/i) {
      $f1 = $1;
      if ($f1 ne '') {

        $buildername = $f1 . 'builder';
        }#if
      else {

        $buildername = $procname;
        };#else
      }#if
    else {

        $buildername = $procname;
      };#else

    $Awfif::memes-> {trace} = $trace;
    return $buildername
    }# setupbuildername
#
#<!-- end tag inh -->
#<!-- end tag aso -->
#
sub freedesc {

    my ($desc) = @_;
# move the buffer list structure to the inactive list
    my ($plink, $a0, $a1);
#
# checked for merged workspaces

    $plink = freehli ($desc, \$Awfif::workspace);#descriptors are in a list whose head is wso [2]
    $a0 = $Awfif::workspace-> {l} [$desc] [0];
    $a1 = $Awfif::workspace-> {l} [$desc] [1];
    $Awfif::workspace-> {l} [$desc] = ();
    $Awfif::workspace-> {l} [$desc] [0] = $a0;
    $Awfif::workspace-> {l} [$desc] [1] = $a1;
    return $plink;
    }# freedesc
#
#<!-- start tag ds -resweb -->
#<!-- start tag vbt -->
#<!-- start tag phe -->
#
sub inccounter {
    my ($pltype, $pto, $from, $dlinkh, $awso, $synccod, $sltype, $spto, $transmgrid, $atelhwso, $active, $rcounteri) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($ltype, $to, $ndlinkh, $mcounteri, $counteri, $mp, $nmp, $subpid, $mask, $val);

    if (!defined ($pltype)) {

      $ltype = $Awfif::memes-> {snnh} {iterator};
      }# if
    else {

      $ltype = $pltype;
      };
    if (!defined ($pto)) {

      $to = ($Awfif::memes-> {snnh} {wsi} + 1);
      }# if
    else {

      $to = $pto;
      };
    if ((defined ($transmgrid)) && (defined ($atelhwso)) && (defined ($active))) {

      $subpid = maptmgrtosubpid ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid);
      };# if
    if ((!($mp = findcounter ($Awfif::wsol-> {l} [$awso][2], ($from+1), \$mcounteri, ($spto), $sltype)))# using the param form of to and type to leverage the define state
    && (!($nmp = findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri, ($spto), $sltype)))
    ){#no counter so create a new one

      $ndlinkh
        = setupdesc (
          $ltype,
          $to,
          $from,
          $dlinkh,
          $awso,
          $synccod);
      $Awfif::workspace-> {l} [$ndlinkh] [8] = $Awfif::memes-> {snnh} {iterator};
      $Awfif::workspace-> {l} [$ndlinkh] [9] = ($Awfif::memes-> {snnh} {wsi} + 1);
      if (defined ($transmgrid)) {

        $Awfif::workspace-> {l} [$ndlinkh] [11] = ($transmgrid * $active);
        &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$ndlinkh] [9]);
        };#if
      if (defined ($$rcounteri)){

        $$rcounteri = $ndlinkh;
        };#if
      }#if
    elsif (($mp) #if $mp is true it means was a masked item so update here if its false then there was a non-masked item handle in next clause
    ){#currently masked

      if ((!defined ($transmgrid)) or (!defined ($subpid))) {

        $Awfif::workspace->{l} [$mcounteri][4]--;
        }#if
      else {

        if (!defined ($Awfif::workspace-> {l} [$mcounteri] [11])) {

          $Awfif::workspace-> {l} [$mcounteri] [11] = ($transmgrid * $active);
          &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$mcounteri] [9]);
          }#if
        else {

          $mask = -1;
          $val = -1;
          &gettmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, \$mask, \$val);#gettmgrdesc has an odd interface true means the value in trans mgr exists and is unmasked.
          if ($mask >= 0) {
# found values so deploy them and then update them removing any mask

            $Awfif::workspace-> {l} [$mcounteri] [9] = $val;
            if ($mask == 0) {#inc the val since was not masked in trans storage

              $Awfif::workspace-> {l} [$mcounteri] [9]++;
              };#if
            &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$mcounteri] [9]);
            };#if
          };#else
        $Awfif::workspace->{l} [$mcounteri][4]--;
        };#else
# inccountsusu1
      &isetupsync ($ltype, $to, $from, $awso, $synccod);
      $ndlinkh = $dlinkh;
      if (defined ($$rcounteri)){

        $$rcounteri = $mcounteri;
        };#if
      }# elsif
    else {# found active descriptor increment counter

      if ((!defined ($transmgrid)) or (!defined ($subpid))) {#if this isnt backed up by tmass data then just increment

        $Awfif::workspace->{l} [$counteri][9]++;
        }#if
      else {#need to see if there is tmass data for this transaction manager id

        if ((!defined ($Awfif::workspace-> {l} [$counteri] [11])) # transaction binding never setup so do it now
        ){

          $Awfif::workspace-> {l} [$counteri] [11] = ($transmgrid * $active);
          &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$counteri] [9]);
          }#if
        else {#these are transaction managed but must ensure that this transaction manager record is setup

          $mask = -1;
          $val = -1;
          &gettmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, \$mask, \$val);
          if ($mask >= 0) {
# found values so deploy them and then update them removing any mask

            $Awfif::workspace-> {l} [$counteri] [9] = $val;
            &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$counteri] [9]);
            }#if
          else {#this manager transaction has not been setup so add it

            &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, 0);
            $Awfif::workspace-> {l} [$counteri] [11] = ($transmgrid * $active);
            $Awfif::workspace->{l} [$counteri][9] = ($Awfif::memes-> {snnh} {wsi} + 0);
            };#else
          $Awfif::workspace->{l} [$counteri][9]++;
          };#else
        };#else
# inccountsusu2
      &isetupsync ($ltype, $to, $from, $awso, $synccod);
      $ndlinkh = $dlinkh;
      if ((defined ($transmgrid)) && (defined ($subpid)) && ($Awfif::workspace->{l} [$counteri][11] != 0)) {

        &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, undef (), $Awfif::workspace->{l} [$counteri][9]);
        };#if
      if (defined ($$rcounteri)){

        $$rcounteri = $counteri;
        };#if
      };#else
    if ((!defined ($ndlinkh)) or ($ndlinkh == 0)) {&break()};
    if ((defined ($$rcounteri)) && ($$rcounteri == 0)) {&break()};
    return $ndlinkh
    }# inccounter
#
#<!-- end tag phe -->
#<!-- end tag vbt -->
#
sub setupmdesc {
    my ($ltype, $to, $from, $dlinkh, $awso) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($ndlinkh, $drefi);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("setupmdesc ltype $ltype to $to from $from dlinkh $dlinkh awso $awso ");
      };

    if ((findmdesc ($Awfif::wsol-> {l} [$awso][2], ($from), $ltype, \$drefi) == 0)
    ){

      $ndlinkh
        = setupdesc ( ($ltype),
          ($to),
          $from,
          $dlinkh,
          $awso);
      }#if
    elsif (findmdesc ($Awfif::wsol-> {l} [$awso][2], ($from), $ltype, \$drefi) == 2){#currently masked

      $Awfif::workspace->{l} [$drefi][3]--;
      $ndlinkh = $dlinkh;
      }# elsif
    else {# found active descriptor

      $ndlinkh = $dlinkh;
      };#else
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::workspace->{l} [$drefi][3];
      print ("setupmdescx desc3 ($pr) ret ($ndlinkh)\n");
      };
    return $ndlinkh
    }# setupmdesc
#
#<!-- end tag ds -->
#
sub maskmdesc {
    my ($from, $to, $awso) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($drefi);

    if ((findmdesc ($Awfif::wsol-> {l} [$awso][2], ($from), $to, \$drefi)==1)
    ){

      $Awfif::workspace->{l} [$drefi][3]++;
      };#if
    }# maskmdesc
#
#<!-- start tag phe -->
#
sub maskcounter {
    my ($from, $awso, $tooconc, $type) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($counteri);

    if ((findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri, $tooconc, $type))
    ){

      $Awfif::workspace->{l} [$counteri][4]++;
      $Awfif::workspace->{l} [$counteri][9] = ($Awfif::memes-> {snnh} {wsi} + 1);#get rid of the bias for unmasking
      };#if
    }# maskcounter
#<!-- end tag phe -->
#<!-- start tag scc -->
#<!-- start tag aso -->
#
sub ifindupri {
    my ($myli, $sponsor, $strategy, $checksubp, $subpcstws, $issubp, $subpid, $dontccsponsor, $dontcallbreak) = @_;#

    my ($result, $sigcount, $gsws, $gswso, $agswso, $cwsbi, $counteri, $istrategy, $issubp, $i, $atelhwso);
    my (@f1sub, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ifindupri myli $myli sponsor($sponsor) strategy($strategy) checksubp($checksubp) subpcstws($subpcstws) issubp($issubp) subpid($subpid) dontccsponsor($dontccsponsor) dontcallbreak($dontcallbreak) ");
      };
    $result = '';
# ifindupri may be called by an initiator of sub-programs - checksubp should then be true
    if ((defined ($checksubp))
    && ($checksubp)
    && (defined ($subpid))
    ){

      $atelhwso = awsoadr (trwsoadr ($sponsor, -1));
      @f1sub = getf1list ($myli, $atelhwso, $subpid, 't');
      if ($f1sub [0] > 0) {

        $result = 't';#if all have backoff set then slow down the builder
# see if any sub in the list has its backoff masked if so return false
        for ($i = 1; (($i <= $f1sub [0]) && ($result)); $i++) {
          if (!(ifindupri ($myli, $sponsor, $strategy, undef(), $Awfif::subpl-> {l} [$f1sub[$i]] [6], $Awfif::memes-> {snnh} {subpstbinding} , $f1sub[$i], undef(), $dontcallbreak)) ) {

            $result = '';
            };#if
          };#for each sub in list
        };#if
      }#if
    else {
# ivalbtfu1
      if ( (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $subpcstws, $issubp, $subpid, $dontcallbreak) == 1)
      ){#

        $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws, undef(), $subpcstws, $subpid);
        if ((defined ($strategy)) && ($strategy ne '')) {
          $istrategy = $strategy;
          }#if
        else {
          $istrategy = 'goalscon';
          };#else
        if ( (ifindb ($myli, 1, $istrategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $gsws, $issubp, $subpid, $dontcallbreak) == 1)
        ){#

          $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws, $subpcstws, $subpid);
          $Awfif::memes-> {currentwsbi} = $gsws;
          $agswso = awsoadr ($gswso);
# if find a backoff and am the cascade sponsor then slow down the builder
          if (findcounter ($Awfif::wsol-> {l} [$agswso][2], $Awfif::memes-> {snnh} {backoff}, \$counteri)
          && (((defined ($dontccsponsor)) && ($dontccsponsor)) or (cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{getcassponsor}) == 1))
          ) {

            $result = 't';
            };#if
          };#if
        };#if
      };#else
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ifinduprix ");

      print ("ret ($result)\n");
      };

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# ifindupri
#
sub initschcon {
    my ($myli, $buffers, $kwp, $kwpr, $sponsor, $stws, $issubp, $subp) = @_;#

    my ($result, $sigcount, $gsws, $gswso, $agswso, $cwsbi, $binding);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, @inmsymbol);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    if ( (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@{$Awfif::memes-> {sactset}}, $stws, $issubp, $subp) == 1)
    ){#

      $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws, undef(), $stws, $subp);
      $Awfif::memes-> {currentwsbi} = $gsws;
      $agswso = awsoadr ($gswso);
      my ($buffer, $depstag, $depttag, $dephtag, $insymbol, @started, $end, $setwsclinv);
      $buffer = '(<rhlmspg>';
      $buffer = $buffer . $$buffers;
      $buffer = $buffer . '<selector><schema></rhlmspg>)';
      $depstag = '';
      $depttag = 0;
      $dephtag = 0;
      $insymbol = '';
      @inmsymbol = ();
      $started[0] = 0;
      $started[1] = 't';
      $setwsclinv = '';

      if (defined ($issubp)) {

        $binding = $issubp;
        }#if
      elsif ($Awfif::codelet-> {l} [$myli] [36] > 0) {

        $binding = $Awfif::memes-> {snnh} {subpstbinding};
        }#elsif
      else {

        $binding = $Awfif::memes-> {snnh} {stbinding};
        };#else
      &convbws ($myli, \$buffer, \$$kwp, $kwpr, $Awfif::memes-> {kwmi}, $Awfif::memes-> {kwmir}, $sponsor, \$insymbol, \@inmsymbol, \@started, \$end, \$depstag, \$depttag, \$dephtag, $gsws, $binding,
        $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {budesc}],
        '', #dont energize the base types
        \$setwsclinv
        );
      $result = 't';
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# initschcon
#
sub initschwar {
    my ($myli, $buffers, $sponsor, $stws) = @_;#

    my ($result, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $warwso, $cwsbi, $binding);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    if ( (ifindb ($myli, 1, 'warb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@{$Awfif::memes-> {sactset}}, $stws) >= 1)
    ){#

      my ($warws, $bcount, $awarwso, $warmatchswso, $awarmatchswso);
      $warwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$warws, undef(), $stws);
# initschwarscpu1
# if requested schema already exists then mask any descriptors that are present and return

      $Awfif::memes-> {currentwsbi} = $warws;
      $awarwso = awsoadr ($warwso);

      $bcount = ifindb ($myli, $$buffers, 'warmab', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@{$Awfif::memes-> {sactset}}, $warws, undef (), undef (), 't');
      if ($bcount > 0) {

        $warmatchswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $warws);
        $result = 't';
        $awarmatchswso = awsoadr ($warmatchswso);
        &maskcounter ($Awfif::memes-> {snnh}{model}, $awarmatchswso, $Awfif::memes-> {snnh}{completed}, $Awfif::memes-> {snnh}{waitarelay});
        }#if
# else deploy the requested schema
      else {#buffer did not match

        my ($dummy, $buffer, $depstag, $depttag, $dephtag, $insymbol, @inmsymbol, @started, $end, $setwsclinv);
        $buffer = '(<rhlmspg><waitarelay><schema>';
        $buffer = $buffer . $$buffers;
        $buffer = $buffer . '</rhlmspg>)';
        $depstag = '';
        $depttag = 0;
        $dephtag = 0;
        $insymbol = '';
        @inmsymbol = ();
        $started[0] = 0;
        $started[1] = 't';
        $setwsclinv = '';

        $binding = $Awfif::memes-> {snnh} {stbinding};
        &convbws ($myli, \$buffer, \$dummy, undef(), $Awfif::memes-> {kwmi}, $Awfif::memes-> {kwmir}, $sponsor, \$insymbol, \@inmsymbol, \@started, \$end, \$depstag, \$depttag, \$dephtag, $warws, $binding,
          $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {budesc}],
          '', #dont energize the base types
          \$setwsclinv
          );
        $result = 't';
        };#else
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# initschwar
#
sub listunmsubp {
    my ($myli, $awso, $nsubs) = @_;#
# look for 1. subpref initiation which is deployed by ivalbuilder during go-in subprogram setup
# 2. subpref completed which is deployed by bcsubpcbuilder and which description launches the deferred endlistkw/f0-bcsubpc codelet too

    my (@result, $cwsbi, $listi, $imax);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listunmsubp myli $myli awso $awso ");
      };
    $result [0] = 0;
# build a list of subpid<-({initiation})-{subpref} descriptors
    $listi = $Awfif::wsol-> {l} [$awso] [2];

    while ($listi != 0) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiation})
      ){

        $result [++$result[0]] = ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi});
        };#if
      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while
    if (defined ($$nsubs)){

      $$nsubs = $result [0];#indicate that there were subs
      };#if
# now remove any with matching ({completed})-{subpref} descriptors

    $imax = $result [0];
    $listi = $Awfif::wsol-> {l} [$awso] [2];
    while (($result [0] > 0) && ($listi != 0)) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {completed})
      ){

        my ($i, $i2, $found);
        $found = '';
        for ($i = 1;((!$found) && ($i <= $imax)); $i++) {

          if ($result [$i] == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi})) {

            $found = 't';
            for ($i2 = $i;$i2 < $imax; $i2++) {

              $result [$i2] = $result [$i2+1];
              };#for
            $result [$result[0]--] = undef ();
            };#if
          };#for
        };#if
      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while
# return the array

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listunmsubpx ");
      if (defined ($$nsubs)){
        print ("nsubs($$nsubs) ");
        };#if
      print ("ret ($result[0])\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return @result
    }# listunmsubp
#
sub newunmsubp {
    my ($myli, $awso) = @_;#

    my (@subpl, $result, $cwsbi, $i);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("newunmsubp myli $myli awso $awso ");
      };#if
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    @subpl = listunmsubp ($myli, $awso);
# now check for any items which do not have a waiting procedure allocated

    for ($i = 1; (($i <= $subpl[0]) && (!$result)); $i++) {
      if ((defined ($subpl [$i]))
      && ($subpl [$i] > 0)
      && ((! defined ($Awfif::subpl-> {l} [$subpl [$i]][9])) or ($Awfif::subpl-> {l} [$subpl [$i]][9] == 0))
      ) {

        $result = 't';
        };#if
      };#for
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("newunmsubpx ret ($result)\n");
      };
# return the array

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# newunmsubp
#
sub listcsubp {
    my ($myli, $awso) = @_;#
# look for subpref completed which is deployed by bcsubpcbuilder and which description launches the deferred endlistkw/f0-bcsubpc codelet too

    my (@result, $cwsbi, $listi);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listcsubp myli $myli awso ($awso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result [0] = 0;
# build a list of subpid<-({completed})-{subpref} descriptors
    $listi = $Awfif::wsol-> {l} [$awso] [2];

    while ($listi != 0) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {completed})
      ){

        $result [++$result[0]] = ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi});
        };#if
      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listcsubpx ret($result[0]) \n");
      };
# return the array

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return @result
    }# listcsubp
#
sub remarrent {
    my ($index, $arrayp) = @_;#

    my ($i2);
# remove an array entry $arrayp[$index] from array

    if ($index <= $$arrayp [0]) {

      for ($i2 = $index;$i2 < $$arrayp[0]; $i2++) {

        $$arrayp [$i2] = $$arrayp [$i2+1];
        };#for
      $$arrayp[$$arrayp[0]--] = undef();
      };#if

    }# remarrent
#
sub subpinitiated {
    my ($myli, $awso, $subpid, $hiurg) = @_;#
# look for 1. subpref initiation which is deployed by ivalbuilder during go-in subprogram setup
# it is given a count in [9] which will be decremented each time subpinitiated checks for active codelets of this subpid
# once the count [9] reaches 0 subpinitiated will instead see if the bcsubpsbuilder has described running with check 2.
# 2. subprogram initiate which is deployed by bcsubpsbuilder demonstrating that it has run starting the subprogram operation.

    my ($result, $found, $listi, $cwsbi);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpinitiated myli $myli awso($awso) subpid($subpid) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    $found = '';
    $listi = $Awfif::wsol-> {l} [$awso] [2];

    while (($listi != 0) && (!$found)) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiation})
      && ($subpid == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi}))
      && ($Awfif::workspace-> {l} [$listi] [9] > 0)
      ){

        $result = subpcltpresent ($subpid);#if there are no codelets in the subprogram then don't delay
        $found = 't';
        $Awfif::workspace-> {l} [$listi] [9]--;
# in retrospect seems if can't find the signaled codelets descriptor it needs to be signalled with more priority
        if ((!$result)
        && (defined ($$hiurg))
        ){

          $$hiurg = 't';
          };#if
        }#if
      elsif ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiation})
      && ($subpid == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi}))
      && ($Awfif::workspace-> {l} [$listi] [9] == 0)
      ){

        if ($Awfif::memes-> {subpinitdb}) {&break()};
        $listi = $Awfif::wsol-> {l} [$awso] [2];
        while (($listi != 0) && (!$found)) {

          if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subprogram})
          && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiate})
          && ($subpid == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi}))
          ){

            $result = 't';
            $found = 't';
            };#if
          $listi = $Awfif::workspace-> {l} [$listi] [0];
          };#while
# in retrospect seems if can't find the signaled codelets descriptor it needs to be signalled with more priority
        if ((!$result)
        && (defined ($$hiurg))
        ){

          $$hiurg = 't';
          };#if
        }#elsif

      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpinitiatedx ");
      if ((defined($$hiurg))
      ){
        print ("hiurg($$hiurg) ");
        };#if

      print ("ret ($result)\n");
      };
    return $result
    }# subpinitiated
#
sub subpcltpresent {
    my ($subpid) = @_;
    my ($found, $listi, $cwsbi);
# look for evidence of the subprogram codelet being present as a deferred or active queue codelet
#
# checked for merged workspaces
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpcltpresent subpid($subpid) ");
      };

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';

    if ((!$found)
    && (defined ($Awfif::subpl-> {q} [2] [$subpid]) )
    && ($Awfif::subpl-> {q} [2] [$subpid] > 0)
    ){

      $found = 't';
      };#if deferred waiting on endlistkwbuilder end of list
# list the cached codelets associated with this subprogram

    if ((!$found)
    &&($Awfif::subpl-> {l} [$subpid] [15][0] > 0)
    ){

      $found = 't';
      };#if
# list the deferred codelets associated with this subprogram

    if ((!$found) && (defined($Awfif::subpl-> {w} [$subpid])) && ($Awfif::subpl-> {w} [$subpid] != 0) ){#there is a deferred codelet waited on f1 completion

      $found = 't';
      };#if

    if ((!$found) && (defined ($Awfif::memes-> {bcsubpscdef})) && ($Awfif::memes-> {bcsubpscdef} > 0) ){

      my ($bccodelet);
      $listi = $Awfif::memes-> {bcsubpscdef};

      while ((!$found) && ($listi != 0) && ($listi != $Awfif::subpscdefl-> {l} [$listi] [0])) {
        $bccodelet = $Awfif::subpscdefl-> {l} [$listi] [2];
        if ($Awfif::codelet-> {l} [$bccodelet] [36] == $subpid){

          $found = 't';
          };#if
        $listi = $Awfif::subpscdefl-> {l} [$listi] [0];
        };#while
      };#if
    $listi = $Awfif::memes-> {codeletdef};

    while ((!$found) && ($listi != 0) && ($listi != $Awfif::codelet-> {l} [$listi] [0])) {
      if ($Awfif::codelet-> {l} [$listi] [36] == $subpid){

        $found = 't';
        };#if
      $listi = $Awfif::codelet-> {l} [$listi] [0];
      };#while
# list the active codelets associated with this subprogram

    $listi = $Awfif::memes-> {codeleth};
    while ((!$found) && ($listi != 0)) {
      if ($Awfif::codelet-> {l} [$listi] [36] == $subpid){

        $found = 't';
        };#if
      $listi = $Awfif::codelet-> {l} [$listi] [0];
      };#while

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpcltpresentx ");
      print ("ret ($found)\n");
      };

    return $found
    }# subpcltpresent
#
sub nof1in15 {
    my ($myli, $subpid, $transid) = @_;
    my ($found, $cwsbi, $i, $result);
#
# checked for merged workspaces
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nof1in15 myli $myli subpid($subpid) transid($transid) ");
      };

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';

    for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i} [$transid][0])); $i++){#each builder string in {18}
      if ((matchicsaelement ((\@{$Awfif::subpl-> {l} [$subpid][15]} ), $Awfif::tral-> {i} [$transid][$i]) != 0)
      ){

        $found = 't';
        };#if
      };#for i
    $result = !$found;

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nof1in15x ");
      print ("ret ($result)\n");
      };

    return $result
    }# nof1in15
#
#<!-- end tag aso -->
#
sub imasksupp {
    my ($myli, $strategy) = @_;#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("imasksupp myli($myli) ");
      };
    my ($sigcount, $gsws, $gswso, $agswso, $cwsbi, $istrategy);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ( (!matchsibs ($myli, $Awfif::memes-> {currentwsbi}))
    && (($Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli][19]) != 0)
    && (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}) == 1)
    ){#

      $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws);
      if ((defined ($strategy)) && ($strategy ne '')) {
        $istrategy = $strategy;
        }#if
      else {
        $istrategy = 'goalscon';
        };#else
      if ( (ifindb ($myli, 1, $istrategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $gsws) == 1)
      ){#
        $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws);
        $Awfif::memes-> {currentwsbi} = $gsws;
        $agswso = awsoadr ($gswso);
# mask any backoff or notgcompleted descriptors in the suppressor region
        &maskcounter ($Awfif::memes-> {snnh} {backoff}, $agswso);
        &maskcounter ($Awfif::memes-> {snnh} {notgcompleted}, $agswso);
# kick the cascade sponsors
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("imasksuppx \n");
      };
    }# imasksupp
#
sub resetcounter {
    my ($from, $awso) = @_;#
    my ($mcounteri, $counteri);

    if ((!findcounter ($Awfif::wsol-> {l} [$awso][2], ($from+1), \$mcounteri))
    && (!findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri))
    ){

# no counter deployed
      }#if
    elsif (!findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri)){#currently masked

      $Awfif::workspace->{l} [$mcounteri][9] = $Awfif::memes-> {snnh} {wsi};
      }# elsif
    else {# found active descriptor increment counter

      $Awfif::workspace->{l} [$counteri][9] = $Awfif::memes-> {snnh} {wsi};
      };#else
    }# resetcounter
#
sub getabdwso {
    my ($myli, $sponsor, $binding, $abdwso) = @_;#

    my ($found, $bdwso, $sigcount, $cwsbi2);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);

    $cwsbi2 = $Awfif::memes-> {currentwsbi};
    $found = '';
    if ( ifindb ($myli, $sponsor, $binding, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}) == 1) {
      my ($tws);
      $bdwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$tws);
      $Awfif::memes-> {currentwsbi} = $tws;
      $$abdwso = awsoadr ($bdwso);
      $Awfif::memes-> {currentwsbi} = $cwsbi2;
      };#if
    return $found
    }# getabdwso
#
sub dropsalience {
    my ($myli, $sponsor, $strategy, $stws, $issubp, $subp) = @_;#

    my ($result, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $asponsor, $atelhwso, $gsws, $gswso, $agswso, $cwsbi, $counteri, $istrategy);
# if detect a backoff descriptor then deploy a dropsalience descriptorlink in the sponsor workspace object
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    if ( (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $stws, $issubp, $subp) == 1)
    ){#

      $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws, undef(), $stws, $subp);
      if ((defined ($strategy)) && ($strategy ne '')) {

        $istrategy = $strategy;
        }#if
      else {

        $istrategy = 'goalscon';
        };#else
      if ( (ifindb ($myli, 1, $istrategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $gsws, $issubp, $subp) == 1)
      ){#

        $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws, $stws, $subp);
        $Awfif::memes-> {currentwsbi} = $gsws;
        $agswso = awsoadr ($gswso);
# if find a backoff and am the cascade sponsor then slow down the builder
        if (findcounter ($Awfif::wsol-> {l} [$agswso][2], $Awfif::memes-> {snnh} {backoff}, \$counteri)
        ) {

          $Awfif::memes-> {currentwsbi} = $cwsbi;
          $asponsor = awsoadr ($sponsor);
          $atelhwso = awsoadr (trwsoadr ($sponsor, -1));
# dropsal253u1
          if (checkwsbf ($asponsor, 25) != 3) {indicates that this wso salience must not be cached since part of the value is generated dynamically

            &setwsbf ($asponsor, 25, 3);
            $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsotdg}] = 0;#*** submacrok ***##hence get rid of any cache value
            if ($Awfif::memes-> {backoffactives} {'tdgroup'} <= 0) {

              $Awfif::memes-> {backoffactive} {'tdgroup'} = 3;#note that backoff has active links
              };#if
            $Awfif::memes-> {backoffactives} {'tdgroup'} ++;#semophore assumes that each codelet incs and decs only once
            };#if
          $Awfif::wsol-> {l} [$asponsor] [2]
          = setupmdesc ( ($Awfif::memes-> {snnh} {dropsalience}),
            ($Awfif::memes-> {snnh} {wsi} + $counteri), #seems like you want to start from 1
            $Awfif::memes-> {snnh} {descriptorlink},
            $Awfif::wsol-> {l} [$asponsor] [2],
            $asponsor);
# dropsaltrmu1
# if transaction managed sup-program record the descriptor creation in trans managed state
          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            &addtmgrdropsal ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor] [2]] [4], 0, $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor] [2]] [3], $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor] [2]] [2]);
            };#if
          };#if
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# dropsalience
#
sub linkeddsalience {
    my ($wso) = @_;#
    my ($drefi, $result, $awso, $cwsbi, $backoffi);

    $result = '';
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $awso = awsoadr ($wso);
    if ((findmdesc ($Awfif::wsol-> {l} [$awso][2], $Awfif::memes-> {snnh} {descriptorlink}, $Awfif::memes-> {snnh} {dropsalience}, \$drefi) == 1) # link descriptor exists
    ){

      $backoffi = $Awfif::workspace-> {l} [$drefi][2] - $Awfif::memes-> {snnh} {wsi};
      if ($Awfif::workspace-> {l} [$backoffi][4] == $Awfif::memes-> {snnh} {backoff}) {

        $result = 't';
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# linkeddsalience
#
sub mdropsalience {
    my ($awso) = @_;#

    if ($Awfif::memes-> {backoffactives} {'tdgroup'} > 1) {
      $Awfif::memes-> {backoffactives} {'tdgroup'}--;#semophore assumes that each codelet incs and decs only once
      }# if
    else {
      $Awfif::memes-> {backoffactives} {'tdgroup'}--;#semophore assumes that each codelet incs and decs only once
      $Awfif::memes-> {backoffactive} {'tdgroup'} = 0;#note that backoff has active links
      };#if
    &maskmdesc ($Awfif::memes-> {snnh} {descriptorlink}, $Awfif::memes-> {snnh} {dropsalience}, $awso);
    }# mdropsalience
#<!-- start tag ds -resweb -->
#
sub clogstatx {
    my ($myli) = @_;
    my ($i, $pstringx, $clog, $pack, $file, $line, $subname, $hasargs, $wantarray, $evaltext, $is_require);
# turns off conditional logging if matches <procedure>x.
#
# checked for merged workspaces

    $i = 1;
    ($pack, $file, $line, $subname, $hasargs, $wantarray, $evaltext, $is_require) = caller ($i);
    $pstringx = $subname.'x';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceclogentry}) {
      print ("clogstatx $pstringx ");
      };

    $clog = $Awfif::memes-> {clogeplist};
    if ($clog =~ /$pstringx/) {
      $Awfif::memes-> {clogs} = '';
      };
    &idoroleout ($myli);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceclogentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {clogs};
      print ("clogstatx clogs ($pr) \n");
      };
    }# clogstatx
#
#<!-- end tag ds -->
#
sub subpcsponsor {
    my ($myli, $sponsor) = @_;
    my ($i, $linki, $atelhwso, $asponsor, $drefi, $cwsbi, $result, $ftransid, $fi );
# models must use the full workspace
#
# checks for existance of a cassponsor (including relay) descriptor relationship within a particular schematic group
# the relay scenario means that one cassponsor descriptor will potentially represent
# multiple f1 relations. The sponsor may not be a subpid, so there is no reason to
# expect the relay to have written cassponsor records to transmgr storage. There certainly wont
# be a cassponsor record per relation.
# there should be a assocf1 record in atelhwso and a codeletslice that can imply the existance of an incomplete transaction in sponsor.

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpcsponsor myli $myli sponsor $sponsor");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $asponsor = awsoadr ($sponsor);
    $atelhwso = awsoadr (trwsoadr ($sponsor, -1));
    if ((findmdesc ($Awfif::wsol-> {l} [$asponsor][2], ($Awfif::memes-> {snnh}{cassponsor}), $Awfif::memes-> {snnh}{wsi}, \$drefi) > 0)#this has been a cassponsor
    && (($linki = $Awfif::tmassl-> {wsoh} {$asponsor}) > 0)
    ) {
      while (($linki != 0) && (!$result) ) {

        for ($i = 1; ((!$result) && ($i <= $Awfif::tmassl-> {l}[$linki][2])); $i++) {
          if (($Awfif::tmassl-> {s} [$linki] [$i] [0] == $Awfif::memes-> {snnh} {codeletslice})
          ){#

            if ((!$result) && (defined ($Awfif::tmassl-> {s} [$linki] [$i] [2]))) {

              if ( ($Awfif::tmassl-> {s} [$linki] [$i] [1] == 35)
              && ($Awfif::tmassl-> {s} [$linki] [$i] [2] > 0)
              ) {

                my ($i4);
                for ($i4 = 1; ((!$result) && ($i4 <= $Awfif::tral-> {i} [$Awfif::tmassl-> {s} [$linki] [$i] [2]] [0])); $i4++) {

                  $ftransid = checksameas (undef(), $Awfif::tmassl-> {s} [$linki] [$i] [2], $i4, \$fi);
                  if ($Awfif::tral-> {w} [$ftransid][$fi] == $Awfif::memes-> {snnh} {incomplete} ){

                    $result = 't';
                    };#if
                  };#for
                };#if
              };#while -> if
            };#if
          };#for
        $linki = $Awfif::tmassl-> {l} [$linki] [0];
        };#while

      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpcsponsorx ret ($result)");
      };
    return $result

    }#subpcsponsorx
#
#<!-- end tag aso -->
sub ivalbuilder1 {
    my ($myli, $valid, $token, $kwp, $kwpr, $sactset) = @_;
    my ($sponsor, $sponsortype, $signal, $schema, $swstype,
    $noswstype, $catalysis, $usetrans, $transid, $transtatus, $mtranstatus,
    $cwsposition, $acwsposition, $dontrep35, $subpid, $stransmgrid, $tmatchedwso,
    $atelhwso, $usedngc, $depsubs, $dospigrabamp, $spigtransid, $jhlabeli,
    $jhlabeliav, $jhlabeloi, $mytransid, $reportcaspart, $termdesc, $histdesc, $clearedcomps, $dongc,
    $in221, $in2220, $in2301, $in2310, $in2311, $in232, $in2330,
    $grkwp, $grkwpr, $cdn, $cdnx);
    my ($count, $wcompdesc, $didgrab, $grabdesc, $csubpid, $descfits, $conforms, $reportdesc, $arunningwso, $aws);
    my (@subpl, @csubpl);
#
# checked for merged workspaces

# value structure codelet responds to group complete providing processing of selector and value structures
# this requires frame shifting, and initiation of sub-codelets to enter the frame shifted wso structure
    $noswstype = '';
    $dontrep35 = '';
    $dospigrabamp = '';
    $usedngc = '';
    $depsubs = '';
    $reportcaspart = '';
    $clearedcomps = '';#will be set to t if entered the complete transaction clearup
    $mytransid = $Awfif::codelet-> {l}[$myli][35];
    $jhlabeliav = '';
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 4)
    ){

      my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $twso, $asponsor, $sldesc, $cws, $bdwso, $abdwso, $cwsbi, $slhdesc, $slldesc, $handlestop, $signalsubp, $noget);
      $cwsbi = $Awfif::memes-> {currentwsbi};
      if ( ($Awfif::memes-> {checktransidnz})
      && ($Awfif::codelet-> {l} [$myli][36] > 0)
      && ($mytransid == 0)
      && (!mysubtrancomp ($myli, findsubpicnm ($myli, $Awfif::codelet-> {l}[$myli][36], $Awfif::codelet-> {l}[$myli][2]), $Awfif::codelet-> {l}[$myli][2]))
      ){

        &break ();
        };#if
      if (($Awfif::memes-> {valbsubpbreak}) && ($Awfif::codelet-> {l} [$myli] [36] > 0)
      ){

        &break();
        };#if

      if ( (defined ($Awfif::memes-> {valbsubpspbreak}))
      && ($Awfif::memes-> {valbsubpspbreak} == $Awfif::codelet-> {l} [$myli] [36])
      ){

        &break();
        };#if
      if (($Awfif::memes-> {valbmainpbreak}) && ($Awfif::codelet-> {l} [$myli] [36] == 0)
      ){

        &break();
        };#if

      $handlestop = 't';
      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
      $twso = trwsoadr (fgrpend ($sponsor), 1);
      $asponsor = awsoadr ($sponsor);
      $sponsortype = wsbasetype ($sponsor);
      $atelhwso = awsoadr (trwsoadr ($sponsor, -1));

      if ( (ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset) == 1)
      ){#

        $bdwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
        $histdesc = bindhistone ($myli, $cws, $bdwso);
        my ($i);
        $Awfif::memes-> {currentwsbi} = $cws;
        $abdwso = awsoadr ($bdwso);
# record the current wsposition
        $sldesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($bdwso)] [2], $Awfif::memes-> {snnh} {wsposition});
        $cwsposition = &movecomplex ($myli, $sldesc, 0, $abdwso);
        $Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$sldesc] [3] - $Awfif::memes->{snnh}{wsi});
        $acwsposition = awsoadr ($cwsposition);
# now have the context workspace
        $Awfif::memes-> {currentwsbi} = $cws;
# ivalwwcf1u1
# handle wascompletingf1 descriptor

        @subpl = listunmsubp ($myli, $abdwso);
        if ( ($Awfif::memes-> {usewcf1d})
        && ($subpl [0] == 0)
        && ($Awfif::codelet-> {l} [$myli] [36] > 0)
        && (($wcompdesc = findtdesc ($Awfif::wsol-> {l} [ $abdwso] [2], $Awfif::memes-> {snnh} {wascompletingf1}, $Awfif::codelet-> {l} [$myli] [36] )) != 0)
        ){

          if ( ($Awfif::memes-> {valbsubpnspwcbreak})
          ){

            &break ()};

          $Awfif::workspace-> {l} [$wcompdesc][4]--;#make it a completingf1
          $Awfif::wsol-> {l} [$abdwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::codelet-> {l} [$myli] [36], #pltype
              ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$myli] [36]), #pto
              $Awfif::memes-> {snnh} {completingf1}, #from
              $Awfif::wsol-> {l} [$abdwso] [2],#dlinkh
              $abdwso,#awso
              't',#synccod
              $Awfif::codelet-> {l} [$myli] [36],#sltype
              $Awfif::codelet-> {l} [$myli] [36]);#spto
          };#if

        if ( ($Awfif::memes-> {usewcf1d})
        && ($subpl [0] == 1)
        && ($Awfif::codelet-> {l} [$myli] [36] > 0)
        && (($wcompdesc = findtdesc ($Awfif::wsol-> {l} [ $abdwso] [2], $Awfif::memes-> {snnh} {wascompletingf1}, $subpl [ $subpl [0] ] )) != 0)
        ){

          if ( ($Awfif::memes-> {valbsubpnspwcbreak})
          ){

            &break ()};

          $Awfif::workspace-> {l} [$wcompdesc][4]--;#make it a completingf1
          $Awfif::wsol-> {l} [$abdwso][2] #now force the waitondesc to complete
          = inccounter ( $subpl [ $subpl [0] ], #pltype
              ($Awfif::memes-> {snnh} {wsi} + $subpl [ $subpl [0] ]), #pto
              $Awfif::memes-> {snnh} {completingf1}, #from
              $Awfif::wsol-> {l} [$abdwso] [2],#dlinkh
              $abdwso,#awso
              't',#synccod
              $subpl [ $subpl [0] ],#sltype
              $subpl [ $subpl [0] ]);#spto
          };#if
# ivalwwcf1u3
# handle initgw descriptor at end of subprogram workspace

        if ( ($Awfif::memes-> {usewcf1d})
        && ($Awfif::codelet-> {l} [$myli] [36] > 0)
        && ((findtdesc ($Awfif::wsol-> {l} [ $abdwso] [2], $Awfif::memes-> {snnh} {initgw}, $Awfif::codelet-> {l} [$myli] [36] )) != 0)
        && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
        && (($termdesc = findtdesc ($Awfif::wsol-> {l} [($abdwso)] [2], $Awfif::memes-> {snnh} {subprogram}, ($Awfif::memes-> {snnh} {stop}))) != 0 )
        && ($Awfif::workspace-> {l} [$termdesc] [2] == $Awfif::workspace-> {l} [$sldesc] [2])
        && ((findtdesc ($Awfif::wsol-> {l} [ $abdwso] [2], $Awfif::memes-> {snnh} {wascompletingf1}, $Awfif::codelet-> {l} [$myli] [36] )) == 0)
        && ((findtdesc ($Awfif::wsol-> {l} [ $abdwso] [2], $Awfif::memes-> {snnh} {completingf1}, $Awfif::codelet-> {l} [$myli] [36] )) == 0)
        ){

          $Awfif::wsol-> {l} [$abdwso][2]
          = setupdesc ( $Awfif::codelet-> {l}[$myli][36],
            ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][36]), #
            $Awfif::memes-> {snnh} {wascompletingf1},
            $Awfif::wsol-> {l} [$abdwso] [2],
            $abdwso);
# make it an iterator
          $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$abdwso][2]] [8] = $Awfif::memes-> {snnh} {iterator};
          $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$abdwso][2]] [9] = ($Awfif::memes-> {snnh} {wsi} + 1);
          };#if
# process grab if ivalw have noted they have run
# ivalwgrabu2

        $Awfif::memes-> {currentwsbi} = $cws;
        $jhlabeliav = '';
        if ( (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abdwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )#report that codelet has run allowing it to be grabbed
        && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi})) > 0 )
        && (($arunningwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi})) ) > 0 )
        && (($csubpid = spifgrabcandidate ($myli, $arunningwso, undef(), \$jhlabeliav, \$jhlabeli)) > 0)
        ){

          $Awfif::wsol-> {l} [$asponsor][2]
            = inccounter ( 0,
                (0 ), #will become a reference to codelet shell
                $Awfif::memes-> {snnh} {grab},
                $Awfif::wsol-> {l} [$asponsor] [2],
                $asponsor);

          if ( ( ($grabdesc = findtdesc ($Awfif::wsol-> {l} [ $asponsor ] [2], $Awfif::memes-> {snnh} {grab})) != 0 )
          ){

            $Awfif::workspace-> {l} [$grabdesc] [2] = $csubpid;
            };#if
          };#if
# check transaction state for all outstanding f1 and clear out any completed
# ivalwbtmgru1

        @csubpl = listcsubp ($myli, $abdwso);
        $transid = 0;#must be defined to be setup in gettmgr
        $subpid = getf1tmgr ($myli, $atelhwso, $asponsor, $Awfif::codelet-> {l} [$myli] [36], \$transid, \$stransmgrid, \@csubpl);#will return an associated completed sub by preference
        $usetrans = $transid;

        if ($subpid == 0
        ){

          $subpid = undef ();
          };

        if ($transid == 0
        ){

          $in221 = 't';
          $transid = undef();
          $transtatus = $Awfif::memes-> {snnh} {transid};
          &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{wascasrelay});
          $subpid = undef ();
          }#if
        else {

          $in2220 = 't';
          $transtatus = $Awfif::memes-> {snnh} {casrelay};#unless shift to wascassponsor
          &transalloc ($myli, $Awfif::memes-> {snnh} {casrelay}, undef(), $transid, \$transtatus);
          if ( ($transtatus == $Awfif::memes-> {snnh} {completed})
          ){#remove the deployment descriptor
# ivalbspgau1

            if ($Awfif::memes-> {applyactive}
            ){

              $didgrab = spigrabamp ($myli, \$$kwp, $kwpr, undef(), \$jhlabeliav, \$jhlabeli, \$transid);
              if (($Awfif::memes-> {valccompspibreak}) && (!$didgrab) && ($transid != 0) && ($transtatus == $Awfif::memes-> {snnh} {completed})) {&break ()};
              }#if
            else {

              $didgrab = '';
              };

            while (($didgrab) && ($transid != 0) && ($transtatus == $Awfif::memes-> {snnh} {completed})
            ){

              $clearedcomps = 't';
              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, 0, 0, $stransmgrid);
              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {remove}, $Awfif::memes-> {snnh} {assocf1}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), $subpid, $stransmgrid);
              if ($stransmgrid != $Awfif::codelet-> {l} [$myli] [37]) {#try to maintain the active source transmgr id submitted

                $Awfif::tmassl-> {submitted} [ $stransmgrid ] = undef();
                }#if
              elsif ($Awfif::memes-> {valclearsubmbreak}) {&break ()};
              $usetrans = 0;#just deleted this transaction
              $transid = 0;
              $subpid = getf1tmgr ($myli, $atelhwso, $asponsor, $Awfif::codelet-> {l} [$myli] [36], \$transid, \$stransmgrid, \@csubpl);#will return an associated completed sub by preference
              $transtatus = $Awfif::memes-> {snnh} {casrelay};#unless shift to wascassponsor
              &transalloc ($myli, $Awfif::memes-> {snnh} {casrelay}, undef(), $transid, \$transtatus);
              };#while

            if (!$clearedcomps) {#get an incompete transaction to work on

              $in2301 = 't';
              $usetrans = 0;#just deleted this transaction
              $transid = 0;
              $subpid = getf1tmgr ($myli, $atelhwso, $asponsor, $Awfif::codelet-> {l} [$myli] [36], \$transid, \$stransmgrid, undef(), 't');
              $transtatus = $Awfif::memes-> {snnh} {casrelay};#unless shift to wascassponsor
              &transalloc ($myli, $Awfif::memes-> {snnh} {casrelay}, undef(), $transid, \$transtatus);
              };#if
            if (($transid == 0 ) && ($clearedcomps)
            ){#then completed all of list

              $in2310 = 't';
              $transid = undef();
              $transtatus = $Awfif::memes-> {snnh} {transid};
              &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{wascasrelay});
              $subpid = undef ();
              }#if
            elsif (($transid == 0 )
            ){#then didn't get to clear list - but this is because cant grab so could be outstanding completed associations to clear

              $in2311 = 't';
              $transid = undef();
              $transtatus = $Awfif::memes-> {snnh} {transid};
              &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{wascasrelay});
              $subpid = undef ();
              if ($subpl [0] != 0) {

                $dontrep35 = 't';
                $dongc = 't';
                };#
              }#if
            else {

              $in232 = 't';
              $usetrans = $transid;#record that there are outstanding transactions
              &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{casrelay});
              $dontrep35 = 't';
              };#else
            }#if
          else {

            $in2330 = 't';
            $usetrans = $transid;#record that there are outstanding transactions

            if ($Awfif::subpl-> {l} [$subpid] [10] == $acwsposition
            ){

              $tmatchedwso = 't';
              };#if

            &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{casrelay});
            };#else
          };#else
# model the ival codelets situation in the bound complex
#
# first the earlier spigrabamp may have moved the current wsposition

        $cwsposition = &movecomplex ($myli, $sldesc, 0, $abdwso);
        $Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$sldesc] [3] - $Awfif::memes->{snnh}{wsi});
        $acwsposition = awsoadr ($cwsposition);
        $Awfif::memes-> {currentwsbi} = $cws;
# ivalbtfu1

        if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($bdwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
        && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
        && ( ($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$sldesc] [3] - $Awfif::memes-> {snnh} {wsi})) != 0 )
        && (($aws = $Awfif::memes-> {currentwsbi}) != 0)
        && (($count = ipartseqcount ('onematch', $myli, ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), trwsoadr(($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), 1), \$descfits, \$conforms, $Awfif::wsbl-> {wsoh} [$aws], $Awfif::wsbl-> {wsft} [$aws],
          $Awfif::memes-> {snnh} {tokencategory}, $token,
          $Awfif::memes-> {snnh} {andcategory}, $Awfif::memes-> {snnh} {start},
          $Awfif::memes-> {snnh} {orcategory}, $Awfif::memes-> {snnh} {alternate} )>0))
        && ($conforms)
        && ($descfits)
        && (kwmccon ($cws, $Awfif::wsbl-> {wsoh}[$cws], $aws, ($Awfif::workspace-> {l} [$sldesc][2] - $Awfif::memes-> {snnh}{wsi}))) #check that the current wso is allowed in this context according to the record head can contains
        or ( ($usetrans != 0) && ($noget = 't')) #must continue the transaction
        ){#have identified this is a value structure so find the value and record it

          my ($kwwsoid, $kw);
# ivalbtrsal1
          if (($Awfif::codelet-> {l} [$myli] [37] > 0)
          && ((!defined($Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3]))
          or ($Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] == $Awfif::memes-> {snnh} {start}) )
          ){

            $Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] = $Awfif::memes-> {snnh} {incomplete};
            };#if
          $kwwsoid = ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi});
          $kw = getwsost4 ($kwwsoid);
# ivalbgowu1

          if ( (($count = ipartseqcount ('onematch', $myli, ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), trwsoadr(($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), 1), \$descfits, \$conforms, $Awfif::wsbl-> {wsoh} [$aws], $Awfif::wsbl-> {wsft} [$aws],
            $Awfif::memes-> {snnh} {tokencategory}, $Awfif::memes-> {snnh} {gowithin} )>0))
          && ($conforms)
          && ($descfits)
          ){#this may contain structures so need to go within

            $signalsubp = 't';
            $depsubs = 't';
            }; #check if may have to gowithin the string

          if ( ((!defined ($noget)) or (!$noget))
          && (($count = ipartseqcount ('onematch', $myli, ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), trwsoadr(($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), 1), \$descfits, \$conforms, $Awfif::wsbl-> {wsoh} [$aws], $Awfif::wsbl-> {wsft} [$aws],
            $Awfif::memes-> {snnh} {tokencategory}, $Awfif::memes-> {snnh} {record} )>0))
          && ($conforms)
          && ($descfits)
          ){#this is a record so it has a completion procedure

            $handlestop = '';
            }; #check if must handle the stop structure

          my ($stnws, $stnwsoid, $stnwsoidp1, $stvalue, $mkrwso, $amkrwso, $subpdesc, $foundtid, $mfoundtid, $nmatchtid, $mnmatchtid);
          $Awfif::memes-> {currentwsbi} = $cws;
          if ((!defined ($noget))
          or (!$noget)
          ){

            $catalysis = grabcodelet ($myli, $sldesc, $cws, $abdwso);
# get data from quote pair
            $stvalue = getnamefqpair ($myli, $sldesc, \$stnws, \$stnwsoid);
            };#if
# ivalbuitrau3
# may be looking after a current gowithin process it

          $foundtid = '';
          $nmatchtid = '';
# if don't get a match for the current wsposition and it is gowithin then sponsor new subprogram
#
# if there is a subprogram deployed by this specific transaction
          if ( ($subpid != 0)
          && ($nmatchtid = 't')
          && ($Awfif::subpl-> {l} [$subpid] [10] != $acwsposition)# added when setup subpid
          && ($foundtid = 't')#remember that found a transid
          && (&transalloc ($myli, $Awfif::memes-> {snnh} {casrelay}, undef(), $transid , \$transtatus) == $transid )
          && ($transtatus == $Awfif::memes-> {snnh} {incomplete}) #bcsubps transaction is not completed
          && (( ($subpdesc = findtdesc ($Awfif::wsol-> {l} [ $abdwso] [2], $Awfif::memes-> {snnh} {subprogram}, $Awfif::memes-> {snnh} {initiate}, $subpid)) == 0 ) #and the subprogram has not depolyed its report descriptor
            or (($Awfif::workspace-> {l} [$subpdesc] [2] - $Awfif::memes-> {snnh} {wsi}) != $subpid))
          ){
# mp signal the sub-program

            my ($dummy, $giveup, $p, $hiurg);
            $Awfif::memes-> {currentwsbi} = $cwsbi;
            $depsubs = 't';
            $hiurg = '';#must be defined to be used in subpinitiated
# ivalbuidsonbu1

            if ( ( ( ($Awfif::memes-> {valignifu} && (int (rand (10)) > 8)) or (!ifindupri ($myli, $sponsor, undef (), undef(), $Awfif::subpl-> {l} [$subpid] [6], $Awfif::memes-> {snnh} {subpstbinding} , $subpid, 't')) )
            or (!subpinitiated ($myli, $abdwso, $subpid, \$hiurg)) )
            && ( ($Awfif::codelet-> {l} [$myli][36] == 0)
              or (!defined ($Awfif::subpl-> {w} [ $subpid ])) or ($Awfif::subpl-> {w} [ $subpid ] == 0))#don't signal waited codelet - note should first check its an f1 of this codelet
            ){

              if ((defined ($subpid)) && ($subpid > 0)){

                if (!defined ($Awfif::subpl-> {q} [3] [$Awfif::memes-> {ivalwindex}] [$subpid ])) {

                  $Awfif::subpl-> {q} [3] [$Awfif::memes-> {ivalwindex}] [$subpid ] = 0;
                  };#if

                $p = \$Awfif::subpl-> {q} [3] [$Awfif::memes-> {ivalwindex}] [$subpid ];
                }; #if

              $hiurg = $hiurg | $Awfif::memes-> {tdfsampdo};

              &ilaunchnc ($myli, $dummy, 'cassuboppi', undef (), \$giveup, $grkwp, $grkwpr, \@$sactset,
                32, #mask out codelet-> {l} [32] i.e. {tfree}
                $usetrans,
                \$transid ,
                \$transtatus,
                $subpid, #signal sub-program
                undef (), #jhlabeli
                undef (), #jhlabeloi
                undef (), #newli
                $hiurg,
                \$$p #use pooling
                );

              if (matchaelement (\@{$Awfif::subpl-> {l} [$subpid] [11]}, $transid) == 0
              ){#no match its a new transaction

                $Awfif::subpl-> {l} [$subpid] [11][++$Awfif::subpl-> {l} [$subpid] [11][0]] = $transid;
                $Awfif::subpl-> {l} [$subpid] [12][++$Awfif::subpl-> {l} [$subpid] [12][0]] = $Awfif::tral-> {l} [$transid] [4];
                };#if

              if (($usetrans == 0)
              && (defined ($transid) && ( ($transtatus == $Awfif::memes-> {snnh} {completed}) or ($transtatus == $Awfif::memes-> {snnh} {incomplete}) ) )
              ){#record the transid

                &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, $transid, $subpid, $stransmgrid);
                $spigtransid = $transid;
                $dospigrabamp = 't';#can't see why shouldnt check for amp options at this point
                };#if
              };#if
# ivalbuif1tu3

            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
            &notgcompleted ($myli, $sponsor, teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),'t', undef (), undef(), $Awfif::subpl-> {l} [$subpid] [6], $Awfif::memes-> {snnh} {subpstbinding},
            $subpid,
            undef (), #nodebug
            undef (), #nodelayselect
            $Awfif::memes-> {tdfsampdo} #amplify delay select
            );# sponsor should be one after telomeric header
            $usedngc = 't';
            };#if still need to signal subprogram

          if ($foundtid
          ){

            $mfoundtid = 't';
            $mtranstatus = $transtatus;

            if ( ($transtatus == $Awfif::memes-> {snnh} {completed})
            ){#remove the deployment descriptor
# may still not want to reply because other subpids are still outstanding but that should have already been checked

              &maskcounter ($Awfif::memes-> {snnh}{subpdeployed}, $abdwso, undef(), $transid);
              }#if
            elsif ($transtatus == $Awfif::memes-> {snnh} {incomplete}
            ){

              $dontrep35 = 't';
              };#elsif
            }#if
          else {

            if ($nmatchtid
            ){

              $nmatchtid = '';
              };#if
            };#else

          if ($nmatchtid
          ){

            $mnmatchtid = 't';#this wso has no matching pid
            };#if
#
# now handle new gowithin

          if (((($mnmatchtid)) or (!defined($subpid)))
          && (!$tmatchedwso)
          && (defined ($signalsubp))
          && ($signalsubp)
          ){
# ivalbgowu2

            my ($subpstws, $subpstcws, $subpbwso, $asubpbwso, $subptwso, $buffer, $dummy, $giveup);
# setup the subprogram terminal wsoid - sldesc should be referencing the workspace descriptor

            &iskipw ($myli, $sldesc, $cws, $aws, $abdwso);#have to get to the terminal keyword
            $subptwso = ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes->{snnh}{wsi});
# setup the subprogram start wsoid
            $Awfif::memes-> {currentwsbi} = $stnws;
            $stnwsoidp1 = trwsoadr ($stnwsoid,1);
            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
            $buffer = '';
            for ($i = trwsoadr ( $Awfif::codelet-> {l} [$myli] [21],2);
            $i <= trwsoadr ($Awfif::codelet-> {l} [$myli] [22], -2);
            $i = trwsoadr ($i,1)
            ){
# ivalbgowu3

              $buffer = $buffer . '<' . getwsost4 ($i) . '>';
              };#for

            if ($Awfif::codelet-> {l} [$myli] [36] == 0
            ){

              $buffer = $buffer . '<subprogram><sequence><integration>';
              }#if
            else {

              $buffer = $buffer . '<sequence><integration>';
              if ( ((findtdesc ($Awfif::wsol-> {l} [ $abdwso] [2], $Awfif::memes-> {snnh} {initgw}, $Awfif::codelet-> {l} [$myli] [36] )) == 0)
              ){

                $Awfif::wsol-> {l} [$abdwso][2]
                = setupdesc ( $Awfif::codelet-> {l}[$myli][36],
                  ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][36]), #
                  $Awfif::memes-> {snnh} {initgw},
                  $Awfif::wsol-> {l} [$abdwso] [2],
                  $abdwso);
                };#if
              };#else

            $subpstws = inewstws ($myli, \$buffer, \$grkwp, $grkwpr, $sponsor, $Awfif::memes-> {snnh} {subpstbinding} );
            $subpid = addsubp ($subpstws, $subpbwso, $acwsposition);
# ivalbreccu1
            if ($Awfif::codelet-> {l} [$myli] [36] > 0
            ){

              $Awfif::memes-> {spiglevel} [$Awfif::codelet-> {l} [$myli] [36]]++;
              $Awfif::memes-> {spiglevel} [$subpid] = 0;
              }#if
            else {

              $Awfif::memes-> {spiglevel} [$subpid] = 0;
              };#else
# ivalbsupru1
# deploy the descriptor reference for the subprogram

            $Awfif::wsol-> {l} [$abdwso][2]
            = setupdesc ( ($Awfif::memes-> {snnh} {initiation}),
                ($subpid + $Awfif::memes-> {snnh} {wsi}),
                $Awfif::memes-> {snnh} {subpref},
                $Awfif::wsol-> {l} [$abdwso] [2],
                $abdwso);
            $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$abdwso][2]] [9] = $Awfif::memes-> {subprefctr};
# ivalbgowu10
# setup a control workspace for the subprogram - in this instance will only setup the case and control workspaces since its as if we are already bound!

            $buffer = '<schema><partconstrained>';
            $subpstcws = inewstws ($myli, \$buffer, \$$kwp, $kwpr, $sponsor, $Awfif::memes-> {snnh} {subpstbinding});
            $Awfif::subpl-> {l} [$subpid][6] = $subpstcws;
            $buffer = '<' . getwsost4 ($Awfif::codelet-> {l} [$myli] [21]) . '>';
            &initschcon ($myli, \$buffer, \$$kwp, $kwpr, $sponsor, $subpstcws, $Awfif::memes-> {snnh} {subpstbinding}, $subpid);

            if ( ifindb ($myli, $sponsor, 'goalscon', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset, $subpstcws, $Awfif::memes-> {snnh} {subpstbinding}, $subpid) == 1
            ){

              my ($i, $found);
              $found = '';
              for ($i = 0; ((!$found) && ($i < $sigcount)); $i++
              ){

                if ($lomatchs[$i]
                ){#
# unless this is an operon or stbinding

                  if ( ($Awfif::jhls-> {l} [$lola[$i]][4] == $Awfif::memes-> {snnh}{subpstbinding})
                  ){

                    $Awfif::subpl-> {l} [$subpid] [5] = $lola [$i];
                    $found = 't';
                    };#if
                  };#if
                };#for
              };#if
# ivalbgowu6
# switch to subprogram's case complex workspace

            $Awfif::memes-> {currentwsbi} = $subpstws;
            if ( ifindb ($myli, $sponsor, 'subpc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset, $subpstws, $Awfif::memes-> {snnh} {subpstbinding}, $subpid) == 1
            ){

              my ($i, $found);
              $found = '';
              for ($i = 0; ((!$found) && ($i < $sigcount)); $i++
              ){

                if ($lomatchs[$i]
                ){#
# unless this is an operon or stbinding

                  if ( ($Awfif::jhls-> {l} [$lola[$i]][4] == $Awfif::memes-> {snnh}{subpstbinding})
                  ){

                    $subpbwso = $Awfif::jhls-> {l} [$lola[$i]] [8];
                    $Awfif::subpl-> {l} [$subpid] [4] = $lola [$i];
                    $Awfif::subpl-> {l} [$subpid] [3] = $subpbwso;
                    $found = 't';
                    };#if
                  };#if
                };#for
# deploy the descriptor pointing to the workspace start

              $asubpbwso = awsoadr ($subpbwso);
              $Awfif::wsol-> {l} [$asubpbwso][2]
              = setupdesc ( ($aws + $Awfif::memes-> {snnh} {wsi}),
                  ($stnwsoidp1 + $Awfif::memes-> {snnh} {wsi}),
                  $Awfif::memes-> {snnh} {wsposition},
                  $Awfif::wsol-> {l} [$asubpbwso] [2],
                  $asubpbwso);
# ivalbthbu1
# deploy the descriptor supporting histone binding in the subprograms

              $Awfif::wsol-> {l} [$asubpbwso][2]
              = setupdesc ( ($Awfif::workspace-> {l} [$histdesc] [3]),
                  ($Awfif::workspace-> {l} [$histdesc] [2]),
                  $Awfif::workspace-> {l} [$histdesc] [4],
                  $Awfif::wsol-> {l} [$asubpbwso] [2],
                  $asubpbwso);
# ivalbgowu4

              &inewlist ($myli, $subpstws, $subpbwso, $sponsor, $sldesc, \$grkwp, $grkwpr, $Awfif::memes-> {snnh} {subpstbinding}, \$amkrwso);
# ivalbgowu5

              if ( ( ($slhdesc = findtdesc ($Awfif::wsol-> {l} [ $asubpbwso] [2], $Awfif::memes-> {snnh} {listhead})) != 0 )
              && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
              ){#have identified there is a list head get the associated list link

                my ($newtransid, $catref, $catdesc);
                $slldesc = findtdesc ($Awfif::wsol-> {l} [ $asubpbwso] [2], $Awfif::memes-> {snnh} {listlink});
                &inewrcd ($myli, $subpstws, $subpbwso, $sponsor, $sldesc, $slhdesc, \$grkwp, $grkwpr, $Awfif::memes-> {snnh} {subpstbinding}, \$amkrwso);
# deploy the srcd builders casinopp descriptor

                $Awfif::wsol-> {l} [awsoadr($Awfif::wsbl-> {wsoh} [$subpstws])][2]
                = setupdesc ( ($sponsortype),
                    ($Awfif::memes-> {snnh} {casinopp} + $Awfif::memes-> {snnh} {wsi}),
                    $Awfif::memes-> {snnh} {model},
                    $Awfif::wsol-> {l} [awsoadr($Awfif::wsbl-> {wsoh} [$subpstws])] [2],
                    awsoadr($Awfif::wsbl-> {wsoh} [$subpstws]));
# ivalbgowu9
# deploy the descriptor initiating the sub-program

                $Awfif::wsol-> {l} [$asubpbwso][2]
                = setupdesc ( ($Awfif::memes-> {snnh} {start}),
                    ($subptwso + $Awfif::memes-> {snnh} {wsi}),
                    $Awfif::memes-> {snnh} {subprogram},
                    $Awfif::wsol-> {l} [$asubpbwso] [2],
                    $asubpbwso);
# deploy the descriptor detailing how to take over the cascade

                $Awfif::wsol-> {l} [$asubpbwso][2]
                = setupdesc ( ($cws + $Awfif::memes-> {snnh} {wsi}),
                    ($bdwso + $Awfif::memes-> {snnh} {wsi}),
                    $Awfif::memes-> {snnh} {initiate},
                    $Awfif::wsol-> {l} [$asubpbwso] [2],
                    $asubpbwso);
# ivalbgowu7
# deploy the descriptor terminating the sub-program

                $Awfif::wsol-> {l} [$asubpbwso][2]
                = setupdesc ( ($Awfif::memes-> {snnh} {stop}),
                    ($subptwso + $Awfif::memes-> {snnh} {wsi}),
                    $Awfif::memes-> {snnh} {subprogram},
                    $Awfif::wsol-> {l} [$asubpbwso] [2],
                    $asubpbwso);
# deploy the descriptor detailing how to report completion

                $Awfif::wsol-> {l} [$asubpbwso][2]
                = setupdesc ( ($cws + $Awfif::memes-> {snnh} {wsi}),
                    ($bdwso + $Awfif::memes-> {snnh} {wsi}),
                    $Awfif::memes-> {snnh} {completed},
                    $Awfif::wsol-> {l} [$asubpbwso] [2],
                    $asubpbwso);
# ivalbcatu1

                $catdesc = findtdesc ($Awfif::wsol-> {l} [$abdwso] [2], $Awfif::memes-> {snnh} {catalysis});
                if (($catdesc != 0)
                ){
# deploy the sub-program cat ref descriptor

                  $Awfif::wsol-> {l} [$asubpbwso][2]
                  = setupdesc ( (0),
                      ($catdesc + $Awfif::memes-> {snnh} {wsi}),
                      $Awfif::memes-> {snnh} {catref},
                      $Awfif::wsol-> {l} [$asubpbwso] [2],
                      $asubpbwso);
                  }#if
                elsif ( (($catref = findtdesc ($Awfif::wsol-> {l} [$abdwso] [2], $Awfif::memes-> {snnh} {catref})) != 0)
                ){
# deploy the sub-program cat ref descriptor

                  $Awfif::wsol-> {l} [$asubpbwso][2]
                  = setupdesc ( (0),
                      ($Awfif::workspace-> {l} [$catref] [2]),
                      $Awfif::memes-> {snnh} {catref},
                      $Awfif::wsol-> {l} [$asubpbwso] [2],
                      $asubpbwso);
                  };#elsif
# ivalbgowu8
# mp signal the sub-program

                $Awfif::memes-> {currentwsbi} = $cwsbi;
                if (!defined ($jhlabeli)
                ){

                  $jhlabeli = 0;
                  $jhlabeloi = 0;
                  };#if
                if (!defined ($Awfif::subpl-> {q} [3] [$Awfif::memes-> {ivalwindex}] [$subpid ])) {

                  $Awfif::subpl-> {q} [3] [$Awfif::memes-> {ivalwindex}] [$subpid ] = 0;
                  };#if

                &ilaunchnc ($myli, $dummy, 'cassuboppi', undef(), \$giveup, $grkwp, $grkwpr, \@$sactset,
                32, #mask out codelet-> {l} [32] i.e. {tfree}
# ivalbuitrau2
                  0,
                  \$newtransid,
                  \$transtatus,
                  $subpid, #signal sub-program
                  \$jhlabeli,
                  \$jhlabeloi,
                  undef (), #newli
                  $Awfif::memes-> {tdfsampdo},
                  \$Awfif::subpl-> {q} [3] [$Awfif::memes-> {ivalwindex}] [$subpid ] #use pooling
                  );

                $jhlabeliav = 't';
                $spigtransid = $newtransid;
                $Awfif::subpl-> {l} [$subpid] [11][++$Awfif::subpl-> {l} [$subpid] [11][0]] = $newtransid;
                $Awfif::subpl-> {l} [$subpid] [12][++$Awfif::subpl-> {l} [$subpid] [12][0]] = $Awfif::tral-> {l} [$newtransid] [4];
                $Awfif::subpl-> {l} [$subpid] [13] = $Awfif::codelet-> {l} [$myli] [20];
                $Awfif::subpl-> {l} [$subpid] [14] = $Awfif::codelet-> {l} [$myli] [21];
                &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{casrelay});
# ivalbuigrau1

# ivalbuif1tu2
                if (!$usedngc
                ){

                  $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
                  &notgcompleted ($myli, $sponsor, teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),'t', undef (), undef(), $Awfif::subpl-> {l} [$subpid] [6], $Awfif::memes-> {snnh} {subpstbinding}, $subpid,
                  undef (), #nodebug
                  undef (), #nodelayselect
                  $Awfif::memes-> {tdfsampdo} #amplify delay select
                  );# sponsor should be one after telomeric header
                  $usedngc = 't';
                  };#if
# ivalbuif1tu1
# deploy the record of the sub-program initiation

                $Awfif::wsol-> {l} [$abdwso][2]
                  = inccounter ( ($newtransid),
                    ($subpid + $Awfif::memes-> {snnh} {wsi}),
                    $Awfif::memes-> {snnh} {subpdeployed},
                    $Awfif::wsol-> {l} [$abdwso] [2],
                    $abdwso,#awso
                    undef(),#synccod
                    $newtransid,#sltype
                    ($subpid)#spto
                    );

                if ((defined ($newtransid) && ( ($transtatus == $Awfif::memes-> {snnh} {completed}) or ($transtatus == $Awfif::memes-> {snnh} {incomplete})))
                ){

                  &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, $newtransid, $subpid);#transmgrid should be undefined
                  &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {add}, $Awfif::memes-> {snnh} {assocf1}, $atelhwso, $Awfif::memes-> {snnh} {stran}, undef(), $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [37], $subpid);
                  };#elsif

                if ($Awfif::memes-> {applyactive}
                ){#now have added the assoc f1 can use spi grab amp

                  $dospigrabamp = 't';#must wait until after finish processing the record before we let another codelet in
                  };#if
# ivalbsubptrau1
# deploy the gowithin trail descriptor in the <mkwordref> wso

                $Awfif::memes-> {currentwsbi} = $cws;
                $mkrwso = $Awfif::wsbl-> {wsoh} [$cws];
                $amkrwso = awsoadr ($mkrwso);

                $Awfif::wsol-> {l} [$amkrwso][2]
                = setupdesc ( ($Awfif::memes-> {snnh} {wsi} + $subpstws),
                    ($Awfif::memes-> {snnh} {wsi} + $subpbwso),
                    $Awfif::memes-> {snnh} {gowithin}, #name refers to the wso name used to support wso life cycle
                    $Awfif::wsol-> {l} [$amkrwso] [2],
                    $amkrwso);

                &itcpdist ($Awfif::memes-> {codeleth});
                };# if head exists
              }#if find the subpws
            else {

              &break ();
              };#else
            }#if
          elsif ( ($mfoundtid)
          && (!$dontrep35)
          && (($mtranstatus == $Awfif::memes-> {snnh} {completed}))
          && (defined ($Awfif::codelet-> {l} [$myli] [35]))
          && ($Awfif::codelet-> {l} [$myli] [35] != 0)
          ){

            if ( (defined ($Awfif::memes-> {valbsubpnspcbreak}))
            && ($Awfif::memes-> {valbsubpnspcbreak})
            && ($Awfif::codelet-> {l} [$myli] [36] > 0)
            ){

              &break();
              };#if
            if ( (defined ($Awfif::memes-> {valbsubpspcbreak}))
            && ($Awfif::memes-> {valbsubpspcbreak} == $Awfif::codelet-> {l} [$myli] [36])
            ){

              &break();
              };#if
            &transalloc ($myli, $Awfif::memes-> {snnh} {casparticipant}, undef(), $Awfif::codelet-> {l} [$myli] [35], \$mtranstatus);
# ivalbtrsal2

            if (($Awfif::codelet-> {l} [$myli] [37] > 0)
            ){

              $Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] = $Awfif::memes-> {snnh} {completed};
              };#if
            }#elsif
          else {
# complete the sponsors transaction
# ivalbuitrau1

            $transtatus = 0;#report that have participated successfully
            if ( (defined ($Awfif::codelet-> {l} [$myli] [35]))
            && ($Awfif::codelet-> {l} [$myli] [35] != 0)
            && (!$dontrep35)
            ){

              if ( (defined ($Awfif::memes-> {valbsubpnspcbreak}))
              && ($Awfif::memes-> {valbsubpnspcbreak})
              && ($Awfif::codelet-> {l} [$myli] [36] > 0)
              ){

                &break();
                };#if
              &transalloc ($myli, $Awfif::memes-> {snnh} {casparticipant}, undef(), $Awfif::codelet-> {l} [$myli] [35], \$transtatus);
              };#if
# ivalbtrsal3

            if (($Awfif::codelet-> {l} [$myli] [37] > 0)
            ){

              $Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] = $Awfif::memes-> {snnh} {completed};
              };#if
            };#else
# Action the value descriptor deployment, respond to stop token, do cloneing
# ivalbdepv1

          if ((!defined ($noget))
          or (!$noget)
          ){
# deploy the value descriptor in the <mkwordref> wso
# ivalbrendu1

            my ($end);
            $Awfif::memes-> {currentwsbi} = $cws;
            $mkrwso = $Awfif::wsbl-> {wsoh} [$cws];
            $amkrwso = awsoadr ($mkrwso);

            $Awfif::wsol-> {l} [$amkrwso][2]
            = setupdesc ( ($Awfif::memes-> {snnh} {wsi} + $stnws),
                ($Awfif::memes-> {snnh} {wsi} + $stnwsoid),
                $valid,
                $Awfif::wsol-> {l} [$amkrwso] [2],
                $amkrwso);
            $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$amkrwso] [2]] [10] = $stvalue;ot 7 are used for strength
            $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$amkrwso] [2]] [11] = $kw;
            $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$amkrwso] [2]] [12] = $kwwsoid;
# check if handle stop structure

            if ($handlestop
            ){

              my ($finished);
              $finished = '';
              while (!$finished
              ){

                $Awfif::memes-> {currentwsbi} = $cws;
                if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($bdwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
                && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
                && ( ($Awfif::memes-> {currentwsbi} = ($aws = ($Awfif::workspace-> {l} [$sldesc] [3] - $Awfif::memes-> {snnh} {wsi}))) != 0 )
                && (($count = ipartseqcount ('onematch', $myli, ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), trwsoadr(($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi}), 1), \$descfits, \$conforms, $Awfif::wsbl-> {wsoh} [$aws], $Awfif::wsbl-> {wsft} [$aws],
                  $Awfif::memes-> {snnh} {tokencategory}, $token,
                  $Awfif::memes-> {snnh} {andcategory}, $Awfif::memes-> {snnh} {stop} )>0))
                && ($conforms)
                && ($descfits)
                ){#have found the stop for the value

                  $finished = 't';
                  $end = movecomplex ($myli, $sldesc, 1, $abdwso);
                  }# if
                else {

                  if (($end = movecomplex ($myli, $sldesc, 1, $abdwso)) == 0
                  ){

                    $finished = 't';
                    };#if
                  };#else
                };#while
              }# if handle stop
            else {
# move the workspace position

              $end = movecomplex ($myli, $sldesc, 1, $abdwso);
              };# else don't handle stop
# record the end of the item

            $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$amkrwso] [2]] [14] = $end;
# ivalwbcompsubu2

              &compclone ($myli);
              };#if reply to cascade sponsor/relay
# seltsttceu1

            &iskipw ($myli, $sldesc, $cws, $aws, $abdwso);
            };#if not no get
          }#if at value wsposition or supporting transaction
# conditionally do notgcompleted, do grab for catalysis etc
# seltstbldubo1
        else {# not any direct processing but may need to notgroupcomplete for relaying of other subpids


            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
            &notgcompleted ($myli, $sponsor, teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),undef(), undef (), 't',
            undef (), #stws
            undef (), #issubp
            undef (), #subp
            undef (), #nodebug
            undef (), #nodelayselect
            $Awfif::memes-> {tdfsampdo} #amplify delay select
            );# sponsor should be one after telomeric header
            $usedngc = 't';
            };#if
# ivalwbcompsubu1


            if ((!$dontrep35)
            && ($Awfif::codelet-> {l} [$myli] [35] > 0)
            ){

              $reportcaspart = 't';
              };#if there are other sponsored subpids that need support then must keep relaying

            $catalysis = grabcodelet ($myli, $sldesc, $cws, $abdwso);
            &compclone ($myli);
            };#if reply to this subpid cascade sponsor/relay
          };#else not any direct processing
# report have run so that can be grab candidate
# ivalwbrrunu1

        if ( (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abdwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )#report that codelet has run allowing it to be grabbed
        && ($Awfif::codelet-> {l} [$myli] [36] > 0)
        && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi})) > 0 )
        && (($arunningwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi})) ) > 0 )
        && ((findtdesc ($Awfif::wsol-> {l} [($arunningwso)] [2], $Awfif::memes-> {snnh} {running}, $Awfif::memes-> {snnh} {$Awfif::codelet-> {l} [$myli] [2]}, ($Awfif::codelet-> {l} [$myli] [36] + $Awfif::memes-> {snnh} {wsi}) )) == 0 )
        ){

          $Awfif::wsol-> {l} [$arunningwso][2]
            = setupdesc ( $Awfif::memes-> {snnh} {$Awfif::codelet-> {l} [$myli] [2]}, #
            ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$myli] [36]), #to match findbond
            $Awfif::memes-> {snnh} {running},
            $Awfif::wsol-> {l} [$arunningwso][2],
            $arunningwso);
          };#if

        }# if findb binderc
      else {#report error 'impossible context situation' to statement codelet

        my ($stwso, $astwso);
        $Awfif::memes-> {currentwsbi} = $cwsbi;

        if ( ( ($stwso = getmystatement ($myli, $sponsor, $grkwp, $grkwpr)) != 0)
        ){

          $astwso = awsoadr ($stwso);
          $Awfif::wsol-> {l} [$astwso][2]
          = setupdesc ( wsbasetype ( trwsoadr ($Awfif::codelet-> {l} [$myli][21],2)),
            ($Awfif::memes-> {snnh} {wsi} + $Awfif::memes-> {snnh} {error}),
            $Awfif::memes-> {snnh} {bind},
            $Awfif::wsol-> {l} [$astwso] [2],
            $astwso);
          };#if
        };#else ifindb binderc
# conditionally complete the transaction, perform spi grab amplification and apply catalysis

      if ($reportcaspart) {

        if ( (defined ($Awfif::memes-> {valbsubpspcbreak}))
        && ($Awfif::memes-> {valbsubpspcbreak} == $Awfif::codelet-> {l} [$myli] [36])
        ){

          &break();
          };#if
        if ( (defined ($Awfif::memes-> {valbsubpnspcbreak}))
        && ($Awfif::memes-> {valbsubpnspcbreak})
        && ($Awfif::codelet-> {l} [$myli] [36] > 0)
        ){

          &break();
          };#if

        &transalloc ($myli, $Awfif::memes-> {snnh} {casparticipant}, undef(), $mytransid, \$mtranstatus);
        };#if
# ivalbspgau2

      if ($dospigrabamp
      ){#the record finishing procedure has been done so do the spigrabamp

        &spigrabamp ($myli, \$$kwp, $kwpr, undef(), \$jhlabeliav, \$jhlabeli, \$spigtransid);
        $usedngc = '';#may have been reset within spigrabamp processing
        };#if

      if (($catalysis)
      && ($Awfif::memes-> {spiglvl} == 0)
      ){

        &applycodelet ($myli, $sldesc, $cws, $abdwso, \$$kwp, $kwpr, \@$sactset);
        $usedngc = '';#may have been reset within applycodelet processing
        };#if

      if ( ( ( ($depsubs) or ($subpl [0] > 1) )#added subpl check to force completed transaction scenario to sustain ngc for other subprograms. Hope its still selective enough?
      && (!$usedngc)
      && ((subpcsponsor ($myli, $sponsor)) or ($dongc)) )
      or ( (($subpl [0] <= 1) && (($Awfif::memes-> {allowspigrabamp} > 0) or ($dongc)) ) #If spigrabamp is not allowed then completed transactions will not be cleared
      && (!$usedngc) )
      ){

        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
        &notgcompleted ($myli, $sponsor, teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),undef(), undef (), 't',
          undef (), #stws
          undef (), #issubp
          undef (), #subp
          undef (), #nodebug
          undef (), #nodelayselect
          $Awfif::memes-> {tdfsampdo} #amplify delay select
          );# sponsor should be one after telomeric header
        }#if
      elsif (($Awfif::memes-> {valskngcbreak}) && ($valid == $Awfif::memes-> {snnh} {ivalue}) && ($token == $Awfif::memes-> {snnh} {value}) && (!$usedngc) && ($dontrep35)){#idea here is to see when the ivalw is failing to notgcomplete - but dontrep35 was included to avoid breaks on pre sub sponsor paths

        &break ();
        };#elsif
# exiting so release the spi stack
# ivalbreccu2

      if ( ($signalsubp)
      && ($Awfif::codelet-> {l} [$myli] [36] > 0)
      ){

        $Awfif::memes-> {spiglevel} [$Awfif::codelet-> {l} [$myli] [36]]--;
        };#if

      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#got buffer

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
# &clogstatx ();
    }# ivalbuilder1
#
sub bcsubpcevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($sponsor, $signal, $schema, $spi, $swstype, $noswstype, $sponsortype,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# subprogram completion codelet is active when the end of a subprogram workspace is detected
# checked for merged workspaces

    $noswstype = '';
    my ($cws, $bcwso, $cwsbi, $launchev, $fbinderc);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {

      $launchev = ibcsubpcevaluator1 ($myli, $sponsor, $signal, $schema, $swstype, $grkwp, $grkwpr, \@$sactset, $noswstype, \$fbinderc);
      if (($fbinderc > 0)
      ){#

        if (($launchev)
        ){

          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
# bcsubpcevalubo4
          $Awfif::memes-> {currentwsbi} = $cwsbi;
          if ((ifindupri ($myli, $sponsor))
# bcsubpcevalubo2
          && ( !( (hdescexists ($myli, $cws, $bcwso, $Awfif::memes-> {snnh} {casinopp}, $sponsortype) )
          or
          (hdescexists ($myli, $cws, $bcwso, $Awfif::memes-> {snnh} {casinsopp}, $sponsortype) ) ) )
          ){#

            $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] / $Awfif::memes-> {pappbu});
# bcsubpcevalubo3

            $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {blaunchm});
            };#else
          if (defined ($Awfif::codelet-> {l}[$myli][19])) {

            $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
            }#wsi set
          else {

            $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
            };
          $Awfif::clp-> {strategy} = "bcsubpcbuilder";
          $Awfif::clp-> {action}-> {sponsor} = $sponsor;
          $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$myli][16];
          $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$myli][18];
          $Awfif::clp-> {action}-> {ref} = $spi;
          $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$myli] [20];
          $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l} [$myli][21];
          $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$myli][22];

          &groupsinv1 ($myli, undef(), undef(), undef(), undef(), undef(), "bcsubpcbuilder", $$kwp, $kwpr, \@$sactset);
          }#if
# bcsubpcevalubo1
        else {

          if (subpstate ($Awfif::codelet-> {l} [$myli][36]) == $Awfif::memes-> {snnh} {completed}) {


      };#got buffer
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);
    }# bcsubpcevaluator1
#
sub ibcsubpcevaluator1 {
    my ($myli, $sponsor, $signal, $schema, $swstype, $kwp, $kwpr, $sactset, $noswstype, $fbinderc) = @_;#bsmodeler requires the ignored parameters for its general interface
    my ($sponsortype, $usetrans, $subpid, $dolaunch);
#
# subprogram completion codelet is active when the end of a subprogram workspace is detected
# checked for merged workspaces

    $noswstype = '';
    $dolaunch = '';
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $twso, $asponsor, $sldesc, $termdesc, $reportdesc, $cws, $bcwso, $abcwso, $cwsbi);
    $twso = trwsoadr (fgrpend ($sponsor), 1);
    $asponsor = awsoadr ($sponsor);
    $sponsortype = wsbasetype ($sponsor);

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ( ($$fbinderc = ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset) == 1)
    ){#

      $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
      $Awfif::memes-> {currentwsbi} = $cws;
# ibcsubpcetmstu1
      $usetrans = 0;#must be defined to be setup in gettmgr
      $subpid = $Awfif::codelet-> {l} [$myli] [36];
      &gettmgr ($myli, $asponsor, $Awfif::memes-> {snnh} {stran}, \$usetrans, \$subpid);
      if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso = awsoadr ($bcwso))] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
      && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
      && (($termdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {subprogram}, ($Awfif::memes-> {snnh} {stop}))) != 0 )
      && ($Awfif::workspace-> {l} [$termdesc] [2] == $Awfif::workspace-> {l} [$sldesc] [2])
      && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {completed})) != 0 )
      or ( newunmsubp ($myli, $abcwso))
      or ( ($usetrans != 0)) #must continue the transaction
      ){#launch builder
        $dolaunch = 't';
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ibcsubpcevaluatorx ret ($dolaunch)\n");
      };
    return $dolaunch
    }# ibcsubpcevaluator1
#
sub bcsubpcbsmodeler1 {
    my ($myli, $kwp, $kwpr, $sactset, $and) = @_;
    my ($salience);
# subprogram completion codelet is active when the end of a subprogram workspace is detected

    $salience = ievalbsmodeler1 ($myli, \$$kwp, $kwpr, \@$sactset, \$$and, 'ibcsubpcevaluator');
    $$and = 't';
    return $salience
    }# bcsubpcbsmodeler1
#
#
sub bcsubpcbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($sponsor, $signal, $schema, $swstype, $noswstype, $sponsortype, $usetrans, $stransmgrid, $catalysis, $reportcaspart, $transtatus,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# binder complex sub-program completion codelet monitors for the termination condition of a sub-program
# checked for merged workspaces

    $reportcaspart = '';
    $noswstype = '';
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {
      my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $twso, $asponsor, $sldesc, $cws, $bcwso, $abcwso, $cwsbi);
      $twso = trwsoadr (fgrpend ($sponsor), 1);
      $asponsor = awsoadr ($sponsor);
      $sponsortype = wsbasetype ($sponsor);

      $cwsbi = $Awfif::memes-> {currentwsbi};
      if ( (defined ($Awfif::memes-> {bcsubpcbsubpspbreak}))
      && ($Awfif::memes-> {bcsubpcbsubpspbreak} == $Awfif::codelet-> {l} [$myli] [36])
      ){

        &break();
        };#if
      if ( (defined ($Awfif::memes-> {bcsubpcbsubpnspbreak}))
      && ($Awfif::memes-> {bcsubpcbsubpnspbreak})
      && ($Awfif::codelet-> {l} [$myli] [36] > 0)
      ){

        &break();
        };#if
      if ( (ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset) == 1)
      ){#

        $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
# bcsubpcbbhu1

        &bindhistone ($myli, $cws, $bcwso);
        my ($termdesc, $reportdesc, $arunningwso, $transid, $subpid);
# bcsubpcbtmstu1
        $Awfif::memes-> {currentwsbi} = $cws;
        $transid = 0;#must be defined to be setup in gettmgr
        $subpid = $Awfif::codelet-> {l} [$myli] [36];
        $stransmgrid = gettmgr ($myli, $asponsor, $Awfif::memes-> {snnh} {stran}, \$transid, \$subpid);
        $usetrans = $transid;
        if ($transid == 0 ) {

          $transid = undef();
          $transtatus = $Awfif::memes-> {snnh} {transid};
          }#if
        else {

          $transtatus = $Awfif::memes-> {snnh} {cassponsor};#unless shift to wascassponsor
          &transalloc ($myli, $Awfif::memes-> {snnh} {cassponsor}, undef(), $transid, \$transtatus);
          };#else
# bcsubpcbtfu
# removed

        if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso = awsoadr ($bcwso))] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
        && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
        && (($termdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {subprogram}, ($Awfif::memes-> {snnh} {stop}))) != 0 )#ival deploys this for the bcsubpc when setting up the subprogram
        && ($Awfif::workspace-> {l} [$termdesc] [2] == $Awfif::workspace-> {l} [$sldesc] [2])
        && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {completed})) != 0 )#ival deploys to describe how to report completion
        or ( newunmsubp ($myli, $abcwso))
        or ( ($usetrans != 0)) #
        ){#report completion

          my ($i, @subpl);
          if ((defined ($reportdesc)) && ($reportdesc != 0)) {#try to initiate catalysis
# bcsubpcbgrabu1

            $catalysis = grabcodelet ($myli, $sldesc, $cws, $abcwso, 't');
            };#if
# bcsubpcbtrsal1
          if (($Awfif::codelet-> {l} [$myli] [37] > 0)
          && ((!defined($Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3])) or ($Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] == $Awfif::memes-> {snnh} {start}) )
          ) {

            $Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] = $Awfif::memes-> {snnh} {incomplete};
            };#if
          @subpl = listunmsubp ($myli, $abcwso);
          if ($subpl[0] > 0) {
# bcsubpcbses1

            for ($i = 1; $i <= $subpl[0]; $i++) {
              if ((defined ($subpl [$i]))
              && ($subpl [$i] > 0)
              && ((! defined ($Awfif::subpl-> {l} [$subpl [$i]][9])) or ($Awfif::subpl-> {l} [$subpl [$i]][9] == 0))
              ) {

                my ($codeletdef);
                &waitondesc ($myli, $abcwso, ($subpl [$i] + $Awfif::memes-> {snnh} {wsi}), $Awfif::memes-> {snnh} {completed}, $Awfif::memes-> {snnh} {subpref}, undef(), undef(), undef(), undef(), \$codeletdef);
                $Awfif::subpl-> {l} [$subpl [$i]][9] = $codeletdef;#syncing with descriptor
                $Awfif::codelet-> {l} [$codeletdef] [35] = $Awfif::codelet-> {l} [$myli] [35];
                $Awfif::codelet-> {l} [$codeletdef] [36] = $Awfif::codelet-> {l} [$myli] [36];
                $Awfif::codelet-> {l} [$codeletdef] [37] = $Awfif::codelet-> {l} [$myli] [37];
                };#if
              };#for
# bcsubpcdeolu1
# cwsposition has reached end of subprogram ws - write end of stream descriptor to emulate endlistkwbuilder so q deferred bcsubps, ivalw launched on gowithin from this ws, will start

            if ((defined ($termdesc))
            && ($termdesc > 0)
            && (defined ($sldesc))
            && ($sldesc > 0)
            && ($Awfif::workspace-> {l} [$term