Infrastructure amplifier
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

Schematic infrastructure amplification

Summary
This page discusses how the adaptive web framework (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
supports agent-based application's leverage of
This page reviews the catalytic impact of infrastructure on the expression of phenotypic effects by an agent.  The infrastructure reduces the cost the agent must pay to perform the selected action.  The catalysis is enhanced by positive returns. 
infrastucture amplification

A number of Smiley's amplification strategies are reviewed:
The architecture of Smiley's grab amplification is discussed.  This includes:
The mechanisms Smiley uses to limit the impact of amplification, such as crowding out and processor starvation, on other codelets operations are discussed. 
The codelets and infrastructure are included
Introduction
An adaptive web framework (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
supported agent-based program can become focused by the effects of
This page reviews the catalytic impact of infrastructure on the expression of phenotypic effects by an agent.  The infrastructure reduces the cost the agent must pay to perform the selected action.  The catalysis is enhanced by positive returns. 
infrastructure amplifiers
.  There are numerous such amplifiers which are important in the operation of all complex adaptive systems (CAS).  Smiley has codelets and infrastructure which provide its applications with infrastructure amplification. 
Locality based amplification of a schematic binder complex
For example Smiley applications often use a structural binder complex to operate on the application schematic strings.  Smiley enables amplification of this process.  The complex must become
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 by locality
with particular areas of a
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 string
.  The locality provides Smiley with the context and specificity to help the binder to selectively grab codelets as they participate in the complex so they are ready, without the normal deployment overheads needed, to participate again when
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. 
environmentally
appropriate.  This
This page reviews the catalytic impact of infrastructure on the expression of phenotypic effects by an agent.  The infrastructure reduces the cost the agent must pay to perform the selected action.  The catalysis is enhanced by positive returns. 
infrastructure amplification
is typical of complex adaptive systems (
This page introduces the complex adaptive system (CAS) theory frame.  The theory is positioned relative to the natural sciences.  It catalogs the laws and strategies which underpin the operation of systems that are based on the interaction of emergent agents. 
John Holland's framework for representing complexity is outlined.  Links to other key aspects of CAS theory discussed at the site are presented. 
CAS
).  Note that once the amplifier exerts its influence on some locality other parts of the CAS codelet
This page discusses the effect of the network on the agents participating in a complex adaptive system (CAS).  Small world and scale free networks are considered. 
network
This page reviews the inhibiting effect of the value delivery system on the expression of new phenotypic effects within an agent. 
must respond to the amplification
or wither.  Where the adaptive web framework test infrastructure (Smiley) employs amplifiers for codelet action sub-programs must participate
Smiley support for enzymatic catalysis
An enzymatic, a protein with a structure which allows it to operate as a chemical catalyst and a control switch. 
catalyst, an infrastructure amplifier.   obtains its amplification and reaction specificity from the structure, affinity and active site, on the external surface of folded proteins present amino acids which become catalytic structures.   which it creates by positioning
This page describes the Smiley infrastructure and codelets that instantiate the epiphenomena defined in the Meta file and Slipnet. 
Infrastructure sensors are introduced. 
The role of phenomena in shaping the environment is discussed. 
The focusing of forces by phenomena in Smiley is discussed. 
The Meta file association of case keywords with phenomena is included. 
The codelets and supporting functions are included. 
phenomenologically
active amino acid are the building blocks of proteins.  The 20 main variants differ by the nature of their side chain.  Some are positively charged, others negatively charged.  Some are water seeking while others are fat seeking.  The genetic code mapping of DNA base pair triplets thus specifies the primary sequence of amino-acids in any protein polymer. 
side chains to obtain the dynamics, shape and charge distribution required to lower the activation energy of a particular chemical reaction.  The catalyst obtains its control mechanisms from partitioning of the effects across components and dependence on setting of switches, such as the kinase is an enzyme which catalyzes the addition of a phosphate group to a side chain of a specific protein.  When paired with a phosphatase that targets the same protein and side chain it gives the cell a schematically controlled switching capability.  /phosphatase 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. 
controlled presence or absence of particular phosphate bonds.  In Smiley the analogous mechanism is a two part association:
Smiley simplifies the amplifier operation by associating the active mechanisms with the schematic structure.  The active enzyme is specified
Rather than oppose the direct thrust of some environmental flow agents can improve their effectiveness with indirect responses.  This page explains how agents are architected to do this and discusses some examples of how it can be done. 
indirectly
through the mapping, the mapping of DNA base triplet sequences, such as AAA and AAT, to amino-acids (AAA maps to the amino-acid lysine for example) and transcription termination sequences (TGA maps to stop transcription for example) that has currently evolved. 
of 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. 
base, a nucleotide base is the side chain purine (A or G) or pyrimidine (T or C).  A is a natural pair for T.  G pairs naturally with C.  These bases have multiple uses in cells including energy transfer, second messenger signalling as well as genetic data storage, transcription and translation.  Deacon argues that the multiple uses are significant to the emergence of evolution. 
pair triplets to amino acids. 
Smiley support for efficient routes through the Slipnet
Another form of infrastructure amplification required by adaptive web framework (AWF) is the signposting and blocking of network routes.  Particularly in the
This page describes the Copycat Slipnet. 
The goal of the Slipnet is reviewed. 
Smiley's specialized use of the Slipnet is introduced. 
The initial Slipnet network used by the 'Merge Streams' and 'Virtual Robot' agent-based applications is setup in initchemistry and is included. 
The Slipnet infrastructure and initialization functions are included. 
Slipnet
hub nodes can generate huge expansions in the number of routes through the network.  Signposting and blocking of routes by fastroute helps codelets to limit the paths they choose from. 
The architecture of Smiley's grab amplification
The ability to grab codelets is based on the presence of physical forces - analogous to the strong and weak forces that support chemical interactions - provided by Perl infrastructure.  In Smiley the forces are directed by relations and associations specified in the
This page describes the Copycat Slipnet. 
The goal of the Slipnet is reviewed. 
Smiley's specialized use of the Slipnet is introduced. 
The initial Slipnet network used by the 'Merge Streams' and 'Virtual Robot' agent-based applications is setup in initchemistry and is included. 
The Slipnet infrastructure and initialization functions are included. 
Slipnet
grabcodelet, applycodelet, and spigrabamp leverage up these basic 'physical' Smiley forces.  These functions induce the equivalent of the tertiary folding of a protein, a relatively long chain (polymer) of peptides.  Shorter chains of peptides are termed polypeptides.   which aligns the forces that operate on and through the component amino acid side chains to create a highly attractive site where reactants and products gather. 

For example a complex is set up by slocbuilder, during
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
.  As part of the complex setup slocbuilder can activate catalytic, an infrastructure amplifier.   activity with a catalysis descriptor ({catalysis} indicating catalysis in operation, or {wascatalysis}, -({wsi}) -> index of head of catalysis codelet list).

Each codelet that participates in the complex can use grabcodelet to associate its successful application with the current Workspace object type.  An assumption is that the grabbed codelets are independent and equivalent and will operate again successfully when the same keyword is encountered at the complex's latest {wsposition}.  That assumption turns out to be hard to guarantee without specialized assistance.  One of the difficult aspects is that processing state descriptors can be associated with specific operons is an addressable control structure which is used in biological cells to control access to other regions of the DNA. 
within different schemata, or different instances of the same schemata, or different subgroups of a parent, or different subpids/transids of the same schemata. 

Once a codelet has been grabbed it can be applied repeatedly (applycodelet) when the same Workspace object (WSO) keyword appears at the complex's current {wsposition}, or its evaluator recommends it be run

Sub-program specific amplification
Codelets which initiate, or sponsor sub-program cascades can use spifgrabcandidate to find schematically identical sub-programs which have all run and hence will have cloned the shells (as illustrated by ivalbuilder) that can successfully operationalize their
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 plans
.  These sub-progam cascade sponsoring codelets, for example ival (1, 2) and bcsubps (1, 2, 3, 4) use spigrabamp to grab the 'template' codelet shells and so launch 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. 
related codelets directly. 

Sub-program participants must report that they have run, to indicate that their codelet shell is available and viable.  They deploy an arunningwso descriptor to the sub-program initiator's {initiate} descriptor referenced report Workspace: WSO (as illustrated by bcsubpcbuilder). 

Special actions at sub-program completion
Codelets, such as ival, may not find that the structural context supports their operation (ivalevaluator rejects running the builder).  However, they will still be encouraged to run by spicompsub when the sub-program has described it has completed (as illustrated by ivalbuilder) so that the builder can respond to its transaction sponsor and the shell can be available to be grabbed. 

Deployment infrastructure assistance for grab/apply codelet
grab/applycodelet are assisted by the key functions in the codelet deployment infrastructure, which leverage their lines of access to
This page discusses the benefits of bringing agents and resources to the dynamically best connected region of a complex adaptive system (CAS). 
centralize
provision of the specialized services:

  • nuclabmbuilder records the jhlabels of the schematic match of the signalled sub-group codelet.  The parent schemata signal schemata and sub-group schemata are associated with the sub-group codelet. 
  • nsdepbuilder assists grab/applycodelet by adding a new 'Apply Match alternative Offspring List
    This page describes the Smiley data structures.   
    Key structures are described each of which is based on a list structure represented with an array and add and free subroutines. 
    $Awfif::amoffl
    ' element as it deploys new schemata.  Schematic matches within the Workspace of the currently deploying schemata are identified by nsdepbuilder (gmatches) and recorded in $Awfif::amoffl-> {m}. The parent {pindequiv}, signal {mindequiv} and subgroup {indequiv} schemata are recorded as descriptors in the deployed schematic string. 
  • Group scouts select salient schemata to be candidates for group completion.  They also select the most salient sub-programs. 
  • The schema deployment only becomes directly associated with a codelet with the support of groupbuilder
  • The codelet must be selected to be run by the Coderack and be
  • Made immortal and highlighted as a head index in the parent schemata's jhls entry [pindequiv] [19] => list entry setup by getcontext's idorolein $Awfif::amoffl-> {l} [$Awfif::jhls-> {l}[pindequiv] [19] ].  
Transaction services manager supporting independent and equivalent via state associations between signalling entities
In the special case of codelets that are supporting transactional 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. 
state associations between 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.  To be efficient they are low cost to produce and destroy. 
codelets and signalled sub-program actions, independence & equivalence will only be true if transaction state differences are also made codelet independent and equivalent by
Rather than oppose the direct thrust of some environmental flow agents can improve their effectiveness with indirect responses.  This page explains how agents are architected to do this and discusses some examples of how it can be done. 
indirect association
through the
This page discusses how Smiley provides deployment guarantees to its agent-based applications. 
Smiley's transaction services are reviewed. 
The complex interactions of codelets participating in a deployment cascade are discussed including: 
  • The implementation of schematic switches. 
  • The cooperative use of goal suppression.  
  • Evaluator codelets promotion of other siblings. 
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:
  • Delaying the operaton of the cascade sponsor. 
  • Delaying the notgcompleting cascade participant. 
  • Waiting for completion of parallel operations with the wait and relay service.  
The need to sustain resource pools is reviewed. 
The use of signals to coordinate siblings is described. 
The structural binding operon for the wait and relay service is included. 
The codelets and supporting functions are included.
codelet cascade
infrastructure's transaction services manager and indirect dynamic fix up of state dependent elements by igetcontext & clogstatx.  

The Smiley implementation of the transaction manager requires that applycodelet ensure that all deployed equivalents of the grabbed codelet's
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 string
are represented in the apply.  Applycodelet leverages the earlier assistance provided by nsdepbuilder, groupbuilder and idorolein to find all equivalent transactional codelet sets. 

Generalizing the grab/applycodelet associative mechanism
By using
Rather than oppose the direct thrust of some environmental flow agents can improve their effectiveness with indirect responses.  This page explains how agents are architected to do this and discusses some examples of how it can be done. 
indirection
the grab/apply amplifier can be made more generally applicable.  Other iterative codelet families that are not part of the binder complex, for example the cyclin management codelets, need an equivalent mechanism (filial assist) for the system's dynamics to remain in balance.  Filial assist depends on getcontext being a signal that the codelet has managed to start running, and so getcontext's sub-procedure idorolein can call fpiecodelet to capture the codelet details for applycodelet to use later.  Sub-programs use compclone to grab a clone of them for use in sub-program amplification.  Once a sub-program codelet find's that all the codelets it signals in that sub-program have completed it will indirectly grab a copy for all other sub-programs that have been initiated within the cascade via spigrabamp's use of spcclone

Structurally enhanced state scheduling amplification
Codelets can use the
This page describes the Smiley infrastructure and codelets that instantiate the epiphenomena defined in the Meta file and Slipnet. 
Infrastructure sensors are introduced. 
The role of phenomena in shaping the environment is discussed. 
The focusing of forces by phenomena in Smiley is discussed. 
The Meta file association of case keywords with phenomena is included. 
The codelets and supporting functions are included. 
state change scheduling phenomena
, represented by
Representing state in emergent entities is essential but difficult.  Various structures are used to enhance the rate and scope of state transitions.  Examples are discussed. 
structurally shared
descriptors, to initiate immediate scheduling to the Coderack.  This short circuits the general signalling deployment cascade, creating an amplifier.  This was used extensively for the
This page discusses a complex adaptive system (CAS) implementation of a genetic algorithm (GA), Melanie Mitchell's robot-janitor built as a set of Copycat codelets integrated using agent-based programming.  The improvement in the operation of the robots over succeeding generations of applying the GA is graphed. 

The CAS that generated, and operated the robot is reviewed, including the implementation details and codelet operational program flow, and the challenges and limitations of this implementation. 

The schematic strings which make up the robot's genotype, as well as the signals which are sent to the nucleus of the robot's agents so that the agents can deploy the appropriate response strings (which activate codelets) are listed.  The Slipnet configuration required by the system to associate the schematic strings with programmatic forces (codelets) is also listed.  The codelets and supporting perl are also listed. 

In the conclusion the limitations of the robot-janitor abstraction in studying emergence and creative evolution are discussed and alternative experimental frameworks are proposed.  One such, the schematic cell is the subject of a separate page in this web frame. 

vbot
implementation. 

As an essential part of the signalling deployment cascade nuclabmbuilder can assist in the amplification, by terminating the signal flows that have already completed the short circuit. 

This page describes the inhibitor framework provided by the adaptive web framework's (AWF) Smiley agent programming infrastructure. 
Two mechanisms are provided:
  1. Uncompetitive inhibition of group completion. 
  2. Uncompetitive inhibition of transcription factors.  
In both cases the inhibitors provide a restriction process. 
The Slipnet inhibitor descriptions are included. 
The codelets and supporting infrastructure are included. 
Inhibition
of amplified nuclear
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. 
flows provides a control technique
Transcription factors leverage this mechanism, with the assistance of nuclabmbuilder and spcclone

Scheduling access to the processor resource
The amplification also introduces the problem of how to allow other codelets to share the processor fairly.  applycodelet has a budget allocated ($Awfif::memes-> {applycount}.  Once it has consumed the budgetted allocation it, and spigrabamp calls guarded by applycount, will not amplify until the Coderack has run often enough to buildup the allocation again.  Codelets, for example semantic codelets, which conclude (for example with a call to subptrachanged) that the Coderack must have immediate access can make $Awfif::memes-> {applyactive} = '';

Crowding out of codelets
In general amplifying dynamic systems can suffer from crowding out. 
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 operators
must leverage any ability the codelets have to identify when they are crowding out other participants.  Smiley provides utilities to support the codelets in these operations: pcof1descs, ccof1descs, ccodescs, itanalyco, cletcostate;
It also
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. 
monitors the buildup of intermediates
(deployment failures) and can limit the activation of amplifiers grab/applycodelet and spigrabamp

The sub-program codelets must be specially supported within this infrastructure amplifier to ensure they are independent and equivalent by the transaction services manager
Sub-programs that support catalysis must have a {catref}-(0)-> {catalysis descriptor id} in place of the catalysis descriptor. 
The scheduling of sub-program codelets will occur when they are assessed for 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.   by a tgroupscout

The amplification is a significant leverage of strategic planning architectures.

Functions

#<!-- 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 -->
#<!-- end tag scc -->
#
sub trasetincompl {# check a subpls {l} traset for items that are not fully complete - return a list of these subpl {l} [subpid] [index] indexes
    my ($myli, $subpid, $usetmass) = @_;#
    my ($i, $it, @result, $found, $subtran);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("trasetincompl myli $myli subpid($subpid) usetmass($usetmass) ");
      };
    $result[0] = 0;

    for ($i = 1; (($i <= $Awfif::subpl-> {l} [$subpid] [11] [0])); $i++) {#check each of the transactions in this subpid
      $found = '';
      for ($it = 1; ((!$found) && ($it <= $Awfif::tral-> {i} [$Awfif::subpl-> {l} [$subpid] [11][$i]] [0])); $it++) {
        if ($Awfif::tral-> {w} [$Awfif::subpl-> {l} [$subpid] [11][$i]] [$it] == $Awfif::memes-> {snnh} {incomplete}) {

          $result [++$result [0] ] = $Awfif::subpl-> {l} [$subpid] [11][$i]; #add this transaction set to the result list
          $found = 't';#just want each set represented once
          };#if
        };#for it
      };#for i
    if ($usetmass) {

      $found = '';
      for ($it = 1; ((!$found) && ($it <= $Awfif::tral-> {i} [($subtran = getsubptransid ($myli, $subpid))] [0])); $it++) {
        if ($Awfif::tral-> {w} [$subtran] [$it] == $Awfif::memes-> {snnh} {incomplete}) {

          $result [++$result [0] ] = $subtran; #add this transaction set to the result list
          $found = 't';#just want each set represented once
          };#if
        };#for it
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("trasetincomplx ret $result[0]\n");
      };
    return @result
    }# trasetincompl
#
sub codelettmlist {# see if subpl l15 codelet type matches item in transaction not complete tral index list
    my ($myli, $i15, $subpid, $runlist) = @_;#
    my ($i, $im, $result);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr, $pr2);
      $pr = $Awfif::subpl-> {l} [$subpid] [15] [$i15];
      $pr2 = $Awfif::codelet-> {l} [$pr] [2];
      print ("codelettmlist myli $myli subpid($subpid) [i15($i15)]->$pr($pr2) runlist($$runlist[0] tral: ");
      for ($pr = 1;$pr <= $$runlist [0]; $pr++){
        $pr2 = $$runlist [$pr];
        print ("$pr2 ");
        };#for
      print (") ");
      };#if
    $result = 0;

    for ($i = 1; (($result == 0) && ($i <= $$runlist [0])); $i++) {
      for ($im = 1; (($result == 0) && ($im <= $Awfif::tral-> {i} [$$runlist [$i]][0])); $im++) {
        if ($Awfif::codelet-> {l} [$Awfif::subpl-> {l} [$subpid] [15] [$i15]] [2] eq $Awfif::tral-> {i} [$$runlist [$i]][$im]) {

          $result = $i15;
          };#if
        };#for im
      };#for i

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("codelettmlistx ");
      print ("ret ($result)");
      if ($result > 0) {
        my ($pr);
        $pr = $Awfif::codelet-> {l} [$Awfif::subpl-> {l} [$subpid] [15] [$i15]] [2];
        print ("->$pr");
        };#if
      print ("\n");
      };#if
    return $result
    }# codelettmlist
#
#<!-- start tag ds -resweb -->
#
sub trallexists {# check a subpls {l} [11] set for existance of {w} items that match clones subpl [16] item - return true if match or no definition
# if there is no subpl [16] entry then return true as clone invocation not controlled
    my ($myli, $subpid, $i15, $falseundef, $usetmass) = @_;#
    my ($result);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("trallexists myli $myli subpid($subpid) i15($i15) ");
      if (defined($falseundef)) {
        print ("falseundef ($falseundef) ");
        };
      if (defined($usetmass)) {
        print ("usetmass ($usetmass) ");
        };
      $pr = $Awfif::subpl-> {l} [$subpid] [16][$i15];
      print ("subpl_subpid_16_i15($pr) ");
      $pr = $Awfif::subpl-> {l} [$subpid] [11] [$Awfif::subpl-> {l} [$subpid] [16][$i15]];
      print ("subpl_subpid_11_subpl_subpid_16_i15($pr) ");
      };
    if ( ((defined ($Awfif::subpl-> {l} [$subpid] [16][$i15]) )
    && (defined ($Awfif::subpl-> {l} [$subpid] [11] [$Awfif::subpl-> {l} [$subpid] [16][$i15]])) )
    or (((!defined($falseundef)) or (!$falseundef)) && (!defined ($Awfif::subpl-> {l} [$subpid] [16][$i15])))
    or ((defined ($usetmass)) && ($usetmass) && (defined ($Awfif::subpl-> {l} [$subpid] [16][$i15])) && ($Awfif::subpl-> {l} [$subpid] [16][$i15] == 3) )
    ){

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

      $result = '';
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("trallexistsx ret($result)\n");
      };
    return $result
    }# trallexists
#
sub tralassoc {# returns the index of the subpl 11 that references the tral i entry that matches the string subst or returns undef if there is no match
    my ($myli, $subst, $subpid, $usetmass) = @_;#
    my ($i, $it, $result, $found, $stransid);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tralassoc myli $myli subst($subst) subpid($subpid) ");
      if ((defined ($usetmass)) ){
        print ("usetmass($usetmass) ");
        };#if
      };
# making usetmass force the use of the stransid limits the amplification potential of a usetmass setting caller like crsm
# instead can check if the subst eq usetmass in which case it will be used

    if ((defined ($usetmass))
    && ($usetmass)
    && ($usetmass ne $subst)#needed to stop subst crsmbuilder entering if
    && ($usetmass eq $Awfif::tral-> {l} [($stransid = getsubptransid ($myli, $subpid))] [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]

      $found = '';
      for ($it = 1; ((!$found) && ($it <= $Awfif::tral-> {i} [$stransid] [0])); $it++) {

        if ($Awfif::tral-> {i} [$stransid] [$it] eq $subst) {

          $result = 3; #return the equivalent of the subpl-> {l} [11] index
          $found = 't';#just want each set represented once
          };#if
        };#for
      }#if
    else {

      for ($i = 1; ((!defined($result)) && ($i <= $Awfif::subpl-> {l} [$subpid] [11] [0])); $i++) {#check each of the transactions in this subpid

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

            $result = $i; #return the subpl-> {l} [11] index
            $found = 't';#just want each set represented once
            };#if
          };#for it
        };#for i
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tralassocx ret($result)\n");
      };
    return $result
    }# tralassoc
#
#
sub schabldr {# identify if a schema should obtain a transaction id
    my ($myli, $jhlsid, $jhlssid) = @_;#
    my ($deploytra, $linki, $found, $i);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("schabldr myli $myli jhlsid $jhlsid jhlssid $jhlssid ");
      };
    $deploytra = '';
    if ( (defined ($Awfif::jhls-> {l} [$jhlsid] [18] [0]))
    && (defined ($Awfif::jhls-> {l} [$jhlssid] [6]))
    ){#

      $found = 0;
      $linki = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::jhls-> {l} [$jhlssid] [6]];
      while (($linki != 0) && (($found == 0))) {
        if (($Awfif::slipnet-> {l}[$linki][3] == $Awfif::memes-> {snnh}{evaluator}) ){

          $found = $linki;
          };#if
        $linki = $Awfif::slipnet-> {l} [$linki] [0];
        };#while
      if (($found != 0) ) {#if checking that transaction complete then true if no items are incomplete
        my ($ename, $codelet);

        $ename = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l}[$found][2]};
        $ename =~ /(.*)evaluator/;
        $codelet = $1;
        for ($i = 1; ((!$deploytra) && ($i <= $Awfif::tral-> {i} [$Awfif::codelet-> {l} [$myli] [35]] [0])); $i++) {

          if ( ($Awfif::tral-> {w} [$Awfif::codelet-> {l} [$myli] [35]] [$i] == $Awfif::memes-> {snnh} {incomplete})
          && ($Awfif::tral-> {i} [$Awfif::codelet-> {l} [$myli] [35]] [$i] =~ /$codelet/)
          ){

            $deploytra = 't';
            };#if
          };#for
        };#if
      };#if there are descriptors to check
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("schabldrx ret ($deploytra)\n");
      };
    return $deploytra
    }# schabldr
#
#
sub gmatches {
    my($myli, $matches, $i4, $matchni, $matchne, $endmatch)=@_;
    my ($cwsbi, $i3, $endmatch, $setstart);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gmathces ");
      &itcpoutput ($myli);
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
# if (@$matches [0]) {
    if (defined (@$matches [0])) {
# walk down the telomeric list for the workspace gathering matches

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

        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 telomeric group now see if it matches any of the siblings in the @$matches array

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

              $found = tsibling ($myli, $ni, $ne, $i3, \@$matches, $found, \$match);
              if ($found) {
# record the sibling to stimulate if get full set

                &kmatching ($myli, $ni, $ne, $i3, $i4, $setstart, \@$matchni, \@$matchne);
                };#if
              };#for
            if ($found) {
              $setstart = $setstart + $i4;
              };#if
# in the case of gmatches we want a list of all the matches in the telomeric list
            };#if
          $found = getntel ($myli, \$ni, \$lastni, \$presentni, $endmatch);
          };#while
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

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

    }# gmatches
#
sub tsibling {
    my($myli, $ni, $ne, $i3, $matches, $ifound, $match)=@_;
    my ($i1, $i2, $found, $cwsbi);

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {

      my ($pr, $i);
      print ("tsibling ni $ni ne $ne i3 $i3 matches[$i3]: ");
      if ( defined ($$matches[$i3])) {

        &iattoutput ($Awfif::jhls-> {l} [$$matches [$i3]] [5]);
        $pr = int ($ni);
        print ("with $pr: ");
        for ($i = trwsoadr ($ni, 1);
        $i != $ne;
        $i = trwsoadr ($i, 1)) {

          $pr = getwsost4($i);
          print ("$i($pr) ");
          };#for
        }#if
      else {

        print ("undef ");
        };#else
      };#if

    $found = $ifound;
    $i2 = $Awfif::jhls-> {l} [$$matches [$i3]][5]+1;
    for ($i1 = trwsoadr ($ni,1);
    (($i1 != $ne) && !($found) && ($$match));
    $i1 = trwsoadr ($i1,1)){

      if ($Awfif::attribs-> {l} [$i2] [3] != $Awfif::memes-> {snnh} {getwsost4 ($i1)}) {

        $$match = '';
        }#elsif
      elsif ($Awfif::attribs-> {l} [$i2 + 1] [2] == $Awfif::memes-> {snnh} {attribe}) {

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

        $i2++;
        };#else
      };#for check the telomere for a sibling match

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

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tsiblingx match ($$match) ret ($found)\n");
      };

    return ($found)
    }# tsibling
#
sub kmatching {
    my($myli, $ni, $ne, $i3, $i4, $setstart, $matchni, $matchne)=@_;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("kmatching myli $myli ni $ni ne $ne i3 $i3 i4 $i4 setstart $setstart ");
      };
# record the sibling

    my ($i5, $stopmatching);
    $$matchni[$i3 + $setstart] = $ni;
    $$matchne[$i3 + $setstart] = $ne;
# now work out if we have a full set of siblings - in which case stop matching
    $stopmatching = 't';
    for ($i5 = 0;
    (
    ($i5 < $i4));
    $i5++) {

      if (!defined ($$matchni [$i5 + $setstart])) {#some sibling is missing keep on matching

        $stopmatching = '';
        };#if
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("kmatchingx ");
      print ("matchni [$i3] $$matchni[$i3] ");
      print ("matchne [$i3] $$matchne[$i3] ");
      print ("ret ($stopmatching)\n");
      };

    return ($stopmatching)
    }# kmatching
#
sub getntel {
    my($myli, $ni, $lastni, $presentni, $endmatch)=@_;
    my ($descid, $endmatch, $found);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getntel myli $myli ");
      };
# get next telomer

    $descid = $Awfif::wsol-> {l} [awsoadr ($$ni)] [2];
    $found = '';
    $$lastni = $$presentni;
    $$presentni = $$ni;
    $$ni = 0;
    while (($descid != 0) && (!$found) && (!$endmatch)) {#search ni for telomeric descriptors

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

        $$ni = ($Awfif::workspace-> {l} [$descid] [2] - $Awfif::memes-> {snnh} {wsi});
        $found = 't';
        };# found a head
      $descid = $Awfif::workspace-> {l} [$descid] [0];
      };#while

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getntelx ni $$ni ret ($found)\n");
      };

    return ($found)
    }# getntel
#
#
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
#
#
sub grabcodelet {
    my($myli, $wspdsc, $stws, $awspwso, $linksubpl, $filialonly, $allowichar)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref, $catalysis, $st4, $exclude, $kwp, $kwpr, $char);
# 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}) {
      my ($pr);
      print ("grabcodelet myli $myli wspdsc($wspdsc) awspwso($awspwso) linksubpl($linksubpl) ");
      if ((defined ($filialonly))) {

        print ("filialonly($filialonly) ");
        };#if
      if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

        $pr = $Awfif::codelet-> {l} [$myli] [36];
        print ("sub $pr ");
        };#if
      };
    $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;
# grabcicu1
    if ( (defined ($allowichar)) && ($allowichar) && ( ($char = wsbasetype ($nwsoid)) == $Awfif::memes-> {snnh} {ichar})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $st4 = 'ichar';#special use of ichar for applycodelet use only
      } #if
    elsif ( (defined ($allowichar)) && ($allowichar) && ($char == $Awfif::memes-> {snnh} {char})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $st4 = 'char';#special use of char for applycodelet use only
      } #elsif
    elsif ( (defined ($allowichar)) && ($allowichar) && ($char == $Awfif::memes-> {snnh} {whitespace})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $st4 = 'whitespace';#special use of whitespace for applycodelet use only
      } #elsif
    else {

      $st4 = getwsost4 ($nwsoid);
      };
    $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
# grabcspcacheu2

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

      $catalysis = 't';
# if this is a do cascade codelet it should signal for only filial catalysis
      $exclude = '';
# grabctrmgru1
      if ((defined ($filialonly)) && ($filialonly)) {

        $exclude = 't';
        };#if
# grabcmst4u1

      if ( ( ( (!defined ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$st4})) or ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$st4} == 0)) && (!$exclude) )
      ) {

        my ($currentdefh);
        $Awfif::clp = ();
        $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$myli][3];
        $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}-> {wse} = $Awfif::codelet-> {l} [$myli][22];
        $currentdefh = $Awfif::memes-> {codeletdef};
# grabcpoolcbru1

        &groupsinv1 ($myli, undef(), undef(), undef(), $Awfif::codelet-> {l} [$myli][17],
          undef(),
          setupprocname ($myli, undef()),
          $kwp,
          $kwpr,
          \@{$Awfif::memes-> {sactset}},
          't', #deferred
          undef (), #ignore
          undef (), #usepooling
          't'#addbreak
          );
        if ($currentdefh != $Awfif::memes-> {codeletdef}) {

          $Awfif::workspace-> {l} [$catdesc] [2] = mdefhcodelettolist ($Awfif::workspace-> {l} [$catdesc] [2]);#make this the head of a list for this $myli
# grabcr34u1
# grabcspcacheu1
          if (($linksubpl) && ($Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36] > 0)
          && (matchaelement (\@{$Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]] [15]}, $Awfif::workspace-> {l} [$catdesc] [2]) == 0) # its not already deployed to this subpid
          && (!codelettypeinsub ($Awfif::workspace-> {l} [$catdesc] [2], $Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]))
          ) {#record the use in subpl

            $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]] [15][(++$Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]] [15] [0])] = $Awfif::workspace-> {l} [$catdesc] [2];
            }#if
          else {

            $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]]-> {typecodeleta} {$st4} = $Awfif::workspace-> {l} [$catdesc] [2];#associate the binder complex current ws string with the builder codelet
            $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]]-> {codelettypea} {$Awfif::workspace-> {l} [$catdesc] [2]} = $st4;#associate the binder complex current ws string with the builder codelet
            };#else
          };#if
        };#if
      };#if catalysis setup

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("grabcodeletx ret ($catalysis)\n");
      };
    return $catalysis
    }# grabcodelet
#
#<!-- start tag ds -resweb -->
#
sub applycodelet {
    my($myli, $wspdsc, $stws, $awspwso, $kwp, $kwpr, $sactset, $filialonly, $framei, $vbworld)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref, $s4, $notebmyli, $notecindex, $lwsoid, @depcodelets, $applyfailed, $ldesc, $lvbty, $loktomdesc, $loktom);
# 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 ("applycodelet myli $myli wspdsc $wspdsc awspwso $awspwso ");
      if ((defined ($filialonly))) {

        print ("filialonly($filialonly) framei($framei) vbworld($vbworld) ");
        };#if
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    if ($Awfif::memes-> {spiglvl} == 0) {#don't apply codelet in middle of spi grab amp

    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    $lwsoid = $nwsoid;
    if ((defined ($filialonly)) && ($filialonly) && (defined ($framei))
    ){

      $ldesc = $Awfif::framel-> {l} [$Awfif::workspace-> {l} [$framei] [3]] [4];
      }#if
    elsif ((defined ($filialonly)) && ($filialonly) && (defined ($vbworld)) && ($vbworld)
    ){

      $lvbty = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
      $loktomdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {oktomove});
      $loktom = $Awfif::workspace-> {l} [$loktomdesc] [2];
      }#if
    elsif ((defined ($filialonly)) && ($filialonly)
    ){
      &break ();#if use filial only must have specified framei
      };#elsif
    $applyfailed = '';
    $depcodelets [0] = 0;
    $aws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $stws;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};

    $notebmyli = $Awfif::memes-> {breakmyli};
    $notecindex = $Awfif::memes-> {bmbcindex};
# applycatru1
    $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});
      };
# applycshareu1
    if (($catdesc != 0)
    && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))
    && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
    && ($Awfif::memes-> {applycount} >= $Awfif::memes-> {applycth})
    ) {

      $Awfif::memes-> {applyactive} = 't';
      $Awfif::memes-> {applycount}--;
      }#if
    elsif (($catdesc != 0)
    && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))
    && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
    && ($Awfif::memes-> {applycount} <= $Awfif::memes-> {applycmin})
    ) {

      $Awfif::memes-> {applyactive} = '';
      $Awfif::memes-> {applycount}--;
      }#elsif
    elsif (($catdesc != 0)
    && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))
    && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
    ){

      $Awfif::memes-> {applycount}--;
      };#else
# if catalysis enabled try to launch any associated codelet


      my ($codelet);
      $Awfif::memes-> {currentwsbi} = $aws;
      if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
# drive the apply process

# applycicu1
      while (($Awfif::memes-> {applyactive})
      && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))#true implies amplifiers are impacting deployments and should stop
      && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
      && (!$applyfailed)
      && (((defined ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {($s4 = setups4 (\$nwsoid, $wspdsc) )}))
      && ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4} != 0)
      && ((!defined ($filialonly)) or (!$filialonly)))
      or ((defined ($filialonly)) && ($filialonly)))
# applyctrmgru1
      ) {#associate the binder complex current ws string with the builder codelet

        my (@applylist, $i, $pindesc, $p);
        if ( ($nwsoid != $lwsoid)
        or ((defined ($filialonly)) && ($filialonly) && ((!defined($vbworld)) && ($ldesc != $Awfif::framel-> {l} [$Awfif::workspace-> {l} [$framei] [3]] [4])) )
        or ((defined ($filialonly)) && ($filialonly) && ((defined($vbworld)) && (($lvbty != ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi})) or ($loktom ne $Awfif::workspace-> {l} [$loktomdesc] [2])) ) )# y has moved or oktomove changed
        ){

          $depcodelets[0] = 0;
          $lwsoid = $nwsoid;
          if ((defined ($filialonly)) && ($filialonly) && (!defined($vbworld))
          ){

            $ldesc = $Awfif::framel-> {l} [$Awfif::workspace-> {l} [$framei] [3]] [4];
            }#if
          elsif ((defined ($filialonly)) && ($filialonly) && ($vbworld)
          ){

            $lvbty = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
            $loktom = $Awfif::workspace-> {l} [$loktomdesc] [2];
            };#elsif
          };#if
# applycshareu2
        if ($Awfif::memes-> {applycount} <= $Awfif::memes-> {applycmin}) {

          $Awfif::memes-> {applyactive} = '';
          }
        else {

          $Awfif::memes-> {applycount}--;
          };

        $Awfif::workspace-> {l} [$catdesc] [3] = 1;#note that am within applycodelet
# Build a list of potential candidates to apply
        $applylist [0] = 0;
        if ( ((!defined ($filialonly)) or (!$filialonly))
        && (defined ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}))
        && (notapplied ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}, \@depcodelets) == 0)
        ){

          $applylist [++$applylist [0]] = $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4};
          };#elsif
# applyctrmgru2

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

        if ( ( ( ((defined ($filialonly)) && ($filialonly)) && (($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli] [21], -1))] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 ) )
        or ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($Awfif::codelet-> {l} [$Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}] [21], -1))] [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 brothers and sisters
        ){
# loop through the children looking for the one with a match for awsoadr codelet [21]

          my ($gotit, $linki, $only, $filcount, $filappcount, $roledout);
          $gotit = 0;
          $filcount = 0;
          $filappcount = 0;
          $only = '';
          $linki = $Awfif::jhls-> {l} [$p][19];#head of this amoff sub list

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

            my ($filial, $f1, $codeletname, $and, $salience, $rand, $notdeploid);
            $filcount++;
            $filial = '';
            $rand = '';
            if (defined ($Awfif::amoffl-> {l} [$linki] [6])) {#setup for filial assist
# applycfassu1

              $filial = 't';
              $Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$linki] [6] ] [2] =~ /^(.+)*builder/i;
              $f1 = $1;
              $codeletname = $f1 . 'bsmodeler';
              };#if
            no strict 'refs';
            if ( ((!defined ($filialonly)) or (!$filialonly))
            && ($Awfif::amoffl-> {l} [$linki] [4] == awsoadr (trwsoadr ($Awfif::codelet-> {l} [$Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}] [21], -1)) )
            ) {

              $gotit = $linki;
              $filappcount++;
              }#elsif

            elsif (($filial)
            && ($f1)
            && (defined($Awfif::memes-> {binds}-> {$codeletname}))
# must role out the caller myli, setup the subpid and then the called procedure must role in the subpid specific transaction managed data of this codelet shell and then role it out again
            && (($roledout = idoroleout ($myli)))
            && (($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$linki] [6]][36] = $Awfif::codelet-> {l} [$myli] [36]) == $Awfif::codelet-> {l} [$myli] [36])
            && ( ($salience = $Awfif::memes-> {binds}-> {$codeletname}-> ($Awfif::amoffl-> {l} [$linki] [6], $kwp, $kwpr, \@sactset, \$and)) == $Awfif::memes-> {bsalient} )
            && ($rand = 't')
            && ($and)
            && (($notdeploid =(notapplied ($Awfif::amoffl-> {l} [$linki] [6], \@depcodelets)) == 0))
            && ((notapplied ($Awfif::amoffl-> {l} [$linki] [6], \@applylist) == 0))
            ) {#add salient brothers and sisters to applylist

              $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$linki] [6];
              $filappcount++;
              if ( ((defined ($filialonly)) && ($filialonly))
              && ($gotit == 0)
              ){#for filial only can make any of the evaluators that return salient the gotit

                $gotit = $linki;
                };#if
              }#elsif
            elsif (($filial)
            && ($rand)
            && (!$and)
            && ($notdeploid == 0)
            ) {#add salient only codelet

              $applylist [0] = 0;
              $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$linki] [6];
              $only = 't';
              };#elsif
            if ($roledout) {

              &idorolein ($myli, $Awfif::codelet-> {l} [$myli] [21]);
              $roledout = '';
              };#if
            $linki = $Awfif::amoffl-> {l} [$linki] [0];
            };#while
          if ($gotit != 0) {
# add each item in the match list to the applylist

            if ((!defined($Awfif::amoffl-> {l}[$gotit] [2]))) {#shift from apply to deploy

              $Awfif::memes-> {applycount} = 0;
              };#elsif
            if (($Awfif::memes-> {newdep} != 0)) {#shift from apply to deploy

              $Awfif::memes-> {newdep}--;
              };#if
            for ($i = 0; $i < $Awfif::amoffl-> {l}[$gotit] [2]; $i++) {#look through list of matching codelets - from which myli should have been excluded
# applyctrmgru3

              if (defined ($codelet = fpiecodelet ($myli, $Awfif::memes-> {currentwsbi}, $Awfif::amoffl-> {m} [$gotit] [$i]))
              && ((notapplied ($codelet, \@applylist) == 0))
              ){

                if ( ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($Awfif::codelet-> {l} [$codelet] [21], -1))] [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 brothers and sisters
                ){
# loop through the children looking for the one with a match for awsoadr codelet [21]

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

                    my ($filial, $f1, $codeletname, $and, $salience, $rand, $notdeploid);
                    $filcount++;
                    $filial = '';
                    $rand = '';
                    $filcount++;
                    if (defined ($Awfif::amoffl-> {l} [$flinki] [6])) {#setup for filial assist

                      $filial = 't';
                      $Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6] ] [2] =~ /^(.+)*builder/i;
                      $f1 = $1;
                      $codeletname = $f1 . 'bsmodeler';
                      };#if
# applycmdfu1

                    if (($filial)
                    && ($f1)
                    && (defined($Awfif::memes-> {binds}-> {$codeletname}))
                    && ((($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] > 0) && ($Awfif::codelet-> {l} [$myli] [36] > 0)) or (($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] == 0) && ($Awfif::codelet-> {l} [$myli] [36] == 0))) #subprogram schematic codelets cant be used for non sub-program execution
# must role out the caller myli, setup the subpid and then the called procedure must role in the subpid specific transaction managed data of this codelet shell and then role it out again
                    && (($roledout = idoroleout ($myli)))
                    && (($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] = $Awfif::codelet-> {l} [$myli] [36]) == $Awfif::codelet-> {l} [$myli] [36])
                    && ( ($salience = $Awfif::memes-> {binds}-> {$codeletname}-> ($Awfif::amoffl-> {l} [$flinki] [6], $kwp, $kwpr, \@sactset, \$and)) == $Awfif::memes-> {bsalient} )
                    && ($rand = 't')
                    && ($and)
                    && (( !defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] ]))
                      or ((awsoadr ($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]] [21])) != $Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] ]) )
                    && (($notdeploid =(notapplied ($Awfif::amoffl-> {l} [$flinki] [6], \@depcodelets)) == 0))
                    && ((notapplied ($Awfif::amoffl-> {l} [$flinki] [6], \@applylist) == 0))
                    ) {#add salient brothers and sisters to applylist

                      $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$flinki] [6];
                      $filappcount++;
                      }#elsif

                    elsif (($filial)
                    && ($rand)
                    && (!$and)
                    && ($notdeploid == 0)
                    ) {#add salient only codelet

                      $applylist [0] = 0;
                      $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$flinki] [6];
                      $only = 't';
                      };#elsif
                    if ($roledout) {

                      &idorolein ($myli, $Awfif::codelet-> {l} [$myli] [21]);
                      $roledout = '';
                      };#if

                    $flinki = $Awfif::amoffl-> {l} [$flinki] [0];
                    };#while
                  };#if
                };#if
              };#for
            };#if
          };#if
        if ($applylist [0] > 0) {

          $codelet = $applylist [1 + int (rand($applylist [0]))];
          $depcodelets [++$depcodelets [0] ] = $codelet;
          $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$codelet] [19] ;
          if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};

          &countcdel ($codelet, 1);# count the nominal deletion
# applyctrmgru5
          &idoroleout ($myli);
          no strict 'refs';

          $Awfif::memes-> {breakmyli} = 0;
          $Awfif::memes-> {bmbcindex} = 0;
          if (!defined ($Awfif::memes-> {binds}-> {$Awfif::codelet-> {l} [$codelet] [2]})) {

            break ();
            $applyfailed = 't';
            }#if
          else {

            &ucsehist ($Awfif::codelet-> {l} [ $codelet ] [2]);
            $Awfif::codelet-> {l} [$codelet][36] = $Awfif::codelet-> {l} [$myli] [36];#ensure the subpid is setup correctly
            $Awfif::codelet-> {l} [$codelet][37] = mapsubtotmgrid (awsoadr (trwsoadr($Awfif::codelet-> {l} [$codelet] [21],-1)), $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$codelet] [36]);#ensure the subpid is setup correctly
# applcfreepu1
            $Awfif::memes-> {cruna}[ ++$Awfif::memes-> {cruna}[0] ] = $codelet;#protect the running codelet from freecodelet
            $Awfif::memes-> {binds}-> {$Awfif::codelet-> {l} [$codelet] [2]}-> ($codelet, \$$kwp, $kwpr, \@$sactset);
            $Awfif::memes-> {cruna}[ $Awfif::memes-> {cruna}[0]-- ] = undef();
            };#else

          $Awfif::memes-> {breakmyli} = 0;
          $Awfif::memes-> {bmbcindex} = 0;
# applyctrmgru4
          &idorolein ($myli, $Awfif::codelet-> {l} [$myli] [21]);
          }#if
        else {

          if ( (defined ($Awfif::memes-> {applycfbreak}))
          && ($Awfif::memes-> {applycfbreak} )
          ){

            &break();
            };#if
          $applyfailed = 't';
          };#else
        $Awfif::workspace-> {l} [$catdesc] [3] = 0;#note that am not within applycodelet
        $Awfif::memes-> {currentwsbi} = $aws;

        if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
        };#while
      };#if catalysis setup

      };#if no spi grab amp

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    $Awfif::memes-> {breakmyli} = $notebmyli;
    $Awfif::memes-> {bmbcindex} = $notecindex;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("applycodeletx\n");
      };
    }# applycodelet
#
sub inapplycodelet {
    my($myli, $awspwso)=@_;
    my ($reply, $cwsi, $catdesc, $catref);
# 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 ("inapplycodelet myli $myli awspwso($awspwso) ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $reply = 0;
    $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 (($catdesc != 0) && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)) {#active catalysis but not in apply

      $reply = '1';
      }#if catalysis setup
    elsif (($catdesc != 0) && ($Awfif::workspace-> {l} [$catdesc] [3] != 0)) {#in apply

      $reply = '2';
      };#if catalysis setup

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

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("inapplycodeletx ret($reply)\n");
      };
    return $reply
    }# inapplycodelet
#
sub setups4 {
    my($nwsoid, $wspdsc)=@_;
    my ($result, $char, $cwsi);
# setup st4 for applycodelet using the convention matches in getcodelet

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

    $$nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    if ( ( ($char = wsbasetype ($$nwsoid)) == $Awfif::memes-> {snnh} {ichar})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $result = 'ichar';#special use of ichar for applycodelet use only
      } #if
    elsif ( ($char == $Awfif::memes-> {snnh} {char})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $result = 'char';#special use of char for applycodelet use only
      } #elsif
    elsif ( ($char == $Awfif::memes-> {snnh} {whitespace})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $result = 'whitespace';#special use of char for applycodelet use only
      } #elsif
    else {

      $result = getwsost4 ($$nwsoid);
      };#else

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("setups4x nwsoid ($$nwsoid) ret ($result)\n");
      };
    return $result
    }# setups4
#
#<!-- end tag ds -->
#<!-- start tag dli -->
#
sub relcodelets {
    my($myli, $wspdsc, $stws, $awspwso)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref);
# 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 ("relcodelets myli $myli wspdsc $wspdsc awspwso $awspwso ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    $aws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $stws;
# relcatru1
    $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 release & free any grabbed codelets

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

      while (($Awfif::workspace-> {l} [$catdesc] [2] != 0)) {#associate the binder complex current ws string with the builder codelet

        my ($hcodelet);
        $hcodelet = $Awfif::workspace-> {l} [$catdesc] [2];
        $Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [34] = 0;#this codelet can now be freed by freecodelet
        $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {codelettypea} {$Awfif::workspace-> {l} [$catdesc] [2]}} = undef ();#dis-associate the binder complex current ws string with the builder codelet
        $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {codelettypea} {$Awfif::workspace-> {l} [$catdesc] [2]} = undef ();#dis-associate the binder complex current ws string with the builder codelet
        $Awfif::workspace-> {l} [$catdesc] [2] = mhcodelettoactltail ($Awfif::workspace-> {l} [$catdesc] [2]);#move the codelet to the head of the catalysis list
        &freecodelet ($hcodelet, 1);
        };#while
      $Awfif::workspace-> {l} [$catdesc] [4] = $Awfif::workspace-> {l} [$catdesc] [4]+1;
      };#if catalysis setup

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("relcodeletsx\n");
      };
    }# relcodelets
#
#<!-- end tag dli -->
#
sub trancodelet {
    my($myli, $codelet)=@_;
    my ($found, $cwsi);
# check if this codelet has transids in its schemata
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("trancodelet myli $myli codelet $codelet ");
      };
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$codelet] [20];

    $found = '';
    my ($sponsor, $signal, $schema, $swstype, $noswstype, $sponsortype, $tidesc,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# checked for merged workspaces

    $noswstype = '';
    if (getcontext ($codelet, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {
      my ($asponsor, $twso);
      $twso = trwsoadr (fgrpend ($sponsor), 1);
      $asponsor = awsoadr ($sponsor);
      $sponsortype = wsbasetype ($sponsor);

      if ( (findcounter ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {transid}, \$tidesc) ) ){

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

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("trancodeletx ret ($found)\n");
      };
    return $found
    }# trancodelet
#
#
sub fillsched {
    my($myli, $ws, $athwso, $fpielinki)=@_;
    my ($cwsi, $pindesc, $p, $codelet);
# the fillial schedular checks the children of some parent for salience model feedback from the codelet bsmodeler
# if a codelet has not bsmodeler the salience is assumed to be 0 (don't include)

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fillsched myli $myli ws $ws athwso $athwso ");
      };
    $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 ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fillschedx ");
      if (defined ($$fpielinki)) {
        print (" fpielinki $$fpielinki ");
        };#if
      print ("ret ($codelet)\n");
      };
    return $codelet
    }# fillsched
#
#<!-- start tag scc -->
#
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 -->
#<!-- end tag scc -->
#
sub tracesga {

    my ($myli, $grabbed, $jhlabeli, $codelet, $i15, $i18)=@_;
# output tracing for spigrabamp control structures
#
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {

      my ($pr15, $pr18, $pr);
      if ((defined($grabbed)) && ($grabbed > 0)) {
        $pr15 = $Awfif::codelet-> {l} [$Awfif::subpl-> {l} [ ( $Awfif::workspace-> {l}[$grabbed] [2] ) ] [15][$i15]] [2];
        }#if
      elsif ((defined ($codelet)) && ($codelet > 0)) {
        $pr15 = $Awfif::codelet-> {l} [$Awfif::subpl-> {l} [ ( $codelet ) ] [15][$i15]] [2];
        };#else
      $pr18 = $Awfif::jhls-> {l} [$jhlabeli][18][$i18];
      $pr = $Awfif::codelet-> {l} [$myli] [2];
      if ((defined($grabbed)) && ($grabbed > 0)) {
        print ("grabbed(subpl $Awfif::workspace->{l}[$grabbed][2] [15][$i15]->$pr15) should eq jhls($i18:$pr18) & ne codelet($pr)\n");
        }#if
      elsif (defined ($grabbed)) {
        print ("bad grabb (0) cant eq jhls($i18:$pr18) & ne codelet($pr)\n");
        }#elsif
      elsif ((defined ($codelet)) && ($codelet > 0)) {
        print ("codelet(subpl $codelet [15][$i15]->$pr15) should eq jhls($i18:$pr18) & ne codelet($pr)\n");
        };#else
      };#if
    }# tracesga
#
#
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
#
#<!-- start tag ds -resweb -->
#
sub addamoff {
# setup the structures to support linked details of applycodelet match sets
    my ($nucstwso, $amtelhawso, $slinkh) = @_;#
    my ($nslinkh);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addamoff nucstwso $nucstwso");
      print ("amtelhawso $amtelhawso slink $slinkh ");
      };
    $nslinkh = addhli ($slinkh, \$Awfif::amoffl);
# setup the links data

    $Awfif::amoffl-> {l} [$nslinkh][2] = undef();#count of matches will be undef until scan for matches
    $Awfif::amoffl-> {l} [$nslinkh][3] = $nucstwso;
    $Awfif::amoffl-> {l} [$nslinkh][4] = $amtelhawso;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addamoffx ret $nslinkh\n");
      };

    return $nslinkh
    }# addamoff
#
#<!-- end tag ds -->
#
sub freeamoff {
    my ($cslnk) = @_;
#
# checked for merged workspaces

# move the amoff element to the inactive list
    my ($plink);
    $plink = freeli ($cslnk, \$Awfif::amoffl);
    $Awfif::amoffl-> {l} [$cslnk] [2] = undef();
    $Awfif::amoffl-> {l} [$cslnk] [3] = 0;
    return $plink
    }#freeamoff
#
#<!-- start tag ds -resweb -->
#
sub addamoffmatch {
# setup the {m} when get new ie schema deployment
    my ($myli, $matchwso, $ani) = @_;#
    my ($pindesc, $p, $linki, $gotit);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addamoffmatch myli $myli matchwso $matchwso ani $ani ");
      };
# $Awfif::amoffl-> {m} contains the matches
    if ( ($ani != awsoadr ($matchwso))
    && ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($matchwso)] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 )
    && (($p = ($Awfif::workspace-> {l} [$pindesc] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
    ){

      $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] == awsoadr ($matchwso)) {

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

        $Awfif::amoffl-> {m} [$gotit][$Awfif::amoffl-> {l} [$gotit] [2]++] = $ani;
        };#if
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addamoffmatchx\n");
      };

    }# addamoffmatch
#
sub freepoolc {
    my ($cslnk) = @_;
#
# checked for merged workspaces

# move the amoff element to the inactive list
    my ($head, $linki);
# if this is the only item then remove it and clear the head reference
    if ( ($Awfif::poolcl-> {l} [$cslnk] [1] == 0)
    && ($Awfif::poolcl-> {l} [$cslnk] [0] == 0)
    ){

      $head = freehli ($cslnk, \$Awfif::poolcl);
      $Awfif::poolcl-> {l} [$cslnk] [2] = undef();
      }#if
# else if this is the tail item transfer its pooling count to the previous item and then remove the tail item
# else if this is any other item then just remove the item from the element list
    else {#return the current head item

      $linki = $Awfif::poolcl-> {l} [$cslnk] [1];
      $head = $linki;
      while ($linki != 0) {
        if ($Awfif::poolcl-> {l} [$linki] [1] != 0) {

          $head = $Awfif::poolcl-> {l} [$linki] [1];
          };#if
        $linki = $Awfif::poolcl-> {l} [$linki] [1];
        };#while

      &freehli ($cslnk, \$Awfif::poolcl);
      $Awfif::poolcl-> {l} [$cslnk] [2] = undef();
      };#else
    return $head
    }#freepoolc
#
#<!-- end tag aso -->
#<!-- 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 -->
#<!-- 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
#
#
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
#
#<!-- 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 -->
#
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
#
#<!-- end tag scc -->
#
sub spigrabamp {# amplify sub-programs via grab
    my($myli, $kwp, $kwpr, $nsubpid, $jhlabeliav, $jhlabeli, $transid, $usetmass)=@_;
    my ($result, $sponsor, $asponsor, $atelhwso, $subpid, $spiglevel, $nograb, @f1notc, @f1all, $grabbed, $cwsbi, $dontcself, @clset, $jhlabeloi, $in800, $in804, $in810, $in820, $usefree);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("spigrabamp myli $myli nsubpid($nsubpid) jhlabeliav($$jhlabeliav) jhlabeli($$jhlabeli) transid($$transid) usetmass($usetmass) ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    $dontcself = '';
# manage access
    $Awfif::memes-> {spiglvl} ++;
# spigrareccu1
    if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

      $spiglevel = $Awfif::memes-> {spiglevel}[$Awfif::codelet-> {l} [$myli] [36]];
      }#if
    else {

      $spiglevel = 0;
      };#else
    if (($Awfif::memes-> {allowspigrabamp} <= 0)
    && (matchsaelement ((\@{$Awfif::memes-> {spiglc}[$spiglevel]} ), $Awfif::codelet-> {l} [$myli] [2]) == 0)# procedure should not appear twice
    && (!$Awfif::memes-> {tdfsampdo})#true implies amplifiers are impacting deployments and should stop
    ){

      $Awfif::memes-> {spiglc} [$spiglevel] [++$Awfif::memes-> {spiglc} [$spiglevel] [0]] = $Awfif::codelet-> {l} [$myli] [2];
# end of access entry control
      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
      $usefree = $Awfif::memes-> {maxusefree};
      $subpid = $Awfif::codelet-> {l} [$myli][36];
      $sponsor = $Awfif::codelet-> {l} [$myli][21];
      $asponsor = awsoadr ($sponsor);
      $atelhwso = awsoadr (trwsoadr ($sponsor, -1));
# get a list of outstanding f1 subpids initiated by this schematic codelet
      if ((defined ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2])) && ($Awfif::tmassl-> {l} [$Awfif::tmassl-> {wsot}{$atelhwso}][2] > 0)) {

        my ($found, $i);
        if ($nsubpid) {#want any subpid considered

          @f1all = getsubplist ($myli, $atelhwso);#get a list of all subpids sponsored from this schemata
          @f1notc = getsubplist ($myli, $atelhwso, 't');
          }#if
        else {#filter on subpid

          @f1all = getf1list ($myli, $atelhwso, $subpid);#are there any outstanding transactions
          @f1notc = getf1list ($myli, $atelhwso, $subpid, 't');
          };#else

        if ( ( ($grabbed = findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {grab})) == 0 )
        && ($nograb = 't')
        && ($f1all [0] > 0)
        ){#not grabbed any subpid codelets yet so see if there are any subpids that have taken over cascade
# spigracomp1

          $in800 = 't';
          if ($f1all[0] > $f1notc[0]) {#there are sub-programs that have completed
# setup the descriptor

            $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);
# find the deferred codelet shells
            for ($i = 1; ((!$found) && ($i <= $f1all [0]));$i++) {

              if (matchaelement (\@f1notc, $f1all [$i]) == 0 ){#no match its a completed
                $found = 't';
# place a reference to the codelet shells in the descriptor

                $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor][2]][2] = $f1all [$i];
                $result = 't';
                $nograb = '';
                $grabbed = $Awfif::wsol-> {l} [$asponsor][2];#since it has last recieved the grab descriptor
                };#if
              };#for
            };#if
          }#if
        elsif ((!defined ($nograb)) or (!$nograb)) {#now see if this schematic groups required codelet set are referenced in the grab. If not remove the grab and delay processing until they are all present

          my ($all, $i15, $i3, $dummy);
          $result = 't';
          $in804 = 't';
          $Awfif::memes-> {currentwsbi} = $cwsbi;
          if (!$$jhlabeliav) {

            $$jhlabeliav = iasslnc ($myli, $dummy, 'cassuboppi', $$kwp, $kwpr, \@{$Awfif::memes-> {sactset}},
              32, #mask out codelet-> {l} [32] i.e. {tfree}
              0,
              \$$transid,
              $Awfif::codelet-> {l} [$myli] [36], #signal sub-program
              \$$jhlabeli,
              \$jhlabeloi,
              $usetmass
              );
            };#if
          if ($$jhlabeliav) {
            for ($i3 = 1; (($i3 <= $Awfif::jhls-> {l} [$$jhlabeli][18][0])); $i3++){#each builder string in {18}
# mark each item as missing

              $clset[$i3] = '';
              };#for
            for ($i3 = 1; (($i3 <= $Awfif::jhls-> {l} [$$jhlabeli][18][0])); $i3++){#each builder string in {18}
              for ($i15 = 1; ((!$clset[$i3]) && ($i15 <= $Awfif::subpl-> {l} [( $Awfif::workspace-> {l}[$grabbed] [2] )] [15] [0])); $i15++ ){#each codelet in 15

                &tracesga ($myli, $grabbed, $$jhlabeli, undef(), $i15, $i3);
                if (($Awfif::codelet-> {l} [$Awfif::subpl-> {l} [ ( $Awfif::workspace-> {l}[$grabbed] [2] ) ] [15][$i15]] [2] eq $Awfif::jhls-> {l} [$$jhlabeli][18][$i3] )
                && ($Awfif::codelet-> {l} [$Awfif::subpl-> {l} [ ( $Awfif::workspace-> {l}[$grabbed] [2] ) ] [15][$i15]] [2] ne $Awfif::codelet-> {l} [$myli] [2])
                ){

                  $clset[$i3] = 't';
                  };#if
                if ( ((!defined ($nsubpid)) or (!$nsubpid) or (matchicsaelement ((\@{$Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]][15]} ), $Awfif::jhls-> {l} [$$jhlabeli][18][$i3]) != 0) )
                ){#don't clone self since its already setup

                  $dontcself = 't';
                  };#if
                };#for i15
              };#for i3
            $all = 't';#we hope
            for ($i3 = 1; (($all) && ($i3 <= $Awfif::jhls-> {l} [$$jhlabeli][18][0])); $i3++){#each builder string in {18}
# see if any item is missing
              if (!$clset[$i3]) {

                $all = '';#terminate the for
                $Awfif::workspace-> {l} [$grabbed][4]++;#make the grab a wasgrab
                $grabbed = 0;
                $nograb = 't';
                $result = '';
                };#if
              };#for
            }#if jhlabeli was assigned
          else {

            $in810 = 't';
            $all = '';#terminate the for
            $Awfif::workspace-> {l} [$grabbed][4]++;#make the grab a wasgrab
            $grabbed = 0;
            $nograb = 't';
            $result = '';
            };#problems
          };#elsif
        if ( ( ((!defined ($nograb)) or (!$nograb)) #grab descriptor presence indicates at some level the full set of codelets had run and were present for cloning
        && ($f1notc [0] > 0)
        && ($result = 't') ) #if there is an item
        ){#have already grabbed the deferred codelets so loop through each item in f1notc and if it hasn't initiated start it
# spigraclone1

          my ($spigcount, $i15, $notc, $ci15, $dummy, $nclones, $completedsome);
          $in820 = 't';
          $completedsome = '';

          if ($Awfif::memes-> {spigrabb}){&break ()};
          $spigcount = int ($Awfif::memes-> {iapplyramp} / $Awfif::memes-> {applyspigdiv});# share the spigrabamp resources between different calls
          for ($i = 1; (($spigcount-- > 0)
          && ($i <= $f1notc [0])
          );$i++) {# ------ clone into not completed list of subprograms ------

            $Awfif::memes-> {currentwsbi} = $cwsbi;
            if ($i == $Awfif::memes-> {spigsubpidb}) {&break ();};
            if (!$$jhlabeliav) {

              $$jhlabeliav = iasslnc ($myli, $dummy, 'cassuboppi', $$kwp, $kwpr, \@{$Awfif::memes-> {sactset}},
                32, #mask out codelet-> {l} [32] i.e. {tfree}
                0,
                \$$transid,
                $f1notc[$i], #signal sub-program
                \$$jhlabeli,
                \$jhlabeloi,
                $usetmass
                );
              };#if
# spigracaself1
# clone self if subpid and missing from target - which may be own subpid
            if ($Awfif::codelet-> {l} [$myli] [36] > 0){

              if (($f1notc [$i] == $Awfif::codelet-> {l} [$myli] [36]) && ($dontcself) ){

                $ci15 = 0;
                }#if
              else {

                $ci15 = compclone ($myli, $f1notc [$i], $$jhlabeli, $usetmass);
                };#else
# launch cloned self
              if ($ci15 > 0) {

                &spigralaunch ($myli, $ci15, $f1notc[$i], \$$kwp, $kwpr, $usetmass);
                };#if
              };#if
# copy any codelet that we can prove is cascaded directly from this schemata. Attempts to clone others may run into problems with the aisslnc returns
            $found = '';
# iterate until the transaction matches the builder to be sponsored
            for ($i15 = 1; ( ($i15 <= $Awfif::subpl-> {l} [ ( $Awfif::workspace-> {l}[$grabbed] [2] ) ] [15] [0])); $i15++ ){#each codelet in 15

              if (tralassoc ($myli, $Awfif::codelet-> {l} [$Awfif::subpl-> {l} [ ( $Awfif::workspace-> {l}[$grabbed] [2] ) ] [15] [$i15] ][2], $f1notc[$i], $usetmass ) > 0 ){#

                $nclones = spcclone ($myli, $sponsor, $asponsor, $$jhlabeli, $jhlabeloi, $f1notc [$i], $i15, $$transid, $grabbed, $$kwp, $kwpr, $nsubpid, \$found, $usetmass);
                };#if
              };#for i15
# get a list of the incomplete transactions for this sub-program

            my (@runlist, $ci15);
            @runlist = trasetincompl ($myli, $f1notc [$i], $usetmass );
            for ($i15 = 1; (($i15 <= $Awfif::subpl-> {l} [$f1notc[$i]][15] [0] ) && (!$Awfif::memes-> {tdfsampdo})); $i15++) {#for each new clone
# if the target codelet is in a not complete subpl set then run it even if it is marked complete

              $ci15 = codelettmlist ($myli, $i15, $f1notc[$i], \@runlist);
              if (($ci15 > 0)
              && (trallexists ($myli, $f1notc[$i], $ci15, 't', $usetmass))
              ){

# spigraapply1

                &spigralaunch ($myli, $ci15, $f1notc[$i], \$$kwp, $kwpr, $usetmass);# apply the sub-program
                }#if
              elsif (($Awfif::memes-> {spig15nexistb}) && ($ci15 > 0)) {&break ()};#If this break occurs look at codelettmlist logic and grab drift since codelettmlist and trallexists both check presence of a valid entry in tral i
              };#for i15
# recalculate the notcomplete list since the launch cascade may have completed some in the old notc list
            $notc = $f1notc [0];
            if ($nsubpid) {#want any subpid considered

            else {#filter on subpid

              @f1notc = getf1list ($myli, $atelhwso, $subpid, 't');
              };#else
            if ($notc != $f1notc [0]) {

              if ($i == $Awfif::memes-> {spigcompsb}) {&break ();};
              if ($Awfif::memes-> {spigcompnsb}) {&break ();};
              $i = 0;#restart the for loop
              $completedsome = 't';
              $Awfif::memes-> {allowspigrabamp} = 0;#proceed with amplificiation
              };#if
# spigrafreeu1
            if ((--$usefree) <= 0){

              my ($freeup, $oktodelete);
              &crsubmitcodelets ($usefree);
              $oktodelete = 1;
              $freeup = toomanycodelets ();#

              while (($freeup > 0) && ($oktodelete != 0)) {
                my ($tail);
                $tail = $Awfif::memes-> {codelett};

                $oktodelete = freecodelet ($tail);
                if ($oktodelete > 0){# 0 => stop & -1 => redo last attempt

                  $freeup--;
                  };#if
                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
                };#while

              $usefree = $Awfif::memes-> {maxusefree};
              };#if free
            };#for $i the f1notc iterator ------ end of clone into not completed list of subprograms ------
          if (!$completedsome) {

            if ($Awfif::memes-> {spigncompnsb}) {&break ();};
            $Awfif::memes-> {allowspigrabamp} = $Awfif::memes-> {allowspigrabmax};
            };#if
          }#if not setup cache yet but there are subprogram workspaces setup
        };#if
      if ($Awfif::memes-> {spiglc} [$spiglevel] [0] > 0 ) {

        $Awfif::memes-> {spiglc} [$spiglevel] [$Awfif::memes-> {spiglc} [$spiglevel] [0]--] = undef();
        };#if
      };#if access allowed
# manage exit
    if ($Awfif::memes-> {spiglvl} > 0) {

      $Awfif::memes-> {spiglvl} --;
      };#if
    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

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("spigrabampx ");
      print ("ret ");
      print ("($result)\n");
      };
    return $result
    }# spigrabamp
#
#<!-- start tag ds -resweb -->
#<!-- start tag inh -->
#
sub spcclone {# clone relevent sub-program codelets returning count of cloned codelets
    my($myli, $sponsor, $asponsor, $jhlabeli, $jhlabeloi, $subprogram, $i15, $transid, $grabbed, $kwp, $kwpr, $nsubpid, $found, $usetmass)=@_;
    my ($result, $atelhwso, $transtatus, $cwsbi, $currentdefh, $stransid);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::workspace-> {l}[$grabbed] [2];
      print ("spcclone myli $myli sponsor($sponsor) asponsor($asponsor) jhlabeli($jhlabeli) jhlabeloi($jhlabeloi) subprogram($subprogram) i15($i15) transid($transid) grabbed($grabbed ->($pr)) nsubpid($nsubpid) usetmass($usetmass) ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = 0;
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $atelhwso = awsoadr (trwsoadr ($sponsor, -1));

    my ($procname, $i3, $codelet, $atelhdr, $foundgd, $linki, $clasponsor, $ci);
# spigraclone3

    for ($i3 = 1; (($i3 <= $Awfif::jhls-> {l} [$jhlabeli][18][0])); $i3++){#each builder string in {18}
      &tracesga ($myli, $grabbed, $jhlabeli, undef(), $i15, $i3);
      if (($Awfif::codelet-> {l} [$Awfif::subpl-> {l} [ ( $Awfif::workspace-> {l}[$grabbed] [2] ) ] [15][$i15]] [2] eq $Awfif::jhls-> {l} [$jhlabeli][18][$i3] )
      && ($Awfif::codelet-> {l} [$Awfif::subpl-> {l} [ ( $Awfif::workspace-> {l}[$grabbed] [2] ) ] [15][$i15]] [2] ne $Awfif::codelet-> {l} [$myli] [2])
      && (
        (matchicsaelement ((\@{$Awfif::subpl-> {l} [$subprogram][15]} ), $Awfif::jhls-> {l} [$jhlabeli][18][$i3]) == 0) )
      ){

        my ($match, $mfound, $im1, $im2);
        $codelet = $Awfif::subpl-> {l} [( $Awfif::workspace-> {l}[$grabbed] [2] )] [15][$i15];
        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$codelet][20];
        $atelhdr = awsoadr (trwsoadr ($Awfif::codelet-> {l} [$codelet][21],-1));
# spigractficu1

        if ( (!defined ($Awfif::jhls-> {l} [$jhlabeli][17]))
        or ( ctficomp ($myli, $jhlabeli, $kwp, $kwpr, \@{$Awfif::memes-> {sactset}}) )
        ){#clone in the sub-program as long as allowed in this context
# it will have its own [s]transid matched to its subpid

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

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

              if ($Awfif::tral-> {i} [$Awfif::subpl-> {l} [$subprogram] [11][$im1]][$im2] eq $Awfif::jhls-> {l} [$jhlabeli][18][$i3] ){

                $mfound = 't';
                $match = $im1;
                };#if
              };#for im2
            };#for im1

          $transtatus = 0;
          if ((defined ($usetmass)) && ($usetmass) && ($usetmass eq $Awfif::tral-> {l} [($stransid = 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 ($stransid == 0) {#need to generate a new one acting as both the initiator (if this is the first clone of a set) and nsdepbuilder
# initiator -

              $stransid = transalloc ($myli, $Awfif::memes-> {snnh} {transid}, $jhlabeli, undef(), \$transtatus);
              };#if
            }#if
          else {
# initiator -

            if (!$mfound) {&break()};
            $stransid = $Awfif::subpl-> {l} [$subprogram] [11][$match];#match the index to the transaction to be initiated
            };#else

          $Awfif::clp = ();
          $currentdefh = $Awfif::memes-> {codeletdef};#check that a clone really was depolyed into the deferred queue
          $procname = setupprocname ($codelet, undef());
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$codelet][13];
          $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$codelet][3];
          $Awfif::clp-> {strategy} = $procname;
          $Awfif::clp-> {action}-> {sponsor} = $Awfif::codelet-> {l} [$codelet][17];
          $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$codelet][16];
          $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$codelet][18];
          $Awfif::clp-> {action}-> {ref} = $Awfif::codelet-> {l} [$codelet][4];
          $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$codelet][20];
          $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l} [$codelet][21];
          $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$codelet][22];
          $Awfif::clp-> {action}-> {wsoname} = $Awfif::codelet-> {l} [$codelet][25];
          $Awfif::clp-> {action}-> {jhlabeli} = $jhlabeli;
          $Awfif::clp-> {action}-> {jhlabeloi} = $jhlabeloi;
          $Awfif::clp-> {action}-> {transid} = $stransid;
          if (($Awfif::memes-> {checktransidnz})
          &&($Awfif::clp-> {action}-> {transid} == 0)
          && (!mysubtrancomp ($myli, findsubpicnm ($myli, $subprogram, $procname), $procname))
          ){

            &break ();
            };#if
          $Awfif::clp-> {action}-> {subpi} = $subprogram;
          &groupsinv1 ($codelet, undef(), undef(), undef(), undef(),undef(), $procname, $kwp, $kwpr, \@{$Awfif::memes-> {sactset}},
            't', #deferred
            undef (), #ignore0wsoname
            undef (), #usepooling
            't' #addbreak
            );
          if ($currentdefh != $Awfif::memes-> {codeletdef}) {

            $$found = 't';
            $Awfif::subpl-> {l} [$subprogram][15] [++$Awfif::subpl-> {l} [$subprogram] [15] [0]] = ($ci = mdefhcodelettolist (0));
# spigraclu161

            $Awfif::subpl-> {l} [$subprogram][16] [ $Awfif::subpl-> {l} [$subprogram] [15] [0]] = tralassoc ($myli, $Awfif::codelet-> {l} [$ci] [2], $subprogram, $usetmass);
            $result++;
# spigracu341
# also do nuclabmbuilder checks on transid pass on to the target

            if (!schabldr ($ci, $jhlabeli, $Awfif::codelet-> {l} [$codelet][31])) {#its ok to proceed

              $Awfif::codelet-> {l}[$ci] [35] = 0;
              }#if
# add the transaction manager id setup done by the nsdepbuilder
            $Awfif::codelet-> {l}[$ci] [37] = assandmaptran ($myli, $ci, $Awfif::codelet-> {l}[$ci] [37], $atelhdr, $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l}[$ci] [36]);
# spigracu342

# add the groupstart & end transactions done by groupbuilder
# spigracgs1

            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$codelet][20];
            $foundgd = '';
            $linki = $Awfif::wsol-> {l} [($clasponsor = awsoadr ($Awfif::codelet-> {l} [$codelet][17]))][2];
            while ((!$foundgd) && ($linki != 0)) {

              if (($Awfif::workspace-> {l} [$linki] [4] == $Awfif::memes-> {snnh} {groupstart}) or ($Awfif::workspace-> {l} [$linki] [4] == $Awfif::memes-> {snnh} {wasgroupstart})) {

                $foundgd = 't';
                $Awfif::wsol-> {l} [$clasponsor][2]
                  = inccounter ( $Awfif::workspace-> {l} [$linki] [3],
                  ($Awfif::workspace-> {l} [$linki] [2]),
                  $Awfif::memes-> {snnh} {groupstart},
                  $Awfif::wsol-> {l} [$clasponsor][2],
                  $clasponsor,
                  undef (),
                  undef (),
                  undef (),
                  $Awfif::codelet-> {l}[$ci] [37],
                  $atelhdr,
                  -1); #indicate if setting a transaction managed counter
                };#if

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

            $foundgd = '';
            $linki = $Awfif::wsol-> {l} [$clasponsor][2];
            while ((!$foundgd) && ($linki != 0)) {

              if (($Awfif::workspace-> {l} [$linki] [4] == $Awfif::memes-> {snnh} {groupend}) or ($Awfif::workspace-> {l} [$linki] [4] == $Awfif::memes-> {snnh} {wasgroupend})) {

                $foundgd = 't';
                $Awfif::wsol-> {l} [$clasponsor][2]
                  = inccounter ( $Awfif::workspace-> {l} [$linki] [3],
                  ($Awfif::workspace-> {l} [$linki] [2]),
                  $Awfif::memes-> {snnh} {groupend},
                  $Awfif::wsol-> {l} [$clasponsor][2],
                  $clasponsor,
                  undef (),
                  undef (),
                  undef (),
                  $Awfif::codelet-> {l}[$ci] [37],
                  $atelhdr,
                  -1); #indicate if setting a transaction managed counter
                };#if

              $linki = $Awfif::workspace-> {l} [$linki] [0];
              };#while
            };#if new clone created
          };#clone allowed
        };#if
      };#for i3

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("spcclonex ");
      print ("ret ");
      print ("($result)\n");
      };
    return $result
    }# spcclone
#
#<!-- end tag inh -->
#<!-- end tag ds -->
#
sub spifgrabcandidate {# find a subprogram with codelets to grab - all required codelets must have run as indicated by running descriptor, but may not be complete, to return with a subpid ref
    my($myli, $arunningwso, $nsubpid, $jhlabeliav, $jhlabeli, $usetmass)=@_;
    my ($result, $sponsor, $asponsor, $atelhwso, $subpid, @f1all, $i, $cwsbi);

no strict 'refs';
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("spifgrabcandidate myli $myli nsubpid ($nsubpid) ");
      &itwsoloutput ($arunningwso);
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = 0;
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $subpid = $Awfif::codelet-> {l} [$myli][36];
    $sponsor = $Awfif::codelet-> {l} [$myli][21];
    $asponsor = awsoadr ($sponsor);
    $atelhwso = awsoadr (trwsoadr ($sponsor, -1));

# get a list of outstanding f1 subpids initiated by this schematic codelet

    my ($transid, $jhlabeloi, $dummy);
    if ($nsubpid) {#don't want to exclude by subpid

      @f1all = getsubplist ($myli, $atelhwso);#get a list of all subpids sponsored from this schemata
      }#if
    else {

      @f1all = getf1list ($myli, $atelhwso, $subpid);#get a list of all subpids sponsored from this schemata
      };
    if ($f1all [0] > 0) {

      my ($f1i);#get associated jhlabeli and jhlabeloi
      $f1i = 0;
      while ((!$$jhlabeliav) && (++$f1i <= $f1all [0])) {
        $$jhlabeliav = &iasslnc ($myli, $dummy, 'cassuboppi', undef(), undef(), \@{$Awfif::memes-> {sactset}},
          32, #mask out codelet-> {l} [32] i.e. {tfree}
          0,
          \$transid,
          $f1all [$f1i], #signal sub-program
          \$$jhlabeli,
          \$jhlabeloi,
          $usetmass
          );
        };#while
      if ($$jhlabeliav) {

        for ($i = 1; (($i <= $f1all [0])); $i++
        ){#see if there are any subpids that have completed

          if (spiareallrunning ($myli, $f1all [$i], $arunningwso, $$jhlabeli, $usetmass) > 0
          ){

            if (($result == 0)
            or ($Awfif::subpl-> {l} [$result] [15] [0] < $Awfif::subpl-> {l} [$f1all[$i] ] [15] [0])
            ){

              $result = $f1all [$i];
              };#if
            };#if
          };#for
        };#if jhlabeli has been setup
      };#if f1all > 0

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("spifgrabcandidatex ");
      print ("ret ");
      print ("($result)\n");
      };
    return $result
    }# spifgrabcandidate
#
#<!-- start tag scc -->
#<!-- 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
    $procname = setupprocname ($myli, undef());
    $codeletname = setupbuildername ($procname);
# 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
      $codeletname = setupbuildername ($procname);
# 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 -->
#<!-- 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 -->
#<!-- end tag scc -->
#
sub pcof1descs {# find the crowding out f1 descriptors of the caller and integrate them
    my($myli, $sponsor)=@_;
    my ($found, $cwsbi, $drefi, $counter, $areportwso, $listi, $reportws, $reportwso);

no strict 'refs';
    if (($Awfif::codelet-> {l} [$myli] [36] > 0)
    && ($Awfif::memes-> {pcof1descsd})
    ){#can integrate this callers f1 to the main ws

      &break ();
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("pcof1descs ");
      if ($Awfif::codelet-> {l} [$myli] [36] > 0) {#can integrate this callers f1 to the main ws

        $pr = $Awfif::codelet-> {l} [$myli] [36];
        print ("subp($pr) ");
        };#if
      $pr = $Awfif::codelet-> {l} [$myli] [2];
      print ("myli $myli caller($pr) ");
      };#if

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::codelet-> {l} [$myli] [36] > 0) {#can integrate this callers f1 to the main ws

      my ($reportdesc, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $cws, $bcwso, $abcwso);
      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);
        $reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate});
        $Awfif::memes-> {currentwsbi} = ($reportws = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi}));
        $areportwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi}));
        $Awfif::memes-> {currentwsbi} = $cws;
        $listi = $Awfif::wsol-> {l} [$abcwso][2];
        $found = 0;
        while (($found == 0) && ($listi != 0)) {

          if (($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {($Awfif::codelet-> {l} [$myli] [2] . 'f1')})
          && ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {crowdingout})
          ) {

            $found = $listi;
            $counter = ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi});
            if ($counter > 0) {

              $Awfif::workspace-> {l} [$listi] [2] = $Awfif::memes-> {snnh} {wsi};
              $Awfif::workspace-> {l} [$listi] [14] += $counter;
              };#if
            };#if

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

        if (($found > 0)
        && ($counter > 0)
        ){#perform the integration

          $Awfif::memes-> {currentwsbi} = $reportws;
          &findmdesc ($Awfif::wsol-> {l} [($areportwso = awsoadr ($reportwso))][2], ($Awfif::memes-> {snnh}{crowdingout}), $Awfif::memes-> {snnh}{($Awfif::codelet-> {l} [$myli] [2] . 'f1')}, \$drefi);
          if (defined ($drefi)){

            $Awfif::workspace-> {l} [$drefi] [2] = ($Awfif::workspace-> {l} [$drefi] [2] + $counter);
            }#if
          else {
            $Awfif::wsol-> {l} [$areportwso] [2]
            = setupmdesc ( ($Awfif::memes-> {snnh}{($Awfif::codelet-> {l} [$myli] [2] . 'f1')}),
              ($Awfif::memes-> {snnh} {wsi} + $counter), #seems like you want to start from 1
              $Awfif::memes-> {snnh} {crowdingout},
              $Awfif::wsol-> {l} [$areportwso] [2],
              $areportwso);
            };#else
          };#if found > 0
        };#if
      };#if subprogram

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("pcof1descsx counter($counter) ret ($found)\n");
      };
    return $found #
    }# pcof1descs
#
sub ccof1descs {# deploy crowding out f1 descriptors of the caller
    my($myli, $sponsor)=@_;
    my ($cwsbi, $drefi, $name, $counter);

no strict 'refs';
    if (
    ($Awfif::memes-> {ccof1descsd})
    ){#

      &break ();
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("ccof1descs ");
      if ($Awfif::codelet-> {l} [$myli] [35] > 0) {#

        $pr = $Awfif::codelet-> {l} [$myli] [35];
        print ("transid($pr) ");
        };#if
      $pr = $Awfif::codelet-> {l} [$myli] [2];
      print ("myli $myli caller($pr) ");
      };#if
    if ($Awfif::codelet-> {l} [$myli] [35] > 0) {#can find the sponsor
      $name = $Awfif::tral-> {l} [$Awfif::codelet-> {l} [$myli] [35]] [3];

      $cwsbi = $Awfif::memes-> {currentwsbi};
      my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $cws, $bcwso, $abcwso);
      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);
        &findmdesc ($Awfif::wsol-> {l} [($abcwso)][2], ($Awfif::memes-> {snnh}{crowdingout}), $Awfif::memes-> {snnh}{($name . 'f1')}, \$drefi);
        if (defined ($drefi)){

          $Awfif::workspace-> {l} [$drefi] [2]++;
          }#if
        else {
          $counter = 1;

          $Awfif::wsol-> {l} [$abcwso] [2]
          = setupmdesc ( ($Awfif::memes-> {snnh}{($name . 'f1')}),
            ($Awfif::memes-> {snnh} {wsi} + $counter), #seems like you want to start from 1
            $Awfif::memes-> {snnh} {crowdingout},
            $Awfif::wsol-> {l} [$abcwso] [2],
            $abcwso);
          };#else
        };#if
      }#if
    elsif ( ($Awfif::memes-> {ccof1descs35d})
      ){

      &break ();
      };#else

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ccof1descsx ret ($name)\n");
      };
    return $name
    }# ccof1descs
#
sub ccodescs {# deploy crowding out descriptors of the caller
    my($myli, $sponsor)=@_;
    my ($cwsbi, $drefi, $name, $counter);

no strict 'refs';
    if (
    (defined ($Awfif::memes-> {ccodescsd}))
    && ($Awfif::memes-> {ccodescsd} == 0) && ($Awfif::codelet-> {l} [$myli] [36] == 0)
    or ((defined ($Awfif::memes-> {ccodescsd})) && ($Awfif::memes-> {ccodescsd} > 0) && ($Awfif::codelet-> {l} [$myli] [36] > 0))
    ){#

      &break ();
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("ccodescs ");
      $pr = $Awfif::codelet-> {l} [$myli] [2];
      print ("myli $myli caller($pr) ");
      };#if
    $name = $Awfif::codelet-> {l} [$myli] [2];

    $cwsbi = $Awfif::memes-> {currentwsbi};
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $cws, $bcwso, $abcwso);
    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);
      &findmdesc ($Awfif::wsol-> {l} [($abcwso)][2], ($Awfif::memes-> {snnh}{crowdingout}), $Awfif::memes-> {snnh}{($name)}, \$drefi);
      if (defined ($drefi)){

        $Awfif::workspace-> {l} [$drefi] [2]++;
        }#if
      else {
        $counter = 1;

        $Awfif::wsol-> {l} [$abcwso] [2]
        = setupmdesc ( ($Awfif::memes-> {snnh}{($name)}),
          ($Awfif::memes-> {snnh} {wsi} + $counter), #seems like you want to start from 1
          $Awfif::memes-> {snnh} {crowdingout},
          $Awfif::wsol-> {l} [$abcwso] [2],
          $abcwso);
        };#else
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ccodescsx ret ($name)\n");
      };
    return $name
    }# ccodescs
#
sub itanalyco {# instantaneous analysis of crowding out
    my($myli, $sponsor, $mycounter, $f1counter)=@_;
    my ($cwsbi, $drefi, $reachedth, $name);

no strict 'refs';
    if (
    (defined ($Awfif::memes-> {itanald}))
    && ($Awfif::memes-> {itanald})
    ){#

      &break ();
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("itanalyco ");
      $pr = $Awfif::codelet-> {l} [$myli] [2];
      print ("myli $myli caller($pr) ");
      };#if
    $name = $Awfif::codelet-> {l} [$myli] [2];
    $reachedth = '';

    $cwsbi = $Awfif::memes-> {currentwsbi};
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $cws, $bcwso, $abcwso);
    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);
      &findmdesc ($Awfif::wsol-> {l} [($abcwso)][2], ($Awfif::memes-> {snnh}{crowdingout}), $Awfif::memes-> {snnh}{($name)}, \$drefi);
      if (defined ($drefi)){

        $$mycounter = $Awfif::workspace-> {l} [$drefi] [2] - $Awfif::memes-> {snnh}{wsi};
        $drefi = undef ();
        &findmdesc ($Awfif::wsol-> {l} [($abcwso)][2], ($Awfif::memes-> {snnh}{crowdingout}), $Awfif::memes-> {snnh}{($name . 'f1')}, \$drefi);
        if (defined ($drefi)
        && (($$f1counter = $Awfif::workspace-> {l} [$drefi] [2] + $Awfif::workspace-> {l} [$drefi] [14] - $Awfif::memes-> {snnh}{wsi}) > 0)
        ){

          if (($$mycounter / $$f1counter) > $Awfif::memes-> {ratcoth}) {

            $reachedth = 't';
            };
          }#if
        else {
          if ($$mycounter > $Awfif::memes-> {abscoth}) {

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

      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("itanalycox mycounter($$mycounter) f1counter($$f1counter) ret ($reachedth)\n");
      };
    return $reachedth
    }# itanalyco
#
#<!-- start tag ds -resweb -->
#
sub cletcostate {# note the codelet crowdingout state for itcpdist
    my($myli, $mycounter, $f1counter)=@_;
    my ($cwsbi);

no strict 'refs';
    if (
    (defined ($Awfif::memes-> {cletcosd}))
    && ($Awfif::memes-> {cletcosd})
    ){#

      &break ();
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("cletcostate ");
      $pr = $Awfif::codelet-> {l} [$myli] [2];
      print ("myli $myli caller($pr) ");
      };#if

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

    if ($Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} > 0){#element created so just set crowding true

      $Awfif::costatel-> {l} [ $Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} ] [2]++;
      $Awfif::costatel-> {l} [ $Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} ] [3] = 't';
      }#if
    else {#have to create element for this codelet name

      my ($linki);
      $linki = addli (\$Awfif::costatel);
      $Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} = $linki;
      $Awfif::costatel-> {l} [ $Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} ] [2]++;
      $Awfif::costatel-> {l} [ $Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} ] [3] = 't';
      };#else
    $Awfif::costatel-> {l} [ $Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} ] [4] = $mycounter;
    $Awfif::costatel-> {l} [ $Awfif::costatel-> {hash} {$Awfif::codelet-> {l}[$myli][2]} ] [5] = $f1counter;

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("cletcostatex \n");
      };
    }# cletcostate
#
#<!-- end tag ds -->
#<!-- end tag aso -->
#
sub mcrsmgrab {# model crsm grab
    my($myli, $csubpid, $transid)=@_;
    my ($cwsbi, $usegrab, $r36);

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

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {nomcrsmgrab}) {#don't do any modelling or transform

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

      $usegrab = '';
      $r36 = $Awfif::codelet-> {l} [$myli][36];
      $Awfif::codelet-> {l} [$myli][36] = $$csubpid;
      if (($$csubpid > 0)
      && ($Awfif::tral-> {i} [ $Awfif::codelet-> {l} [$myli][35] ] [0] == ($Awfif::subpl-> {l}[ $$csubpid ] [15] [0] - 1) )
      ){#model of a crsm that completed without having to run an f1

        $usegrab = 't';
        }#if
      elsif (($$csubpid > 0)
      && (defined ($Awfif::subpl-> {l} [$$csubpid] [11][0])
        && ($Awfif::subpl-> {l} [$$csubpid] [12][$Awfif::subpl-> {l} [$$csubpid] [12][0]] == $Awfif::tral-> {l} [$Awfif::subpl-> {l} [$$csubpid] [11][$Awfif::subpl-> {l} [$$csubpid] [11][0]]] [4]) )
      ){

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

          if ($Awfif::tral-> {w}[$Awfif::subpl-> {l} [$$csubpid] [11][$Awfif::subpl-> {l} [$$csubpid] [11][0]] ] [$i] == $Awfif::memes-> {snnh} {incomplete}) {

            $incomplete = 't';
            }#if
          elsif ($Awfif::tral-> {w}[$Awfif::subpl-> {l} [$$csubpid] [11][$Awfif::subpl-> {l} [$$csubpid] [11][0]] ] [$i] == $Awfif::memes-> {snnh} {terminated}) {

            $terminated = 't';
            };#if
          };#for
        if ((!$incomplete) && (!$terminated)) {

          $usegrab = 't';
          }#if
        else {#broaden search with specialized getsubplist

          my (@tranp, $atelhwso, $it, $found, $linki, @f0sub, $tid, $sub);
          @tranp = \@{$Awfif::tmassl-> {r}};
          $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
          $atelhwso = awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli] [21],-1));
# 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)) {

            $linki = $Awfif::tmassl-> {wsot}{$atelhwso};
            $f0sub [0] = 0;
            while ($linki != 0){

              $found = '';
              $tid = '';
              $sub = 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) #subprogram
                && ($tranp [0][$linki] [$it] [3] != 0) #completed item
                ){

                  $tid = 't';
                  };#if
                if ( ($tranp [0][$linki] [$it] [0] == $Awfif::memes-> {snnh}{codeletslice} )
                && ($tranp [0][$linki] [$it] [1] == 36) #subprogram
                ){

                  $sub = $it;
                  };#if
                if (($sub > 0) && ($tid)
                && (subpstate ($tranp [0][$linki] [$sub] [2]) == $Awfif::memes-> {snnh} {completed})
                && (matchaelement (\@f0sub, $tranp [0][$linki] [$sub] [2]) == 0 )
                ){

                  $f0sub [++$f0sub [0]] = $tranp [0][$linki] [$sub] [2];
                  $found = 't';
                  };#if
                };#for

              $linki = $Awfif::tmassl-> {l} [$linki][1];#move to the head
              };#while
            if ($f0sub[0] > 0) {#should randomly pick

              $$csubpid = $f0sub [1];
              $usegrab = 't';
              };#if
            };#if
          @tranp = ();
          };#else
        };#elsif

      $Awfif::codelet-> {l} [$myli][36] = $r36;
      };#else
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mcrsmgrabx csubpid ($$csubpid) ret $usegrab\n");
      };
    return $usegrab
    }# mcrsmgrab
#
#
sub fastroute {
    my ($snlink, $matchtoo, $match, $link) = @_;
    my ($usable, $unacceptable, $flink, $found);
# used to find any signposts in the slipnet which indicate that this link reaches matchtoo (useable = t) or does not (useable = t) or no sign (useable = f)
# we also want properties to match the tests They are of the form 2= concept 3=wsil 4=property
#
# updated for merged workspaces
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$matchtoo};
      print ("fastroute snlink $snlink matchtoo $pr($matchtoo) ");
      &Awfif::itsiboutput ($Awfif::slipnet-> {l} [$snlink][4]);
      };

    $$link = $snlink;
    $unacceptable = '';
    $found = '';
    while (($$link != 0) && (!($unacceptable) && (!$found))) {

      $flink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes-> {snnh} {blockedroute}];
      while (($flink != 0) && (!($unacceptable))) {
        if (($Awfif::slipnet-> {l} [$flink][2] < 0)
        && (($Awfif::slipnet-> {l} [$flink][3] == $matchtoo))
        ) {
# fastroutebl
# work through the details of the list indicated by the pointer for the matchtoo

          my ($ilink, @exceptions, $ec, $i, $all);
          $all = '';
          $ec = 0;
          $ilink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[-($Awfif::slipnet-> {l} [$flink][2])];
          while (( $ilink != 0) && (!($unacceptable))) {
            if (($Awfif::slipnet-> {l} [$ilink][3] == $Awfif::memes-> {snnh}{cexcluded})) {

              $exceptions [$ec++] = $Awfif::slipnet-> {l} [$ilink][2];
              }# if excluded concept
            else {# block all

              $all = 't';
              };#
            $ilink = $Awfif::slipnet-> {l} [$ilink][0];
            };#while
# and then check if the snlink should be blocked for that matchtoo description
          if ($all) {

            $found = '';
            for ($i = 0; (($i < $ec) &&(!$found)) ; $i++) {
              if ($exceptions [$i] == $Awfif::slipnet-> {l} [$$link][4] ) {

                $found = 't';
                $flink = 0;
                };#if
              };# for
            if (!$found) {#this is not an exception to all

              $unacceptable = 't';
              $usable = 't';
              $$match = 0;
              };#if
            };# if all
          }# if pointer
        elsif (($Awfif::slipnet-> {l} [$flink][3] == $matchtoo)
        && ($Awfif::slipnet-> {l} [$flink][2] == $Awfif::slipnet-> {l} [$$link][4])
        ) {

          $unacceptable = 't';
          $usable = 't';
          $$match = 0;
          }#if
        else {

          $flink = $Awfif::slipnet-> {l} [$flink][0];
          };
        };#while
      if ((!$unacceptable) && (!$found)) {

        $$link = $Awfif::slipnet-> {l} [$$link][0];
        };#if
      };#while
    if (!$unacceptable) {
      $$link = $snlink;
      $usable = "";
      while (($$link != 0) && (!($usable))) {

        $flink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes-> {snnh} {fastroute}];
        while (($flink != 0) && (!($usable))) {
          if (($Awfif::slipnet-> {l} [$flink][3] == $matchtoo)
          && ($Awfif::slipnet-> {l} [$flink][2] == $Awfif::slipnet-> {l} [$$link][2])
          ) {
            $usable = 't';
            $$match = 1;
            }#if
          else {

            $flink = $Awfif::slipnet-> {l} [$flink][0];
            };
          };#while
        if (!$usable) {
          $$link = $Awfif::slipnet-> {l} [$$link][0];
          };#if
        };#while
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fastroutex match $$match link $$link ret $usable\n");
      };
    return $usable
    }# fastroute
#
sub nobproute {
    my ($snlink, $matchtoo) = @_;
    my ($unacceptable, $flink, $link);
# used to find any signposts in the slipnet which indicate that this link can't reach matchtoo
#
# updated for merged workspaces
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$matchtoo};
      print ("nobproute snlink $snlink matchtoo $pr($matchtoo) ");
      &Awfif::itsiboutput ($Awfif::slipnet-> {l} [$snlink][4]);
      };

    $link = $snlink;
    $unacceptable = "";
    while (($link != 0) && (!($unacceptable))) {

      $flink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes-> {snnh} {blockedbproute}];
      while (($flink != 0) && (!($unacceptable))) {
        if (($Awfif::slipnet-> {l} [$flink][3] == $matchtoo)
        && ($Awfif::slipnet-> {l} [$flink][2] == $Awfif::slipnet-> {l} [$link][4])
        ) {
          $unacceptable = 't';
          }#if
        else {

          $flink = $Awfif::slipnet-> {l} [$flink][0];
          };
        };#while
      if (!$unacceptable) {
        $link = $Awfif::slipnet-> {l} [$link][0];
        };#if
      };#while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nobproutex ret ($unacceptable)\n");
      };
    return $unacceptable
    }# nobproute
#
#<!-- start tag ds -resweb -->
#
sub unpackclp {
    my ($myli, $clp, $link) = @_;
    my ($i, $result);
    $result = 0;
# clean up old data
#
# checked for merged workspaces

    for ($i = 2;$i <= $Awfif::memes-> {cpmax}; $i++) {
      $Awfif::codelet-> {l} [$link][$i] = 0;
      };
    $Awfif::codelet-> {l} [$link][27] = '';
    $Awfif::codelet-> {l} [$link][2] = $$clp-> {strategy};
    $Awfif::codelet-> {l} [$link][3] = $$clp-> {urgency};
    $Awfif::codelet-> {l} [$link][13] = $$clp-> {log};
    if (defined ($$clp-> {wsi})) {
      $Awfif::codelet-> {l} [$link][19] = $$clp-> {wsi};
      };
# paramdelayselect
    if (defined ($$clp-> {delayselect})) {
      $Awfif::codelet-> {l} [$link][33] = ($$clp-> {delayselect} * $Awfif::memes-> {delayamp});
      };
    if (defined ($$clp-> {rework})) {
      $Awfif::codelet-> {l} [$link][14] = $$clp-> {rework};
      };

    if ($$clp-> {bond}-> {ni} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {bond}-> {ni};
      };
    if ($$clp-> {bond}-> {nidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][5] = $$clp-> {bond}-> {nidl};
      };
    if ($$clp-> {bond}-> {nsnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][6] = $$clp-> {bond}-> {nsnn};
      };
    if ($$clp-> {bond}-> {pi} != 0 ) {
      $Awfif::codelet-> {l} [$link][7] = $$clp-> {bond}-> {pi};
      };
    if ($$clp-> {bond}-> {pidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][8] = $$clp-> {bond}-> {pidl};
      };
    if ($$clp-> {bond}-> {psnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][9] = $$clp-> {bond}-> {psnn};
      };
    if ($$clp-> {bond}-> {category} != 0 ) {
      $Awfif::codelet-> {l} [$link][10] = $$clp-> {bond}-> {category};
      };

    if ($$clp-> {descriptor}-> {property} != 0 ) {# not the slipnet property link
      $Awfif::codelet-> {l} [$link][11] = $$clp-> {descriptor}-> {property};
      };
    if ($$clp-> {descriptor}-> {sponsor} != 0 ) {# original sponsoring concept
      $Awfif::codelet-> {l} [$link][15] = $$clp-> {descriptor}-> {sponsor};
      };
    if ($$clp-> {relation}-> {sponsor} != 0 ) {# original sponsoring concept
      $Awfif::codelet-> {l} [$link][15] = $$clp-> {relation}-> {sponsor};
      };
    if ($$clp-> {descriptor}-> {ni} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {descriptor}-> {ni};
      };
    if ($$clp-> {descriptor}-> {snnode} != 0 ) {
      $Awfif::codelet-> {l} [$link][12] = $$clp-> {descriptor}-> {snnode};
      };

    if ($$clp-> {relation}-> {ni} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {relation}-> {ni};
      };
    if ($$clp-> {relation}-> {nidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][5] = $$clp-> {relation}-> {nidl};
      };
    if ($$clp-> {relation}-> {nsnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][6] = $$clp-> {relation}-> {nsnn};
      };
    if ($$clp-> {relation}-> {pi} != 0 ) {
      $Awfif::codelet-> {l} [$link][7] = $$clp-> {relation}-> {pi};
      };
    if ($$clp-> {relation}-> {pidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][8] = $$clp-> {relation}-> {pidl};
      };
    if ($$clp-> {relation}-> {psnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][9] = $$clp-> {relation}-> {psnn};
      };
    if ($$clp-> {relation}-> {category} != 0 ) {
      $Awfif::codelet-> {l} [$link][10] = $$clp-> {relation}-> {category};
      };

    if ($$clp-> {group}-> {model} != 0 ) {# group is being modelled
      $Awfif::codelet-> {l} [$link][16] = $$clp-> {group}-> {model};
      };
    if ($$clp-> {group}-> {sponsor} != 0 ) {# group sponsoring wso
      $Awfif::codelet-> {l} [$link][17] = $$clp-> {group}-> {sponsor};
      };

    if ($$clp-> {action}-> {ref} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {action}-> {ref};
      };
# paramssgws
    if ($$clp-> {action}-> {ssgws} != 0 ) {
      $Awfif::codelet-> {l} [$link][5] = $$clp-> {action}-> {ssgws};
      };
    if ($$clp-> {action}-> {ssgoid} != 0 ) {
      $Awfif::codelet-> {l} [$link][6] = $$clp-> {action}-> {ssgoid};
      };
    if ($$clp-> {action}-> {signal} != 0 ) {# action is linked to signal
      $Awfif::codelet-> {l} [$link][16] = $$clp-> {action}-> {signal};
      };
    if ($$clp-> {action}-> {sponsor} != 0 ) {# group sponsoring wso
      $Awfif::codelet-> {l} [$link][17] = $$clp-> {action}-> {sponsor};
      };
    if ($$clp-> {action}-> {schema} != 0 ) {# actions start point
      $Awfif::codelet-> {l} [$link][18] = $$clp-> {action}-> {schema};
      };
    if ($$clp-> {action}-> {sws} != 0 ) {# refs schemas workspace index
      $Awfif::codelet-> {l} [$link][20] = $$clp-> {action}-> {sws};
      };
    if ($$clp-> {action}-> {wss} != 0 ) {# refs schemas wso start index
      $Awfif::codelet-> {l} [$link][21] = $$clp-> {action}-> {wss};
      };
    if ($$clp-> {action}-> {wsoname} != 0 ) {# refs schemas wso name
      $Awfif::codelet-> {l} [$link][25] = $$clp-> {action}-> {wsoname};
      };
    if ($$clp-> {action}-> {wse} != 0 ) {# refs schemas wso end index
      $Awfif::codelet-> {l} [$link][22] = $$clp-> {action}-> {wse};
      };
# paramjhlsiref
    if ($$clp-> {action}-> {jhlabeli} != 0 ) {# refs schemas wso label
      $Awfif::codelet-> {l} [$link][23] = $$clp-> {action}-> {jhlabeli};
      };
    if ($$clp-> {action}-> {pmman} != 0 ) {# refs schemas wso end index
      $Awfif::codelet-> {l} [$link][26] = $$clp-> {action}-> {pmman};
      };
    if ($$clp-> {action}-> {wss} != 0 ) {# refs schemas wso gap start index
      $Awfif::codelet-> {l} [$link][28] = $$clp-> {action}-> {wsgs};
      };
    if ($$clp-> {action}-> {wss} != 0 ) {# refs schemas wso gap end index
      $Awfif::codelet-> {l} [$link][29] = $$clp-> {action}-> {wsge};
      };
    if ($$clp-> {action}-> {jhlabeloi} != 0 ) {# refs schemas original sponsor wso operon
      $Awfif::codelet-> {l} [$link][30] = $$clp-> {action}-> {jhlabeloi};
      $result = $$clp-> {action}-> {jhlabeloi};
      };
# paramsgjhlsiref
    if ($$clp-> {action}-> {sgjhlsi} != 0 ) {# refs schemas nuclear subgroup wso operon
      $Awfif::codelet-> {l} [$link][31] = $$clp-> {action}-> {sgjhlsi};
      };
# paramtfree
    if ($$clp-> {action}-> {tfree} != 0 ) {# transaction sponsor cant free
      $Awfif::codelet-> {l} [$link][32] = $$clp-> {action}-> {tfree};
      };
# paramtransid
    if ($$clp-> {action}-> {transid} != 0 ) {# transaction id protected
      $Awfif::codelet-> {l} [$link][35] = $$clp-> {action}-> {transid};
      };
# paramsubpi
    if ($$clp-> {action}-> {subpi} != 0 ) {# subprogram
      $Awfif::codelet-> {l} [$link][36] = $$clp-> {action}-> {subpi};
      };
# unpacktrmgru1
    if ((($Awfif::codelet-> {l} [$link][35] != 0 ) or ($Awfif::codelet-> {l} [$link][36] != 0 ))
    && ($Awfif::codelet-> {l} [$link][35] != $Awfif::codelet-> {l} [$myli][35])#if these are the same a clone of self is being produced - so already has a transaction
    ){# subprogram

      &transmgr ($myli, $link, $Awfif::memes-> {snnh} {begin}, $Awfif::memes-> {snnh} {rtran});
      };
# paramtransmgrid
    if ($$clp-> {action}-> {transmgrid} != 0 ) {# transaction manager index
      $Awfif::codelet-> {l} [$link][37] = $$clp-> {action}-> {transmgrid};
# have to record that builder is submitted to trun
      if ($Awfif::codelet-> {l} [$myli] [2] =~ /evaluator/i) {
        $Awfif::tmassl-> {submitted} [$Awfif::codelet-> {l}[$link][37]] = $Awfif::codelet-> {l} [$link] [2];
        };#if
      };
# paramusepooling
    if ($$clp-> {action}-> {usepooling} != 0 ) {# schematic pooling of codelets
      $Awfif::codelet-> {l} [$link][38] = $$clp-> {action}-> {usepooling};
      };#if

    if ($$clp-> {inhib}-> {ilinkp} != 0 ) {# inhibitor link pointer
      $Awfif::codelet-> {l} [$link][24] = $$clp-> {inhib}-> {ilinkp};
      };
    return $result;
    } # unpackclp
#
#<!-- 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 -->
#<!-- 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 -->
#<!-- start tag smo -->
#
sub operonlmatch {
    my ($myli, $jhlabeli, $lomatchs, $lola, $loconcs, $lostrts, $loends, $logb, $loge, $filstrategy, $stws) = @_;
    my ($i, $i2, $label, $type, $ltype, $sigcount, $cwsbi);
# find all the operon controlled groups in the current ws that match the source jhlabel
# the jhlabels for these operons should have been loaded by lbbuilder
#
# checked for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("operonlmatch myli $myli jhlabeli $jhlabeli ");
      &itcpoutput ($myli);
      };

    $label = '';
    $ltype = '';
    $i2 = 0;

# $Awfif::memes-> {currentwsbi} = $sws;
# compare the jhlabel to the nuclear ws operons return any matching operons for this ws
#
# create an input label for msublabel from the jhlabel's attrib list
    $i = $Awfif::jhls-> {l} [$jhlabeli] [5];
    $i = $Awfif::attribs-> {l} [$i][1];#move past the start attribute
    while (($Awfif::attribs-> {l} [$i][2]) != $Awfif::memes-> {snnh}{attribe}) {
      my ($nexti);
      $type = ' ' . $Awfif::attribs-> {l} [$i][3];
      $nexti = $Awfif::attribs-> {l} [$i][1];
      if( ($Awfif::attribs-> {l} [$i][4]) #note repeat
      or ($type eq ' ' . $Awfif::attribs-> {l} [$nexti][3]) #in case repeats not encoded in attrib list - it happens
      ){#note repeat

        $type = '_' . $Awfif::attribs-> {l} [$i][3];
        };#repeat
      if ($ltype ne $type) {# ignore repeats

        $label = $label.$type;
        $$lostrts[$i2++] = $i;
        };#build direct label
      $ltype = $type;
      $i = $Awfif::attribs-> {l} [$i][1];#next
      };#while
# apply the linking function of group completion
# if the groups labels result in a match with a signal then raise the signal
#

    $sigcount = msublabel1 ($myli, \$label, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, $filstrategy, $stws);
# delete the non current ws & non operon matches
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($sigcount > 0) {

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

        if ($$lomatchs[$i]) {#there is a link validate the association
# matching jhlabel check if it is for operon and for current ws & operon includes the group sponsor
# if not remove it from the match set (set $lomatchs[$i] false
          if (($Awfif::jhls-> {l} [$$lola[$i]][4] != $Awfif::memes-> {snnh}{operon})
          or ($Awfif::jhls-> {l} [$$lola[$i]][7] != $Awfif::memes-> {currentwsbi})
          or (!ophasgs ($myli, $$lola[$i]))
          ) {

            $$lomatchs[$i] = '';
            };
          };#if link
        };#for
      };#if

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

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("operonlmatchx ret $sigcount\n");
      };
    return $sigcount
    }# operonlmatch
#
#<!-- end tag smo -->
#
sub wsolistaschst {
    my ($sgstarti, $sgstopi, $sws) = @_;
    my ($i, $cwsbi, $buffer, $grkwp, $grkwpr);
# wrap the base types of each wso in the target list with chevrons and add to string.
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("sws $sws [$sgstarti : $sgstopi] ");
      };

    $buffer = '';
    $grkwp = $Awfif::wsbl-> {wsbloh}[$Awfif::memes-> {currentwsbi}];
    $grkwpr = $Awfif::wsbl-> {wsot}[$Awfif::memes-> {currentwsbi}];

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if (defined ($sws)) {
      $Awfif::memes-> {currentwsbi} = $sws;
      };# sws specified

    for ($i = $sgstarti; $i <= $sgstopi; $i = trwsoadr ($i, 1)) {
      $buffer = $buffer . '<' . $Awfif::memes-> {snnih} {wsbasetype ($i)} . '>';
      };#for each wso in the list to be deployed
#

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

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("wsolistaschstx ret ($buffer)\n");
      };
    return $buffer
    }# wsolistaschst
#
#
sub getcontext {
    my ($myli, $sponsor, $signal, $schema, $swstype, $kwp, $kwpr, $noswstype, $cdn, $cdnx, $ii, $norolein) = @_;
    my ($continue, $i, $cwsbi );
# models must use the full workspace
#
# get context allows wso based data to checkpoint the progress of the codelet
# its possible that the wso has been destroyed, or replaced, so the codelet params are
# missleading

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

    if (defined ($ii)) {
      $i = $ii;
      }#if
    else {
      $i = 3;
      };#else
    $$cdn = igetcontext ($myli, \$$cdnx, \$$sponsor, \$$signal, \$$schema, \$$kwp, \$$kwpr, $i, $norolein);
    if ((!defined ($noswstype))) {

      $$swstype = wsbasetype ( trwsoadr ($Awfif::codelet-> {l} [$myli][21],2));
# now check the workspace for salient workspace type with model status descriptor
      if ((defined ($swstype)) && ($swstype != 0)) {

        $continue = 't';
        };#if
      }#if
    else {
      $continue = 't';
      };#else
    if (($Awfif::codelet-> {l} [$myli][25] != 0) && ($Awfif::codelet-> {l} [$myli][25] != getwsoname ($Awfif::codelet-> {l} [$myli][21], $Awfif::codelet-> {l} [$myli] [20]))) {

      $continue = '';
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $continue
    }#getcontextx
#
#<!-- start tag scc -resweb -->
#<!-- start tag uts -->
#<!-- start tag ds -resweb -->
#
sub igetcontext {
    my ($myli, $cdnx, $sponsor, $signal, $schema, $kwp, $kwpr, $ii, $norolein) = @_;
    my ($cdn, $i, $cwsi, $bcindex );
# models must use the full workspace
#
# get context allows wso based data to checkpoint the progress of the codelet
# its possible that the wso has been destroyed, or replaced, so the codelet params are
# missleading

    if (defined ($ii)) {
      $i = $ii;
      }#if
    else {
      $i = 2;
      };#else
    $cdn = clogstat (\$$cdnx, $i);

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

    $$kwp = $Awfif::wsbl-> {wsbloh}[$Awfif::memes-> {currentwsbi}];
    $$kwpr = $Awfif::wsbl-> {wsft}[$Awfif::memes-> {currentwsbi}];
    $$sponsor = $Awfif::codelet-> {l} [$myli] [17];
    $$signal = $Awfif::codelet-> {l} [$myli] [16];
    $$schema = $Awfif::codelet-> {l} [$myli] [18];
# igetcbmyu1
    if (($bcindex = matchbreakcodelet ($myli)) > 0) {

      $Awfif::memes-> {breakmyli} = $Awfif::memes-> {breakcodelet} [$bcindex];
      $Awfif::memes-> {bmbcindex} = $bcindex;
      };#if
#
    $cwsi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    if ( ($Awfif::codelet-> {l} [$myli] [37] != 0)
    ){#try to ensure that transid is the latest setting

      $Awfif::codelet-> {l} [$myli] [35] = aligntmgrr ($myli);
# igetcpcompu1
      if (($Awfif::codelet-> {l} [$myli] [35] > 0)
      && ($Awfif::tral-> {sameash} [ $Awfif::codelet-> {l} [$myli] [35] ] > 0)
      && ($Awfif::codelet-> {l} [$myli] [2] =~ /builder/i)
      && ($Awfif::codelet-> {l} [$myli] [2] !~ /groupbuilder/i)#
      ){

        if (($Awfif::memes-> {checkprocsameas}) ){&break ()};
        &assprocwtran ($myli);
        };#if
      if (($Awfif::codelet-> {l} [$myli] [35] > 0)
      && ($Awfif::codelet-> {l} [$myli] [2] =~ /builder/i)
      && ($Awfif::codelet-> {l} [$myli] [2] !~ /groupbuilder/i)#
      ){

        if (($Awfif::memes-> {checkprocsameas}) ){&break ()};
        &assprocwtmass ($myli);
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsi;
# igetctmgrfu1
    if ((defined ($norolein)) && ($norolein) ) {

      }#if
    else {

      &idorolein ($myli, $$sponsor);
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      &itcpoutput ($myli);
      };
    $Awfif::memes-> {currentwsbi} = $cwsi;

    return $cdn
    }#igetcontextx
#
#<!-- end tag uts -->
#
sub idorolein {
    my ($myli, $sponsor) = @_;
    my ($cwsi, $atelhwso, $codelet, $linki, $rolein );
# models must use the full workspace
#

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

# if this codelet will be ie get the transactional {rtrans} components if there are any from the asponsor telhdr and put them in $Awfif::codelet

    $rolein = 't';
    $cwsi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    if (($sponsor != 0)
    ){

      $atelhwso = awsoadr ( trwsoadr($sponsor,-1));
      };#if
    if (($rolein)# get the rtran data for this trans managed instance. It could have been selected by groupscout or applycodelet
    && ($sponsor != 0)
    && ($Awfif::wsol-> {l} [$atelhwso ] [2] != 0)
    && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [23]] [15] [0])
    && ( (findtdesc ($Awfif::wsol-> {l} [ ($atelhwso)] [2], $Awfif::memes-> {snnh} {mindequiv})) != 0 )
    && ( ( (defined ($codelet = fpiecodelet ($myli, $Awfif::memes-> {currentwsbi}, awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli] [21], -1)))))#now handling scenario where called inside of applycodelet
        && ($codelet == $myli) )#so grab would mean this will return exact myli codelet but if the builder is a saved shell role in transactional elements
      ) #note spigrabamp (spigralaunch) wont obtain this gettmgr without this or clause because it does not use the fpie cache (parent jhls) but instead uses the subpl 15 cache
    ){

      &gettmgr ($myli, $atelhwso, $Awfif::memes-> {snnh} {rtran});
      };#if
# igetctappcu1

    $linki = 0;
    if ( ($rolein)# help out grab/apply by recording new builders as their schemata associate with codelets for the first time
    && ($sponsor != 0)
    && (defined ($atelhwso))
    && ($Awfif::codelet-> {l} [$myli] [2] =~ /builder/i)
    && ($Awfif::codelet-> {l} [$myli] [2] !~ /groupbuilder/i)# intent is for cache of the schematic builder
    && (!defined ($codelet = fpiecodelet ($myli, $Awfif::memes-> {currentwsbi}, awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli] [21], -1)), \$linki)) )
    && ((defined ($linki)) && ($linki > 0))
    ) {

      my ($currentdefh);
      $Awfif::amoffl-> {l} [$linki] [5] = $myli;
      if ( !defined ($Awfif::amoffl-> {l} [$linki] [6])) {
        $Awfif::amoffl-> {l} [$linki] [6] = 0;
        };#if

      $Awfif::clp = ();
      $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$myli][3];
      $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];
      $currentdefh = $Awfif::memes-> {codeletdef};

      &groupsinv1 ($myli, undef(), undef(), undef(), $Awfif::codelet-> {l} [$myli][17],undef(), setupprocname ($myli, undef()),
        undef(), #kwp
        undef(), #kwpr
        \@{$Awfif::memes-> {sactset}},
        't', #deferred
        undef (), #ignore
        undef (), #usepooling
        't' #addbreak since dont want to replace the breakpoint just because add this clone
        );
      if ($currentdefh != $Awfif::memes-> {codeletdef}) {

        $Awfif::amoffl-> {l} [$linki] [6] = mdefhcodelettolist ($Awfif::amoffl-> {l} [$linki] [6]);#make this the head of a list for this $myli
# idoroleiu341
        };#if
      };#if

    if ( ($rolein)# turns out that must match role out and role in so that next role in can look effectively for roled out descriptors - so only role in once when will role out
    && ($sponsor != 0)
    && (defined ($atelhwso))
    && ($atelhwso != 0)
    && ($Awfif::codelet-> {l} [$myli] [37] > 0)
    && (($linki = $Awfif::tmassl-> {wsoh} {$atelhwso}) > 0)
    ) {

      &roleincounters ($atelhwso, awsoadr ($sponsor), $Awfif::codelet-> {l} [$myli] [37], $Awfif::codelet-> {l} [$myli] [36]);
# igetcridsu1
      &roleindropsal ($atelhwso, awsoadr ($sponsor), $Awfif::codelet-> {l} [$myli] [37], $Awfif::codelet-> {l} [$myli] [36]);
      &roleincas ($atelhwso, awsoadr ($sponsor), $Awfif::codelet-> {l} [$myli] [37], $Awfif::codelet-> {l} [$myli] [36]);
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};

    }#idoroleinx
#
#<!-- end tag ds -->
#<!-- start tag scc -->
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];
            ¬gcompleted ($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];
                  ¬gcompleted ($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} = $cwsbi;
          &imasksupp ($myli);
          if ( (subpcsponsor ($myli, $sponsor))
          ){

            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
            ¬gcompleted ($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];
        ¬gcompleted ($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
#<!-- end tag scc -->
#
sub ivalevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset, $strategy, $token) = @_;
    my ($sponsor, $atelhwso, $signal, $schema, $spi, $swstype, $noswstype, $launchedbuilder,
    $grkwp, $grkwpr, $cdn, $cdnx);
    my ($cws, $bcwso, $cwsbi, $launchev, $fbinderc);
    my ($asponsor);
# checked for merged workspaces

# value structure codelet responds to group complete providing processing of selector and value structures with gowithin properties
# this requires frame shifting, and initiation of sub-codelets to enter the frame shifted wso structure
    $noswstype = '';
    $launchedbuilder = '';
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)
    ){

      $cwsbi = $Awfif::memes-> {currentwsbi};
      $asponsor = awsoadr ($sponsor);
      $atelhwso = awsoadr (trwsoadr ($sponsor, -1));
      $launchev = iivalevaluator1 ($myli, $sponsor, $signal, $schema, $swstype, $grkwp, $grkwpr, \@$sactset, $noswstype, \$fbinderc, $token);
      if (($fbinderc > 0)
      ){#

        if (($launchev)
        ){

          my ($ifstws, $ifisstws);
          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
# ivaleurgu1
          $Awfif::memes-> {currentwsbi} = $cwsbi;
          if ($Awfif::codelet-> {l} [$myli] [36] > 0
          ){

            $ifstws = $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [6];
            $ifisstws = $Awfif::memes-> {snnh} {subpstbinding};
            };#if
          if ((ifindupri ($myli, $sponsor, undef (), 't', $ifstws, $ifisstws, $Awfif::codelet-> {l} [$myli] [36]))
          ){#

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

            $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};
            };#else
          $Awfif::clp-> {strategy} = $strategy;
          $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];
          $Awfif::clp-> {action}-> {tfree} = 1;#ivalw should not be freed without running
          &groupsinv1 ($myli, undef(), undef(), undef(), undef(), undef(), $strategy, $$kwp, $kwpr, \@$sactset);
          $launchedbuilder = 't';
          }#if
# seltstevalubo1
        else {

          my ($sponsortype, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
          $sponsortype = wsbasetype ($sponsor);
          &ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset);
          $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
          if (subpstate ($Awfif::codelet-> {l} [$myli][36]) == $Awfif::memes-> {snnh} {completed}
          ){

            }#if
          elsif ( (($Awfif::memes-> {currentwsbi} = $cws)!= 0)
          && (!findbond ($Awfif::wsol-> {l} [ awsoadr ($Awfif::wsbl-> {wsoh} [$cws])] [2], $Awfif::memes-> {snnh} {casunbind}, $sponsortype, $Awfif::memes-> {snnh} {model}))
          && (!promotesib ($myli))
          ){

            $Awfif::memes-> {currentwsbi} = $cwsbi;
            &imasksupp ($myli);
# complete the sponsors transaction

            my ($transtatus);
            $transtatus = 0;#find out the status of the transaction
            if ( (defined ($Awfif::codelet-> {l} [$myli] [35]))
            && ($Awfif::codelet-> {l} [$myli] [35] != 0)
            ){

              my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $cws, $bdwso, $abdwso, @csubpl);
              my ($reportdesc, $areportwso, $transtatus);
              &ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset);
              $bdwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
              $Awfif::memes-> {currentwsbi} = $cws;
              $abdwso = awsoadr ($bdwso);

              @csubpl = listcsubp ($myli, $abdwso);
# if dont get any f1s AND my own bcsubpc has written its completion descriptor
              if( (getf1tmgr ($myli, $atelhwso, $asponsor, $Awfif::codelet-> {l} [$myli] [36], undef(), undef(), \@csubpl) == 0)
              && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abdwso)] [2], $Awfif::memes-> {snnh} {completed})) != 0 )
              && ($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi}) > 0)
              && (($areportwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi}))) > 0)
              &&((findbond ($Awfif::wsol-> {l} [ $areportwso] [2], $Awfif::codelet-> {l} [$myli] [36], $Awfif::memes-> {snnh} {completed}, $Awfif::memes-> {snnh} {subprogram})))
              ){

                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
              };#if
            };#elsif
          };#else
        };#if
      if ((!$launchedbuilder)
      && (subpcsponsor ($myli, $sponsor))
      ){

        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
        ¬gcompleted ($myli, $sponsor, teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),undef(), undef (), 't');# sponsor should be one after telomeric header
        };#if
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#got buffer

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    }# ivalevaluator1
#
sub iivalevaluator1 {
    my ($myli, $sponsor, $signal, $schema, $swstype, $kwp, $kwpr, $sactset, $noswstype, $fbinderc, $token) = @_;#bsmodeler requires the ignored parameters for its general interface
    my ($usetrans, $subpid, $dolaunch, @csubpl, $cwsbi);
    my ($atelhwso);
    my ($abdwso, $asponsor);
#
# checked for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ( ($Awfif::memes-> {checktransidnz})
    && ($Awfif::codelet-> {l} [$myli][36] > 0)
    && ($Awfif::codelet-> {l} [$myli][35] == 0)
    && (findsubpicnm ($myli, $Awfif::codelet-> {l}[$myli][36], setupbuildername (setupprocname ($myli))) > 0)
    && (!mysubtrancomp ($myli, findsubpicnm ($myli, $Awfif::codelet-> {l}[$myli][36], setupbuildername (setupprocname ($myli))
          ), setupbuildername (setupprocname ($myli))))
    ){

      &break ();
      };#if
    if (($Awfif::memes-> {valesubpbreak}) && ($Awfif::codelet-> {l} [$myli] [36] > 0)
    ){

      &break();
      };#if

    if ( (defined ($Awfif::memes-> {valesubpspbreak}))
    && ($Awfif::memes-> {valesubpspbreak} == $Awfif::codelet-> {l} [$myli] [36])
    ){

      &break();
      };#if
    if (($Awfif::memes-> {valemainpbreak}) && ($Awfif::codelet-> {l} [$myli] [36] == 0)
    ){

      &break();
      };#if

    $dolaunch = '';
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $twso, $sldesc, $cws, $bdwso, $aws);
# checked for merged workspaces

    $twso = trwsoadr (fgrpend ($sponsor), 1);
    $asponsor = awsoadr ($sponsor);
    $atelhwso = awsoadr (trwsoadr ($sponsor, -1));

    if ( ($$fbinderc = ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset) == 1)
    ){#

      $bdwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
      my ($count, $descfits, $conforms, $stransmgrid);
      $Awfif::memes-> {currentwsbi} = $cws;
      $abdwso = awsoadr ($bdwso);
# ivaletmstu1

      @csubpl = listcsubp ($myli, $abdwso);
      $usetrans = 0;#must be defined to be setup in gettmgr
      $subpid = getf1tmgr ($myli, $atelhwso, $asponsor, $Awfif::codelet-> {l} [$myli] [36], \$usetrans, \$stransmgrid, \@csubpl);
# ivaletfu
# removed
      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} {start},
        $Awfif::memes-> {snnh} {orcategory}, $Awfif::memes-> {snnh} {alternate} )>0))
      && ($conforms)
      && ($descfits)
      or ( ($usetrans != 0)) #must continue the transaction
# ivalwecompsubu1
      or (spicompsub ($myli, 'binderc'))
      ){#launch builder

        $dolaunch = 't';
        };#if
      }#if
    else {#unexpected failure of ifindb

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

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("iivalevaluatorx ret ($dolaunch)\n");
      };#if
    return $dolaunch
    }# iivalevaluator1
#
sub crsmbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($sponsor, $asponsor, $atelhwso, $f1trmgrid, $f1transid, $signal, $schema, $found, $bcount, $swstype, $noswstype, $cwsbi, $bcexists, $mswso, $gwdsc, $sponsortype, $jhlabeli, $jhlabeloi, $jhlabeliav, $subnogap, $reportcaspart, $mycounter, $f1counter,
    $grkwp, $grkwpr, $cdn, $cdnx, $samesubpid, $endofsub, $eos, $foundlistend);
#
# mergestream specific case resolved semantics modeling manager
# checked for merged workspaces

# look for assert binder's workspace

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $bcount = 0;
    $noswstype = 't';
    $bcexists = '';
    $endofsub = '';
    $foundlistend = '';
    $subnogap = '';
    $reportcaspart = '';
# crsmbiwaitu1

# now check the workspace for salient workspace type with model status descriptor
    if ((getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3))
    && (($Awfif::codelet-> {l}[$myli] [36] == 0) or (!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l}[$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l}[$myli] [36]] == 0))#don't do crsm while subpid waiting
    ){
      my ($stwso, $astwso, $bws, $bbwso, $abbwso, $giveup);

# crsmbmsu1
# Find the statement wso and obtain the statement's wso type
      $stwso = igetmynowner ($myli, $sponsor, 'bustatement', $grkwp, $grkwpr);
      $astwso = awsoadr ($stwso);
      $sponsortype = wsbasetype ($sponsor);

      my ($proceed, $usetrans, $stransmgrid, $transid, $transtatus, $msws, $msb, $listi, $recordi, $lrecordi, $seldsc, $moddsc, $arecordi, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
      $proceed = '';
      $asponsor = awsoadr ($sponsor);
      $atelhwso = awsoadr (trwsoadr ($sponsor,-1));

      if ( (defined ($Awfif::memes-> {crsmbsubpspbreak}))
      && ($Awfif::memes-> {crsmbsubpspbreak} == $Awfif::codelet-> {l} [$myli] [36])
      ){

        &break();
        };#if
      if ( (defined ($Awfif::memes-> {crsmbnsubpebreak}))
      && ($Awfif::memes-> {crsmbnsubpebreak})
      && ($Awfif::codelet-> {l} [$myli] [36] == 0)
      ){

        &break();
        };#if
      if ( ($Awfif::memes-> {checktransidnz})
      && ($Awfif::codelet-> {l} [$myli][36] > 0)
      && ($Awfif::codelet-> {l} [$myli][35] == 0)
      && (!mysubtrancomp ($myli, findsubpicnm ($myli, $Awfif::codelet-> {l}[$myli][36], $Awfif::codelet-> {l}[$myli][2]), $Awfif::codelet-> {l}[$myli][2]))
      ){

        &break ();
        };#if
# crsmbcodu1
      if (($Awfif::memes-> {doccodescs})
      && !(ccodescs ($myli, $sponsor))
      && ($Awfif::memes-> {ccodescsd})
      ) { &break ()};
# crsmbancou1
      if (($Awfif::memes-> {doccodescs})
      && (itanalyco ($myli, $sponsor, \$mycounter, \$f1counter))){

# crsmbnsmapu1
      if ($Awfif::codelet-> {l} [$myli] [36] == 0) {#sustain the signalled codelets if necessary

        $f1transid = 0;#must define this for it to be set and returned
        $f1trmgrid = mapnonsubtotmgrid ($asponsor, $Awfif::memes-> {snnh} {stran}, 0, \$f1transid);
# need to handle sameas transaction procedure pairs
# crsmbsameasu1
        if (($f1trmgrid > 0)
# crsmbnsmapu2
        && (!tralcomp ($myli, $f1transid))
        ){
# crsmbnsmapu3

          $transtatus = 0;#find out the status of the transaction
# crsmbnsmapu4

          $usetrans = $f1transid;
          $transid = $f1transid;
          $stransmgrid = $f1trmgrid;
          }#if
        elsif (($f1trmgrid > 0)
# crsmbnsmapu7
        && (tralcomp ($myli, $f1transid))
        ){#the transaction has completed
# free the transaction resources

          $transtatus = 0;#find out the status of the transaction
          if ((defined ($Awfif::codelet-> {l} [$myli] [35])) && ($Awfif::codelet-> {l} [$myli] [35] != 0) ) {

            if ( (defined ($Awfif::memes-> {crsmbsubpsptrbreak}))
            && ($Awfif::memes-> {crsmbsubpsptrbreak} == $Awfif::codelet-> {l} [$myli] [36])
            ){

              &break();
              };#if
            $reportcaspart = 't';
            };#if
# reset the transaction info so that proceed with new trasaction

          $transid = undef();
          $f1transid = undef();
          $f1trmgrid = undef();
          $usetrans = 0;
          $transtatus = $Awfif::memes-> {snnh} {transid};
          }#elsif
        else {#no outstanding signalled codelets to support

          $usetrans = $f1transid;
          $transid = undef();
          $stransmgrid = $f1trmgrid;
          };#else
        }#if
      else {
# crsmbgtsu1

        $transtatus = 0;#find out the status of the transaction
        $usetrans = gettransstate ($myli, $sponsor, $asponsor, 'bindercs', \$stransmgrid, \$transid, \$transtatus, $$kwp, $kwpr, \@$sactset);
        if (defined ($transid)) {#remember that found an active transaction

          $samesubpid = 't';
          };#if
        };#else
# crsmbfwsu1

      if (($proceed = ibawswalk ($myli, $sponsor, $stwso, 'binderp1', 'bindercs', \@$sactset, \$bcount, \$msws, \$msb, \$bws, \$bbwso) )){
        $found = '';#undefined found -> no list; false found -> list but no missing models; true -> found missing models
        };#if
      if ($proceed) {#walk the workspace to see if any case operations are not associated with models

        $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
# crsmbmkwspu1
# subprograms may have only one record byt they may have many instances of case keyword pair, and they may recurse
# Each new level of recursed subprogram should be bounded by a keyword pair - this pair is not part of the keywords that the subprogram should process
# it belongs to the caller
# be careful the end of a subprogram will occur in a valid record so should check for end of sub after look at the record

            $recordi = ($Awfif::workspace-> {l} [$recordi] [2] - $Awfif::memes-> {snnh} {wsi});
            $arecordi = awsoadr ( $recordi);
# now check each record until get a match or run out

            if( ( ($moddsc = findtdesc ($Awfif::wsol-> {l} [ $arecordi] [2], $Awfif::memes-> {snnh} {model}, $sponsortype, ($Awfif::memes-> {snnh} {casinopp} + $Awfif::memes-> {snnh} {wsi}))) != 0)
            && (( ($seldsc = findtdesc ($Awfif::wsol-> {l} [ $arecordi] [2], $Awfif::memes-> {snnh} {casemodel})) == 0)
              or ($Awfif::workspace-> {l} [$seldsc] [10] != $Awfif::memes-> {snnh} {casedeploys})
              )#&&
            ){

              $found = 't';
              };#if
            if ( (endsubpstream ($myli, $arecordi, $abbwso))
            && (bcsubpcompsub ($myli) )
            ){#its a subprogram's last record and the bcsubpc has completed

              $eos = 't';
# crsmbfndeosu1
# in special case of no descriptors having been written to a completed subprogram's last record there is no gap
              if (($found)
              && ($moddsc == $Awfif::wsol-> {l} [ $arecordi] [2]) ){

                $found = '';
                $subnogap = 't';
                };
              };#if
            if (($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry})
            && ($found)
            ){
              print ("crsmbuilder 452 found($found) ");
              };
            };#if
          while ( (!$found)#works for main,
          && (!$eos)
          && (($lrecordi = $recordi) != 0)#aim is to check that the last record link is non zero
          && ( (($recordi = findtdesc ($Awfif::wsol-> {l} [ ($arecordi = awsoadr ($recordi))] [2], $Awfif::memes-> {snnh} {recordlink})) != 0)
            or (($Awfif::codelet-> {l} [$myli] [36] == 0) && ( (($foundlistend = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr($lrecordi, 1))] [2], $Awfif::memes-> {snnh} {listend})) == 0))) )
          ){

            $gwdsc = $Awfif::wsol-> {l} [ $arecordi] [2];
            while ((!$found)
            && ( ($gwdsc = findtdesc ($gwdsc, $Awfif::memes-> {snnh} {gowithin})) != 0 )
            ){

              $found = checkwithin ($myli, $gwdsc, $sponsortype, $kwp, $kwpr);
              $gwdsc = $Awfif::workspace-> {l}[$gwdsc][0];
              };#while

            if( ( ($moddsc = findtdesc ($Awfif::wsol-> {l} [ $arecordi] [2], $Awfif::memes-> {snnh} {model}, $sponsortype, ($Awfif::memes-> {snnh} {casinopp} + $Awfif::memes-> {snnh} {wsi}))) != 0)
            && (($seldsc = findtdesc ($Awfif::wsol-> {l} [ $arecordi] [2], $Awfif::memes-> {snnh} {casemodel})) == 0)
            or ($Awfif::workspace-> {l} [$seldsc] [10] != $Awfif::memes-> {snnh} {casedeploys})
            ){

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

              $found = '';
              };
            $recordi = ($Awfif::workspace-> {l} [$recordi] [2] - $Awfif::memes-> {snnh} {wsi});
# in icrsmox look at each ival and model to match them up at this point but here just need to know there is a gap
# 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';
# crsmbfndeosu2
# in special case of no descriptors having been written to a completed subprogram's last record there is no gap
              if (($found)
              && ($moddsc == $Awfif::wsol-> {l} [ $arecordi] [2]) ){

                $found = '';
                $subnogap = 't';
                };
              }#if
            elsif ( ($Awfif::codelet-> {l} [$myli] [36] == 0)
            && ((findtdesc ($Awfif::wsol-> {l} [awsoadr ( trwsoadr($lrecordi, 1))] [2], $Awfif::memes-> {snnh} {listend})) != 0)
            ){

              $foundlistend = 't';
              };#elsif
            if (($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry})
            && ($found)
            ){
              print ("crsmbuilder 715 found($found) ");
              };
            };#while
          };#if
        };# if

      if ( (defined ($Awfif::memes-> {crsmbnsubpeosbreak}))
      && ($Awfif::memes-> {crsmbnsubpeosbreak})
      && ($Awfif::codelet-> {l} [$myli][36] == 0)
      && ($foundlistend)
      ){

        &break();
        };#if
      if ($bcount == 1) {#if workspace fully modelled describe completion otherwise signal the nucleus as necessary

        if (($found)
        && ($f1trmgrid > 0)
        && (tralcomp ($myli, $f1transid))
        or (($found)
          && ( (!defined ($f1trmgrid))
            or ($f1trmgrid == 0)
            ) #and
          && ( (!defined ($samesubpid))
            or (!$samesubpid) or (($samesubpid) && ($transtatus != $Awfif::memes-> {snnh} {completed}))
            )#and
          )#or
# crsmbnsmapu5
        or (($f1trmgrid > 0)
          && (!tralcomp ($myli, $f1transid))
          )#or
        or (($eos) #if a sub-program has completed it may still need its sub-procedures to complete
          && (!tralcomp ($myli, $transid))
          && ($samesubpid)
          )#or
        ){
# crsmbmlu1

          my ($subpid, $casst, $p, $hiurg);#need to support cascade with signal to nucleus
          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            $subpid = $Awfif::codelet-> {l} [$myli] [36];
            $jhlabeli = 0;
            $jhlabeloi = 0;
            $casst = 'cassuboppi';
            if (!defined ($Awfif::subpl-> {q} [3] [$Awfif::memes-> {crsmindex}] [$Awfif::codelet-> {l} [$myli] [36] ])) {

              $Awfif::subpl-> {q} [3] [$Awfif::memes-> {crsmindex}] [$Awfif::codelet-> {l} [$myli] [36] ] = 0;
              };#if
            $p = \$Awfif::subpl-> {q} [3] [$Awfif::memes-> {crsmindex}] [$Awfif::codelet-> {l} [$myli] [36] ];
            }#if
          else {

            $casst = 'casoppi';
            $reportcaspart = '';#may have found the sub-transaction is complete but gaps still need the cascade sponsors support
            if (tralcomp ($myli, $f1transid)) {#cleardown the sponsored transaction to ensure get a new one

              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, 0, 0, $stransmgrid);
              $usetrans = 0;
              $f1transid = $usetrans;
              $transid = undef ();
              $stransmgrid = 0;
              $f1trmgrid = $stransmgrid;
              $transtatus = 0;
              };#if
            };#else

          if ( (($Awfif::codelet-> {l} [$myli] [36] == 0) or (!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] == 0))#don't do crsm while subpid waiting
          ) {

            $jhlabeliav = 't';
            $Awfif::memes-> {currentwsbi} = $cwsbi;
# crsmbhiurgu1

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

              $hiurg = $Awfif::memes-> {tdfsampdo} | nof1in15 ($myli, $Awfif::codelet-> {l} [$myli] [36], $transid);
              }#if
            else {

              $hiurg = $Awfif::memes-> {tdfsampdo};
              };#else

                if ( (defined ($Awfif::memes-> {crsmbsubpspsigbreak}))
                && ($Awfif::memes-> {crsmbsubpspsigbreak} == $Awfif::codelet-> {l} [$myli] [36])
                ){

                  &break();
                  };#if
                if ( (defined ($Awfif::memes-> {crsmbsubpnspsigbreak}))
                && ($Awfif::memes-> {crsmbsubpnspsigbreak})
                && ($Awfif::codelet-> {l} [$myli] [36] > 0)
                ){

                  &break();
                  };#if

            &ilaunchnc ($myli, $mswso, $casst, $Awfif::memes-> {snnh} {cascompsopp}, \$giveup, $grkwp, $grkwpr, \@$sactset,
              '32,37', #mask out codelet-> {l} [32] i.e. {tfree}
              $usetrans,
              \$transid,
              \$transtatus,
              $subpid, #signal sub-program
              \$jhlabeli,
              \$jhlabeloi,
              undef (), #newli
              $hiurg,
              \$$p
              );
# crsmbtsubsu1

            if ( ( (!defined ($f1trmgrid))
              or ($f1trmgrid == 0) )
            && ( (!defined ($samesubpid))
              or (!$samesubpid) )#&&
            && ( (!$eos) )#&&
            ){#as long as this is signaling a new transaction record it

              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, $transid, $Awfif::codelet-> {l} [$myli] [36], $stransmgrid);
              if ($Awfif::codelet-> {l} [$myli] [36] != 0) {

                &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {add}, $Awfif::memes-> {snnh} {assocf1}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [37], $Awfif::codelet-> {l} [$myli] [36]);
                };#if
              };
            }#if
# crsmbiwaitu3
          elsif ((($subpid > 0) && (defined ($Awfif::subpl-> {w} [$subpid])) && ($Awfif::subpl-> {w} [$subpid] != 0))
          && ($Awfif::memes-> {crsmbiwaitnsb})
          ) {

            &break ();
            };#if
          }#if launch models
        elsif ((!$found)
# crsmbnsmapu6
        && ($f1trmgrid > 0)
        && (tralcomp ($myli, $f1transid))
        ){#completed transaction and no further modeling needed so remove the transaction record

          &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, 0, 0, $stransmgrid);
          if ($Awfif::codelet-> {l} [$myli] [36] != 0) {

            &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {remove}, $Awfif::memes-> {snnh} {assocf1}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), $Awfif::codelet-> {l} [$myli] [36], $stransmgrid);
            };#if
          $transtatus = 0;#find out the status of the transaction
          if ((defined ($Awfif::codelet-> {l} [$myli] [35])) && ($Awfif::codelet-> {l} [$myli] [35] != 0) ) {

            $reportcaspart = 't';
            };#if
          }#elsif
        elsif ((!$found)
        && ($Awfif::codelet-> {l} [$myli] [36] > 0)
        && ($stransmgrid > 0)
        && ($usetrans > 0)
        && ($transtatus == $Awfif::memes-> {snnh} {completed})
        ){#completed transaction and no further modeling needed so remove the transaction record - added when crsm with 35 = 0 and 36 > 0 was looping on a completed subtransaction - may be that bug is in failing to complete the transaction earlier so this block may be irrelevent

          &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoctran}, $asponsor, $Awfif::memes-> {snnh} {stran}, 0, 0, $stransmgrid);
          if ($Awfif::codelet-> {l} [$myli] [36] != 0) {

            &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {remove}, $Awfif::memes-> {snnh} {assocf1}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), $Awfif::codelet-> {l} [$myli] [36], $stransmgrid);
            };#if
          $transtatus = 0;#find out the status of the transaction
          if ((defined ($Awfif::codelet-> {l} [$myli] [35])) && ($Awfif::codelet-> {l} [$myli] [35] != 0) ) {

            $reportcaspart = 't';
            };#if
          }#elsif
        else {#all records had a model

          my ($bdwso, $abdwso, $cws);
          if (((defined ($found)) && (!$found)) #if were records but non without a model

          ){

            my ($subi, $compcount, $subtotal);#check how many subprograms have been created and completed
            $compcount = 0;
            $subtotal = $Awfif::subpl-> {p} - 1;
            for ($subi = 1;$subi < $Awfif::subpl-> {p};$subi++){

              $compcount += itsubstate ($subi);
              };#for
            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];#if were records but non without a model
            if ( ($Awfif::codelet-> {l} [$myli] [36] == 0)
            && (ifindb ($myli, $sponsor, 'bindercs', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset) == 1)#check for case with semantics
            ){#

              if ( (defined ($Awfif::memes-> {crsmbcdabreak}))
              && ($Awfif::memes-> {crsmbcdabreak})
              ){

                &break();
                };#if

              $bdwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
              $Awfif::memes-> {currentwsbi} = $cws;
              $abdwso = awsoadr ($bdwso);
# crsmbdbutu1
# now in a position to assist the debug utilities
              $Awfif::memes-> {casetrmcws} = $cws;
              $Awfif::memes-> {casetrmbcwso} = $bdwso;
              $Awfif::memes-> {casetrmbs} = $Awfif::codelet-> {l} [$myli] [2];
# now release pressure on amplifiers
              $Awfif::memes-> {mainco} = 0;
              }#if main
            elsif ( ($Awfif::codelet-> {l} [$myli] [36] > 0)
            && ($bbwso > 0)
            && ($bws > 0)
            ){

              $bdwso = $bbwso;
              $cws = $bws;
              $Awfif::memes-> {currentwsbi} = $cws;
              $abdwso = awsoadr ($bdwso);
              };#elsif
# crsmbbhu1

            if (($bdwso > 0) #if crsm has setup bdwso & cws then attempt to bind to histone
            && ($cws > 0)
            ){

              &bindhistone ($myli, $cws, $bdwso);
              };#if

            if (($bdwso > 0) #if crsm has setup bdwso & cws then report manager satisfied with modelling of this workspace
            && ($cws > 0)
            && ((findtdesc ($Awfif::wsol-> {l} [($abdwso)] [2], $Awfif::memes-> {snnh} {crsmevaluator}, $Awfif::memes-> {snnh} {casecategory}, ($Awfif::memes-> {snnh} {specified}) )) == 0 )
            && (($Awfif::codelet-> {l} [$myli] [36] > 0)
              or (($foundlistend)
              or ( ($Awfif::memes-> {casetrmcws} == $cws) && ($subtotal > 0) && ($compcount == $subtotal)) ) #no codelet signalled and no gaps found
            )
            ){

              if ( (defined ($Awfif::memes-> {crsmbsubpspspbreak}))
              && ($Awfif::memes-> {crsmbsubpspspbreak} == $Awfif::codelet-> {l} [$myli] [36])
              ){

                &break();
                };#if
              if ( (defined ($Awfif::memes-> {crsmbnsubpspbreak}))
              && ($Awfif::memes-> {crsmbnsubpspbreak})
              && ($Awfif::codelet-> {l} [$myli] [36] == 0)
              ){

                &break();
                };#if

              $Awfif::wsol-> {l} [$abdwso][2]
                = setupdesc ( $Awfif::memes-> {snnh} {casecategory},
                    ($Awfif::memes-> {snnh} {specified}),
                    $Awfif::memes-> {snnh} {crsmevaluator},
                    $Awfif::wsol-> {l} [$abdwso][2],
                    $abdwso);
              };#if
            };#if did not find a record without a classification

# crsmbuitrau1
          $transtatus = 0;#find out the status of the transaction
          if ((defined ($Awfif::codelet-> {l} [$myli] [35])) && ($Awfif::codelet-> {l} [$myli] [35] != 0)
          && ( ( ($Awfif::codelet-> {l} [$myli] [36] > 0) && ((!defined ($transid)) or (tralcomp ($myli, $transid))) )
            or ( ($Awfif::codelet-> {l} [$myli] [36] == 0) && ( (!defined ($f1transid) or ($f1transid == 0)) or (tralcomp ($myli, $f1transid)) ) )
            )#&&
          ){

            if ( (defined ($Awfif::memes-> {crsmbnsubpcbreak}))
            && ($Awfif::memes-> {crsmbnsubpcbreak})
            && ($Awfif::codelet-> {l} [$myli] [36] == 0)
            ){

              &break();
              };#if
            $reportcaspart = 't';
            };#if
          };#else
        };#if

      my ($reportdesc, $arunningwso);#setup subprogram environment for amplification of self
      if ( ($Awfif::codelet-> {l} [$myli] [36] > 0)
      && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abbwso)] [2], $Awfif::memes-> {snnh} {completed})) != 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 )
      && ((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);

        &compclone ($myli);
        };#if
# crsmbgrabu1
# amplify sub cascade

      my ($grabdesc, $csubpid);
# first see if there is a running subcascade and if there is check if can grab it
      if ( (defined ($Awfif::memes-> {crsmbsubpspabreak}))
      && ($Awfif::memes-> {crsmbsubpspabreak})
      && ($Awfif::codelet-> {l} [$myli] [36] > 0)
      && (($samesubpid) or ($jhlabeliav))#have tried to launch the subprograms
      ){

        &break();
        };#if

      if ( ($Awfif::codelet-> {l}[$myli] [36] > 0)
      && ( ( (($samesubpid) or ($jhlabeliav))#have tried to launch the subprograms
        && ((getsubptransid ($myli, $Awfif::codelet-> {l}[$myli] [36])) > 0) )#or part
        or ($reportcaspart) )#&& - This filter tries to ensure that will proceed when there are no subprograms but have completed
      && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abbwso)] [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 )
# for crsm atleast it is important for the grab to be the best possible
      && (($csubpid = spifgrabcandidate ($myli, $arunningwso, 't', \$jhlabeliav, \$jhlabeli, 'crsmbuilder')) > 0)
      ){

        if (mcrsmgrab ($myli, \$csubpid, $transid) ){#it is possible that crsm modelling will over rule the general csubpid selection

          $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 ($Awfif::memes-> {crsmbgrabb}){&break ()};

          if ( ( ($grabdesc = findtdesc ($Awfif::wsol-> {l} [ $asponsor ] [2], $Awfif::memes-> {snnh} {grab})) != 0 )
          ){

            $Awfif::workspace-> {l} [$grabdesc] [2] = $csubpid;
            };#if
          };#if
        };#if
      if ($reportcaspart) {#better complete the transaction before do the amplification

        if ( (defined ($Awfif::memes-> {crsmbsubpspcbreak}))
        && ($Awfif::memes-> {crsmbsubpspcbreak} == $Awfif::codelet-> {l} [$myli] [36])
        ){

          &break();
          };#if
        if ( (defined ($Awfif::memes-> {crsmbsubpnspcbreak}))
        && ($Awfif::memes-> {crsmbsubpnspcbreak})
        && ($Awfif::codelet-> {l} [$myli] [36] > 0)
        ){

          &break();
          };#if
        &transalloc ($myli, $Awfif::memes-> {snnh} {casparticipant}, undef(), $Awfif::codelet-> {l} [$myli] [35], \$transtatus);
        };
# crsmbcou1

      if ($Awfif::memes-> {doccodescs}){
# crsmbspigu1

      if ( ($Awfif::codelet-> {l}[$myli] [36] > 0)
      && ( ( (($samesubpid) or ($jhlabeliav))#have tried to launch the subprograms
          && ((getsubptransid ($myli, $Awfif::codelet-> {l}[$myli] [36])) > 0) )#or part
        or ($reportcaspart) )#&& - This filter tries to ensure that will proceed when there are no subprograms but have completed
      && ($Awfif::memes-> {applyactive})
      && ((findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {grab})) != 0 )
      ){#use clone to launch cascade codelets

        $Awfif::memes-> {applyramp} = $Awfif::memes-> {iapplyramp};
        $Awfif::memes-> {applycth} = $Awfif::memes-> {iapplycth};
        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
        &spigrabamp ($myli, \$$kwp, $kwpr, 't', \$jhlabeliav, \$jhlabeli, \$transid, 'crsmbuilder');#which may change the descriptor situation
        if ($Awfif::memes-> {applycount} <= $Awfif::memes-> {applycmin}) {

          $Awfif::memes-> {applyactive} = '';
          $Awfif::memes-> {applycount}--;
          }
        else {

          $Awfif::memes-> {applycount}--;
          };
        }#if
      elsif ( ($Awfif::codelet-> {l}[$myli] [36] > 0)
      && ( ( (($samesubpid) or ($jhlabeliav))#have tried to launch the subprograms
          && ((getsubptransid ($myli, $Awfif::codelet-> {l}[$myli] [36])) > 0) )#or part
        )#&& - This filter tries to ensure that will proceed when there are no subprograms but have completed
      && ((findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {grab})) == 0 )
      ){#push for more time for coderack

        $Awfif::memes-> {applyramp} = $Awfif::memes-> {applyramp}/2;
        $Awfif::memes-> {applycth} = $Awfif::memes-> {iapplycth} * 1.5;
        $Awfif::memes-> {applycount}--;
        };#else
      }#got target wso
# crsmbiwaitu2
    elsif ((($Awfif::codelet-> {l}[$myli] [36] > 0) && (defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l}[$myli] [36]])) && ($Awfif::subpl-> {w} [$Awfif::codelet-> {l}[$myli] [36]] != 0))
    && ($Awfif::memes-> {crsmbiwaitb})
    ) {

      &break ();
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);
    }# crsmbuilder1
#
#
sub icrsmoxbuilder1 {
    my ($myli, $token, $targsel, $kwp, $kwpr, $sactset) = @_;
    my ($sponsor, $signal, $schema, $bcount, $swstype, $noswstype, $cwsbi, $bcexists, $eos, $trali, $bws, $bbwso, $abbwso, $reportcaspart,
    $grkwp, $grkwpr, $cdn, $cdnx, $ivalc);
    my (@ival);
#
# inverted case resolved semantics model for|if|else|elsif|match|melse codelet models
# checked for merged workspaces

      if ( ($Awfif::memes-> {checktransidnz})
      && ($Awfif::codelet-> {l} [$myli][36] > 0)
      && ($Awfif::codelet-> {l} [$myli][35] == 0)
      ){

        &break ();
        };#if
# look for assert binder's workspace

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ( (defined ($Awfif::memes-> {icrsmoxsubpspbreak}))
    && ($Awfif::memes-> {icrsmoxsubpspbreak} == $Awfif::codelet-> {l} [$myli] [36])
    ){

      &break();
      };#if
# icrsmebfu1
    if ( (defined ($Awfif::memes-> {crsmesubpcbreak}))
    && ($Awfif::memes-> {crsmesubpcbreak})
    && ($Awfif::codelet-> {l} [$myli] [36] > 0)
    && (matchaelement (\@{$Awfif::memes-> {crsmesubpspbreak}}, $Awfif::codelet-> {l} [$myli] [36]) == 0)
    ){

      $Awfif::memes-> {crsmesubpspbreak} [++$Awfif::memes-> {crsmesubpspbreak}[0]] = $Awfif::codelet-> {l} [$myli] [36];
      };#if
    if ( (defined ($Awfif::memes-> {icrsmoxsubpnspbreak}))
    && ($Awfif::memes-> {icrsmoxsubpnspbreak})
    && ($Awfif::codelet-> {l} [$myli] [36] > 0)
    ){

      &break();
      };#if
    $bcount = 0;
    $noswstype = 't';
    $bcexists = '';
    $eos = '';#end of stream detected allows the builder to complete the transaction
    $reportcaspart = '';

# now check the workspace for salient workspace type with model status descriptor
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {
      my ($stwso, $astwso, $twso, $asponsor, $sponsortype, $target, $casefor);
      $twso = trwsoadr (fgrpend ($sponsor), 1);
      $asponsor = awsoadr ($sponsor);
      $sponsortype = wsbasetype ($sponsor);

      $stwso = getmystatement ($myli, $sponsor, $grkwp, $grkwpr);
      $astwso = awsoadr ($stwso);
# crsmoxcof1du1
      if (($Awfif::memes-> {doccodescs}) && !(ccof1descs ($myli, $sponsor)) && ($Awfif::memes-> {ccof1descsd})) { &break ()};
      &crsmann ($myli, $token, $targsel, $stwso, $sponsortype, \$ivalc, \@ival, \$casefor, \$target, \$eos, \$bws, \$bbwso, \$$kwp, $kwpr, \@$sactset);
      };#got target and casefor wso

    my ($transtatus);

    if ( (defined ($Awfif::memes-> {icrsmbnsubpeosbreak}))
    && ($Awfif::memes-> {icrsmbnsubpeosbreak})
    && ($Awfif::codelet-> {l} [$myli][36] == 0)
    && ($eos)
    ){

      &break();
      };#if
# icrsmoxbuitrau1
    $transtatus = 0;#complete transaction
    if ( ((defined ($Awfif::codelet-> {l} [$myli] [35])) && ($Awfif::codelet-> {l} [$myli] [35] != 0)
    && ($eos) )
    or ((defined ($Awfif::codelet-> {l} [$myli] [35])) && ($Awfif::codelet-> {l} [$myli] [35] != 0)
    ){

      $reportcaspart = 't';
      };#if
# icrsmoxbrunu1

    if ( ($Awfif::codelet-> {l} [$myli] [35] > 0)
    && ($Awfif::codelet-> {l} [$myli] [36] > 0)
    && (defined ($Awfif::tral-> {r}[$Awfif::codelet-> {l} [$myli] [35]] [0]))
    && (($trali = matchsaelement ((\@{$Awfif::tral-> {i}[$Awfif::codelet-> {l} [$myli] [35]]} ), $Awfif::codelet-> {l} [$myli] [2])) != 0 )# get index of builder in tral i
    ){#setup tral r if limiting accelorator

      $Awfif::tral-> {r}[$Awfif::codelet-> {l} [$myli] [35]] [$trali] = $Awfif::tral-> {w}[$Awfif::codelet-> {l} [$myli] [35]] [$trali];
      };#if
# icrsmoxbaccu1

    my ($reportdesc, $arunningwso);#setup subprogram environment for amplification of self
    if ( (defined ($Awfif::memes-> {icrsmoxbsubpspabreak}))
    && ($Awfif::memes-> {icrsmoxbsubpspabreak})
    && ($Awfif::codelet-> {l} [$myli] [36] > 0)
    ){

      &break();
      };#if
    $Awfif::memes-> {currentwsbi} = $bws;
    $abbwso = awsoadr ($bbwso);
    if ( ($Awfif::codelet-> {l} [$myli] [35] > 0)
    && ($Awfif::codelet-> {l} [$myli] [36] > 0)
    && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abbwso)] [2], $Awfif::memes-> {snnh} {completed})) != 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 )
    && ((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 )
    ){#indicate that have run

      $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
# icrsmoxbcclu1
    if ( ($Awfif::codelet-> {l} [$myli] [35] > 0)
    && ($Awfif::codelet-> {l} [$myli] [36] > 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 )
    ){

      &compclone ($myli);
      };#if
    if ($reportcaspart) {

      my ($acompwso);
      if ( ($Awfif::codelet-> {l} [$myli] [35] > 0)
      && ($Awfif::codelet-> {l} [$myli] [36] > 0)
      && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abbwso)] [2], $Awfif::memes-> {snnh} {completed})) != 0 )#report that codelet has run allowing it to be grabbed
      && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi})) > 0 )
      && (($acompwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi})) ) > 0 )
      && ((findtdesc ($Awfif::wsol-> {l} [($acompwso)] [2], $Awfif::memes-> {snnh} {complete}, $Awfif::memes-> {snnh} {$Awfif::codelet-> {l} [$myli] [2]}, ($Awfif::codelet-> {l} [$myli] [36] + $Awfif::memes-> {snnh} {wsi}) )) == 0 )
      ){

        $Awfif::wsol-> {l} [$acompwso][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} {complete},
          $Awfif::wsol-> {l} [$acompwso][2],
          $acompwso);
        };#if
      if ( (defined ($Awfif::memes-> {icrsmoxsubpspcbreak}))
      && ($Awfif::memes-> {icrsmoxsubpspcbreak} == $Awfif::codelet-> {l} [$myli] [36])
      ){

        &break();
        };#if
      if ( (defined ($Awfif::memes-> {icrsmoxsubpnspcbreak}))
      && ($Awfif::memes-> {icrsmoxsubpnspcbreak})
      && ($Awfif::codelet-> {l} [$myli] [36] > 0)
      ){

        &break();
        };#if
      &transalloc ($myli, $Awfif::memes-> {snnh} {casparticipant}, undef(), $Awfif::codelet-> {l} [$myli] [35], \$transtatus);
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# icrsmoxbuilder1
#
#<!-- start tag ds -resweb -->
#<!-- start tag scc -->
#
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} [$termdesc] [2] == $Awfif::workspace-> {l} [$sldesc] [2])
            &&((findtdesc ($Awfif::wsol-> {l} [ $abcwso] [2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi}) )) == 0)
            ){#simulate endkwlist report that have reached end of list

              if ( (defined ($Awfif::memes-> {endlkwbesdbreak}))
              && ($Awfif::memes-> {endlkwbesdbreak})
              ){

                &break();
                };#if

              $Awfif::wsol-> {l} [$abcwso][2]
              = setupdesc ( $Awfif::memes-> {snnh} {found},
                  ($Awfif::memes-> {snnh} {wsi} + $Awfif::memes-> {snnh} {endlistkwevaluator}), #
                  $Awfif::memes-> {snnh} {model},
                  $Awfif::wsol-> {l} [$abcwso] [2],
                  $abcwso,
                  't');
              };#if describe finding end of list
            }#if
          else {

            my ($areportwso, $subp11i);
            $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})))) {

              $Awfif::wsol-> {l} [$areportwso][2]
                = setupdesc ( ($Awfif::memes-> {snnh} {completed}),
                ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$myli] [36]), #to match findbond
                $Awfif::memes-> {snnh} {subprogram},
                $Awfif::wsol-> {l} [$areportwso][2],
                $areportwso);
# complete the sponsors transaction

# bcsubpcbuitrau1
              $transtatus = 0;#find out the status of the transaction
              };#if
            if ( (defined ($Awfif::codelet-> {l} [$myli] [35]))
            && ($Awfif::codelet-> {l} [$myli] [35] != 0)
            ){

              $reportcaspart = 't';
              };#if
# bcsubpcbuitcompu1
            $subp11i = findsubpicnm ($myli, $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [2]);
            if ((!(findbond ($Awfif::wsol-> {l} [ $areportwso] [2], $Awfif::codelet-> {l} [$myli] [36], $Awfif::memes-> {snnh} {completed}, $Awfif::memes-> {snnh} {subpref})))
            && (subtrancomp ($myli, $subp11i) )
            ){

              if ( (defined ($Awfif::memes-> {bcsubpcbsubpspabreak}))
              && ($Awfif::memes-> {bcsubpcbsubpspabreak} == $Awfif::codelet-> {l} [$myli] [36])
              ){

                &break();
                };#if
              if ( (defined ($Awfif::memes-> {bcsubpcbsubpnspabreak}))
              && ($Awfif::memes-> {bcsubpcbsubpnspabreak} )
              ){

                &break();
                };#if
              $Awfif::wsol-> {l} [$areportwso][2]
                = setupdesc ( ($Awfif::memes-> {snnh} {completed}),
                ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$myli] [36]), #to match findbond
                $Awfif::memes-> {snnh} {subpref},
                $Awfif::wsol-> {l} [$areportwso][2],
                $areportwso,
                't');#sync with deferred codelet
# bcsubpcbmdfu1

              my ($is);
              for ($is = 1; $is < $Awfif::subpl-> {p}; $is++) {
                $Awfif::subpl-> {q} [0] [ $is ] = ();
                $Awfif::subpl-> {q} [1] [ $is ] = 0;
                };#for
              $Awfif::memes-> {tdfsampdo} = '';
              }#if
# bcsubpcbwonstcu1
            elsif ( (!(findbond ($Awfif::wsol-> {l} [ $areportwso] [2], $Awfif::codelet-> {l} [$myli] [36], $Awfif::memes-> {snnh} {completed}, $Awfif::memes-> {snnh} {subpref})))
            && ( (!defined($Awfif::tral-> {w} [$Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ][0]))#should check for no presence in list of this codelet name
            or ($Awfif::tral-> {w} [$Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [11] [$subp11i] ][0] == 0) )#should check for no presence in list of this codelet name
            ){#issue wait

              if ( (defined ($Awfif::memes-> {bcsubpcbsubpspwbreak}))
              && ($Awfif::memes-> {bcsubpcbsubpspwbreak} == $Awfif::codelet-> {l} [$myli] [36])
              ){

                &break();
                };#if
              if ( (defined ($Awfif::memes-> {bcsubpcbsubpnspwbreak}))
              && ($Awfif::memes-> {bcsubpcbsubpnspwbreak} )
              ){

                &break();
                };#if
              &waitonstrancomp ($myli, $kwp, $kwpr, \@$sactset);
              };#elsif
# bcsubpcbtrsal2
            if (($Awfif::codelet-> {l} [$myli] [37] > 0)
            ) {

              $Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] = $Awfif::memes-> {snnh} {completed};
              };#if
            };#else
          };#if ready to complete
# bcsubpcbrrunu1

        if ( (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {completed})) != 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);

          &compclone ($myli);
          };#if
        };#if ifindb
      if ($reportcaspart) {

        if ( (defined ($Awfif::memes-> {bcsubpcbsubpspcbreak}))
        && ($Awfif::memes-> {bcsubpcbsubpspcbreak} == $Awfif::codelet-> {l} [$myli] [36])
        ){

          &break();
          };#if
        if ( (defined ($Awfif::memes-> {bcsubpcbsubpnspcbreak}))
        && ($Awfif::memes-> {bcsubpcbsubpnspcbreak} )
        ){

          &break();
          };#if
        &transalloc ($myli, $Awfif::memes-> {snnh} {casparticipant}, undef(), $Awfif::codelet-> {l} [$myli] [35], \$transtatus);
        &itcpdist ($Awfif::memes-> {codeleth});
        };#if
      if ($catalysis) {

        &applycodelet ($myli, $sldesc, $cws, $abcwso, \$$kwp, $kwpr, \@$sactset);
        };#if
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#got buffer

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);
    }# bcsubpcbuilder1
#
#<!-- end tag scc -->
#<!-- end tag ds -->
#<!-- start tag scc -->
#<!-- start tag ds -resweb -->
#
sub bcsubpsbuilder1 {#The ignored parameters are required by the codelet calling architecture
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($sponsor, $atelhwso, $signal, $schema, $swstype, $noswstype, $sponsortype, $usetrans, $transid, $transtatus, $stransmgrid, $catalysis, $signalled, $usedngc, $depsubs, $jhlabeli, $jhlabeliav, $reportcaspart, $dospigrabamp,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# binder complex sub-program initiation codelet sponsors the sub-program while the termination condition does not hold
# checked for merged workspaces

    $dospigrabamp = '';
    if ( (defined ($Awfif::memes-> {bcsubpsbsubpnspbreak}))
    && ($Awfif::memes-> {bcsubpsbsubpnspbreak})
    && ($Awfif::codelet-> {l} [$myli] [36] > 0)
    ){

      &break();
      };#if
    if ( (defined ($Awfif::memes-> {bcsubpsbsubpspbreak}))
    && ($Awfif::memes-> {bcsubpsbsubpspbreak} == $Awfif::codelet-> {l} [$myli] [36])
    ){

      &break();
      };#if
    $noswstype = '';
    $usedngc = '';
    $depsubs = '';
    $reportcaspart = '';
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {
      my ($reportdesc, $arunningwso, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $twso, $asponsor, $sldesc, $cws, $bcwso, $abcwso, $cwsbi);
      $twso = trwsoadr (fgrpend ($sponsor), 1);
      $asponsor = awsoadr ($sponsor);
      $atelhwso = awsoadr (trwsoadr ($sponsor,-1));
      $sponsortype = wsbasetype ($sponsor);
      $jhlabeliav = '';
# bcsubpsbwonelkd1

      $cwsbi = $Awfif::memes-> {currentwsbi};
      if (notwaitonelkd ($myli, $sponsor, $grkwp, $grkwpr, \@$sactset) ){#endlistkwbuilder must find end of list before bcsubpsbuilder starts to act

        if ( (ifindb ($myli, $sponsor, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@$sactset) == 1)
        ){#

          $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
# bcsubpsbbhu1

          &bindhistone ($myli, $cws, $bcwso);
          my ($grabdesc, $counteri, $initdesc, $csubpid, $sgdi, $gsponsor, $nrdescp);
# bcsubpsbtmstu1
          $Awfif::memes-> {currentwsbi} = $cws;
          $abcwso = awsoadr ($bcwso);
          $usetrans = gettransstate ($myli, $sponsor, $asponsor, 'binderc', \$stransmgrid, \$transid, \$transtatus, $$kwp, $kwpr, \@$sactset);
          if (((defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) && ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] != 0) )
          && ((findcounter ($Awfif::wsol-> {l} [$abcwso][2], ($Awfif::memes-> {snnh} {completingf1}), \$counteri, $Awfif::codelet-> {l} [$myli] [36] )))
          ){#wait completed
# bcsubpswaitcu1

            $Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] = undef ();
            $Awfif::memes-> {bcsubpscdef} = freesubpscdef ($myli, $Awfif::codelet-> {l} [$myli] [36], $Awfif::memes-> {bcsubpscdef}, $abcwso);
# bcsubpswschu1
            &setusalcwsocache ($asponsor, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}])), undef());
            }#if
          elsif ( ((!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] == 0))
          && ((findtdesc ($Awfif::wsol-> {l} [$abcwso][2], ($Awfif::memes-> {snnh} {wascompletingf1}), $Awfif::codelet-> {l} [$myli] [36] ) > 0))
          ){#wait should be initiated
# bcsubpsiwaitu1

            my ($codeletdef);
            if (!defined($Awfif::memes-> {bcsubpscdef})) {$Awfif::memes-> {bcsubpscdef} = 0};#setup a queue head for the deferred codelets
            &waitondesc ($myli, $abcwso, ($Awfif::codelet-> {l} [$myli] [36] + $Awfif::memes-> {snnh} {wsi}), $Awfif::codelet-> {l} [$myli] [36], $Awfif::memes-> {snnh} {completingf1}, undef(), undef(), undef(), undef(), \$codeletdef);
            $Awfif::memes-> {bcsubpscdef} = addsubpscdef ($myli, $codeletdef, $Awfif::memes-> {bcsubpscdef});
            $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];
            $Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] = $asponsor;
# bcsubpswschu2
            &setusalcwsocache ($asponsor, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}])), undef());
            };#elsif
# bcsubpsgrabu1

          $jhlabeliav = '';
          if ( (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [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, 't', \$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
# bcsubpsspigu
# this can't work since the assoc f1 has not been setup yet

# bcsubpsbtfu
# descriptor based strategy removed

          if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
          && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
          && (($initdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {subprogram}, ($Awfif::memes-> {snnh} {start}))) != 0 )
          && ($Awfif::workspace-> {l} [$initdesc] [2] != $Awfif::workspace-> {l} [$sldesc] [2])
          && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
          && ((!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] == 0))
          or ( ($usetrans != 0)
            && ($nrdescp = 't')
            && ((!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] == 0)) ) #must continue the transaction
          ){#report started to take over cascade

            my ($areportwso, $dummy, $giveup);
            if ((defined ($reportdesc)) && ($reportdesc != 0)) {#try to initiate catalysis
# bcsubpsbgrabu1

              $catalysis = grabcodelet ($myli, $sldesc, $cws, $abcwso, 't');
              };#if

# bcsubpsbtrsal1
            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};
              &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{cassponsor});
              };#if
# bcsubpsbsig1
            if ((!defined ($nrdescp))) {#wsposition is not at terminus
              $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} {initiate}, $Awfif::memes-> {snnh} {subprogram})))) {

                my ($aws);
                &compclone ($myli);
                $Awfif::wsol-> {l} [$areportwso][2]
                  = setupdesc ( ($Awfif::memes-> {snnh} {initiate}),
                  ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$myli] [36]), #to match findbond
                  $Awfif::memes-> {snnh} {subprogram},
                  $Awfif::wsol-> {l} [$areportwso][2],
                  $areportwso);

                $Awfif::memes-> {currentwsbi} = $cwsbi;
                if (!defined ($Awfif::subpl-> {q} [3] [$Awfif::memes-> {bcsubpsindex}] [$Awfif::codelet-> {l} [$myli] [36] ])) {
                  $Awfif::subpl-> {q} [3] [$Awfif::memes-> {bcsubpsindex}] [$Awfif::codelet-> {l} [$myli] [36] ] = 0;
                  };#if
                if ( (defined ($Awfif::memes-> {bcsubpsbsubpspsigbreak}))
                && ($Awfif::memes-> {bcsubpsbsubpspsigbreak} == $Awfif::codelet-> {l} [$myli] [36])
                ){

                  &break();
                  };#if
                &ilaunchnc ($myli, $dummy, 'cassuboppi', $Awfif::memes-> {snnh} {cascompsopp}, \$giveup, $grkwp, $grkwpr, \@$sactset,
                  32, #mask out codelet-> {l} [32] i.e. {tfree}
# bcsubpsbuitrau2
                  $usetrans,
                  \$transid,
                  \$transtatus
                  ,$Awfif::codelet-> {l} [$myli] [36], #signal sub-program
                  undef (), #jhlabeli
                  undef (), #jhlabeloi
                  undef (), #newli
                  $Awfif::memes-> {tdfsampdo},
                  \$Awfif::subpl-> {q} [3] [$Awfif::memes-> {bcsubpsindex}] [$Awfif::codelet-> {l} [$myli] [36] ], #use pooling
                  ( (ifindupri ($myli, $sponsor))
                    && ( !( (hdescexists ($myli, $cws, $bcwso, $Awfif::memes-> {snnh} {casinopp}, $sponsortype) )
                    or
                      (hdescexists ($myli, $cws, $bcwso, $Awfif::memes-> {snnh} {casinsopp}, $sponsortype) ) ) )
                  )#buildoffurg
                  );
                $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]][11][++$Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [11][0]] = $transid;
                $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [12][++$Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [12][0]] = $Awfif::tral-> {l} [$transid] [4];
                $depsubs = 't';
# bcsubpsbuigrau1

                $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [13] = $Awfif::codelet-> {l} [$myli] [20];
                $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]] [14] = $Awfif::codelet-> {l} [$myli] [21];
                if (($usetrans == 0) && (defined ($transid) && ( ($transtatus == $Awfif::memes-> {snnh} {completed}) or ($transtatus == $Awfif::memes-> {snnh} {incomplete}))) ){#record the transid
# bcsubpsbtmstu2

                  &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} = $Awfif::codelet-> {l} [$myli] [20];
                &fgrpd ($myli, $sponsor, \$sgdi, $Awfif::memes->{snnh}{groupcategory});
                $gsponsor = fgrpsponsor ($sponsor, $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory});

                ¬gcompleted ($myli, $gsponsor, undef(), 't', undef (), undef(),
                  $Awfif::sublp-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [6], #should be the stws
                  $Awfif::memes-> {snnh}{subpstbinding}, #issubp
                  $Awfif::codelet-> {l} [$myli] [36],#subp
                  undef (), #nodebug
                  undef (), #nodelayselect
                  $Awfif::memes-> {tdfsampdo} #amplify delay select
                  );
                $usedngc = 't';
# bcsubpsbwaitprefcu1
                if ( ((! defined ($Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]][17])) or ($Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]][17] == 0))
                ) {

                  my ($codeletdef, $reportdesc, $areportwso);
                  $reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $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}));
                  &waitondesc ($myli, $areportwso, ($Awfif::codelet-> {l} [$myli] [36] + $Awfif::memes-> {snnh} {wsi}), $Awfif::memes-> {snnh} {completed}, $Awfif::memes-> {snnh} {subpref}, undef(), undef(), undef(), undef(), \$codeletdef);
                  $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli] [36]][17] = $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
                $aws = ($Awfif::workspace-> {l} [$sldesc] [3] - $Awfif::memes-> {snnh} {wsi});
                &iskipw ($myli, $sldesc, $cws, $aws, $abcwso);
# now have written the assoc f1 the spi grab amp should work
# bcsubpsspigu1

                if ( ($Awfif::memes-> {applyactive})
                && ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
                && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
                && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
                && (findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {grab}) != 0 )
                ){#use clone to launch cascade codelets

                  $dospigrabamp = 't';
                  };#if
                }#if
              else {
# bcsubpsbuitrau3
# may be having to maintain the transaction participants

                if ( (&transalloc ($myli, $Awfif::memes-> {snnh} {cassponsor}, undef(), $transid, \$transtatus) == $transid)
                && ($transtatus == $Awfif::memes-> {snnh} {incomplete}) #bcsubps transaction is not completed
                ){
# mp signal the sub-program
# bcsubpsbusnu1

                  $depsubs = signaltrans ($myli, $asponsor, $atelhwso, $usetrans, $stransmgrid, \$transid, \$transtatus, $grkwp, $grkwpr, \@$sactset, $cwsbi, $Awfif::memes-> {tdfsampdo});
# bcsubpsspigu2

                  if ( ($Awfif::memes-> {applyactive})
                  && ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
                  && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
                  && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
                  && (findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {grab}) != 0 )
                  ){#use clone to launch cascade codelets

                    $dospigrabamp = 't';
                    };#if
                  $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
                  &fgrpd ($myli, $sponsor, \$sgdi, $Awfif::memes-> {snnh} {groupcategory} );
                  $gsponsor = fgrpsponsor ($sponsor, $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory});
                  ¬gcompleted ($myli, $gsponsor, undef(), 't', undef (), undef(),
                    $Awfif::sublp-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [6], #should be the stws
                    $Awfif::memes-> {snnh} {subpstbinding}, #issubp
                    $Awfif::codelet-> {l} [$myli] [36],
                    undef (), #nodebug
                    undef (), #nodelayselect
                    $Awfif::memes-> {tdfsampdo} #amplify delay select
                    );
                  $usedngc = 't';
                  }#if still need to signal subprogram
                else {#completed so can use as template
# bcsubpsspigu3

                  if ( ($Awfif::memes-> {applyactive})
                  && ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
                  && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
                  && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
                  && (findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {grab}) != 0 )
                  ){#use clone to launch cascade codelets

                    $dospigrabamp = 't';
                    };#if
                  };#else
                };#else
              }#if wsposition descriptor present
            else {#wsposition is at terminus and have an outstanding transaction to support
# bcsubpsbtrsal2

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

                $Awfif::tmassl-> {l} [$Awfif::codelet-> {l} [$myli] [37]] [3] = $Awfif::memes-> {snnh} {completed};
                };#if
              if ( (&transalloc ($myli, $Awfif::memes-> {snnh} {cassponsor}, undef(), $transid, \$transtatus) == $transid)
              && ($transtatus == $Awfif::memes-> {snnh} {incomplete}) #bcsubps transaction is not completed
              ){
# mp signal the sub-program
# bcsubpsbpoolu2

                if (!defined ($Awfif::subpl-> {q} [3] [$Awfif::memes-> {bcsubpsindex}] [$Awfif::codelet-> {l} [$myli] [36] ])) {
                  $Awfif::subpl-> {q} [3] [$Awfif::memes-> {bcsubpsindex}] [$Awfif::codelet-> {l} [$myli] [36] ] = 0;
                  };#if
                my ($dummy, $giveup);
                if ( (defined ($Awfif::memes-> {bcsubpsbsubpspsigbreak}))
                && ($Awfif::memes-> {bcsubpsbsubpspsigbreak} == $Awfif::codelet-> {l} [$myli] [36])
                ){

                  &break();
                  };#if
                $Awfif::memes-> {currentwsbi} = $cwsbi;
                &ilaunchnc ($myli, $dummy, 'cassuboppi', $Awfif::memes-> {snnh} {cascompsopp}, \$giveup, $grkwp, $grkwpr, \@$sactset,
                  32, #mask out codelet-> {l} [32] i.e. {tfree}
                  $usetrans,
                  \$transid,
                  \$transtatus
                  ,$Awfif::codelet-> {l} [$myli] [36],
                  undef (), #jhlabeli
                  undef (), #jhlabeloi
                  undef (), #newli
                  $Awfif::memes-> {tdfsampdo},
                  \$Awfif::subpl-> {q} [3] [$Awfif::memes-> {bcsubpsindex}] [$Awfif::codelet-> {l} [$myli] [36] ], #use pooling
                  ( (ifindupri ($myli, $sponsor))
                    && ( !( (hdescexists ($myli, $cws, $bcwso, $Awfif::memes-> {snnh} {casinopp}, $sponsortype) )
                    or
                      (hdescexists ($myli, $cws, $bcwso, $Awfif::memes-> {snnh} {casinsopp}, $sponsortype) ) ) )
                    )#buildoffurg
                  );
                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, 0, $stransmgrid);
                  };#if
# bcsubpsspigu4

                if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
                && ($Awfif::workspace-> {l} [$sldesc] [2] != ($Awfif::memes-> {snnh} {wsi} + 0))
                && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
                && (findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {grab}) != 0 )
                ){#use clone to launch cascade codelets

                  $dospigrabamp = 't';
                  };#if
                $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
                &fgrpd ($myli, $sponsor, \$sgdi, $Awfif::memes->{snnh}{groupcategory});
                $gsponsor = fgrpsponsor ($sponsor, $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory});
                $usedngc = 't';
                ¬gcompleted ($myli, $gsponsor, undef(), 't', undef (), undef(),
                  $Awfif::sublp-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [6], #should be the stws
                  $Awfif::memes-> {snnh}{subpstbinding}, #issubp
                  $Awfif::codelet-> {l} [$myli] [36],
                  undef (), #nodebug
                  undef (), #nodelayselect
                  $Awfif::memes-> {tdfsampdo} #amplify delay select
                  );
                $signalled = 't';
                }#if still need to signal subprogram
              else {

                &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{wascassponsor});
                $signalled = '';
                };#
              };#else
            };#if
# complete the sponsors transaction

# bcsubpsbuitrau1
          $transtatus = 0;#find out the status of the transaction
          if ( (defined ($Awfif::codelet-> {l} [$myli] [35]))
          && ($Awfif::codelet-> {l} [$myli] [35] != 0)
          && ((!defined ($transid)) or (tralcomp ($myli, $transid)))
          && ((!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] == 0))
          ){

            $reportcaspart = 't';
            };#if
          };#if
# bcsubpsbmdfu1
        if ( (defined ($Awfif::memes-> {usetdfmod}))
        && ($Awfif::memes-> {usetdfmod})
        && ($Awfif::subpl-> {q} [2] [0] == 0)
        ){#update transactional deployment failures

          if ( ($Awfif::subpl-> {q} [0] [ $Awfif::codelet-> {l} [$myli][36] ] > $Awfif::memes-> {tdfsampth})
          ){#update transactional deployment failures

            $Awfif::memes-> {tdfsampdo} = 't';
            }#if
# bcsubpsbmdfu2
          elsif (($Awfif::memes-> {mainco} > $Awfif::memes-> {tdfsampth})
          ) {

            $Awfif::memes-> {tdfsampdo} = 't';#main program codelets being crowded out
            };#else
          };#if
# bcsubpsbrrunu1

        if ( (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [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 (($depsubs && !$usedngc) && (subpcsponsor ($myli, $sponsor))) {
          $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
          ¬gcompleted ($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 ( ($Awfif::memes-> {applyactive})
        && ($dospigrabamp)
        ){#use clone to launch cascade codelets

          $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l}[$myli][20];
          &spigrabamp ($myli, \$$kwp, $kwpr, 't', \$jhlabeliav, \$jhlabeli, \$transid);#which may change the descriptor situation
          };#if

        if ( (!$usedngc)
        && (defined ($Awfif::memes-> {bcsubpsbsubpspclbreak}))
        && ($Awfif::memes-> {bcsubpsbsubpspclbreak} == $Awfif::codelet-> {l} [$myli] [36])
        && ((!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] == 0))
        ){

          &break();
          };#if
        if (($catalysis)
        && (!$signalled)
        && ($Awfif::memes-> {spiglvl} == 0)
        && ((!defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]])) or ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$myli] [36]] == 0))
        ) {

          &applycodelet ($myli, $sldesc, $cws, $abcwso, \$$kwp, $kwpr, \@$sactset);
          };#if
        if ($reportcaspart) {

          if ( (defined ($Awfif::memes-> {bcsubpsbsubpspcbreak}))
          && ($Awfif::memes-> {bcsubpsbsubpspcbreak} == $Awfif::codelet-> {l} [$myli] [36])
          ){

            &break();
            };#if
          if ( (defined ($Awfif::memes-> {bcsubpsbsubpnspcbreak}))
          && ($Awfif::memes-> {bcsubpsbsubpnspcbreak})
          && ($Awfif::codelet-> {l} [$myli] [36] > 0)
          ){

            &break();
            };#if
          &transalloc ($myli, $Awfif::memes-> {snnh} {casparticipant}, undef(), $Awfif::codelet-> {l} [$myli] [35], \$transtatus);
          &itcpdist ($Awfif::memes-> {codeleth});
          };#if
        };#if proceed with processing
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#got buffer

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);
    }# bcsubpsbuilder1
#
#<!-- end tag ds -->
#<!-- end tag scc -->
#
sub groupsinv1 {
    my ($myli, $ni, $pi, $nidl, $sponsor, $model, $strategy, $kwp, $kwpr, $sactset, $deferred, $ignore0wsoname, $usepooling, $addbreak, $hiurg) = @_;
    my ($newli, $ctail, $psponsori, $usedpooling);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("groupsinv1 myli $myli ni $ni pi $pi sponsor $sponsor model $model strategy $strategy ");
      if ((defined ($kwp)) && (defined ($kwpr)) && (defined ($$sactset[0]))) {
        print ("kwp $kwp kwpr $kwpr sactset $$sactset[0] ");
        };
      if ((defined ($deferred))) {
        print ("deferred $deferred ");
        };
      if ((defined ($ignore0wsoname))) {
        print ("ignore0wsoname $ignore0wsoname ");
        };
      if ((defined ($usepooling))) {
        print ("usepooling $usepooling ");
        };
      if ((defined ($addbreak))) {
        print ("addbreak $addbreak ");
        };
      if ((defined ($hiurg))) {
        print ("hiurg($hiurg) ");
        };
      };

    $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
    if (!defined($Awfif::clp-> {urgency})) {

      if ($Awfif::codelet-> {l} [$myli][3] != 0) {

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

          $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {gerhiamp};
          }#if
        else {

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

        $Awfif::clp-> {urgency} = $Awfif::memes-> {tdgsurg};
        };#else
      };

    if (defined ($Awfif::clp-> {wsi})) {

      }#use this
    elsif ($Awfif::codelet-> {l}[$myli][19] != 0) {

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

      $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
      };
    if (($Awfif::codelet-> {l}[$myli][25] != 0)
    or ((defined($ignore0wsoname)) && ($ignore0wsoname))
    ){

      if (!defined ($Awfif::clp-> {action}-> {wsoname})
      && ($Awfif::codelet-> {l}[$myli][25] != 0)
      ) {

        $Awfif::clp-> {action}-> {wsoname} = $Awfif::codelet-> {l}[$myli][25];
        };#if
      if ((!defined ($Awfif::clp-> {action}-> {sws})) && ($Awfif::codelet-> {l}[$myli] [20] != 0)) {

        $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l}[$myli] [20];
        };#if
      if ((!defined ($Awfif::clp-> {action}-> {wss})) && ($Awfif::codelet-> {l}[$myli][21] != 0)) {

        $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l}[$myli][21];
        };#if
      };#wsoname set
    if ($Awfif::codelet-> {l}[$myli][23] != 0) {

      if (!defined ($Awfif::clp-> {action}-> {jhlabeli})) {

        $Awfif::clp-> {action}-> {jhlabeli} = $Awfif::codelet-> {l}[$myli][23];
        };#if
      };#jhlabeli set
    if ($Awfif::codelet-> {l}[$myli][30] != 0) {

      if (!defined ($Awfif::clp-> {action}-> {jhlabeloi})) {

        $Awfif::clp-> {action}-> {jhlabeloi} = $Awfif::codelet-> {l}[$myli][30];
        };#if
      };#jhlabeloi set
# groupsinvieu1
    if ($Awfif::codelet-> {l}[$myli][31] != 0) {

      if (!defined ($Awfif::clp-> {action}-> {sgjhlsi})) {

        $Awfif::clp-> {action}-> {sgjhlsi} = $Awfif::codelet-> {l}[$myli][31];
        };#if
      };#sgjhlsi set
# groupsinvtiu1
    if ($Awfif::codelet-> {l}[$myli][32] != 0) {

      if (!defined ($Awfif::clp-> {action}-> {tfree})) {

        $Awfif::clp-> {action}-> {tfree} = $Awfif::codelet-> {l}[$myli][32];
        };#if
      };#tfree set
# groupsinvtidu1
    if ($Awfif::codelet-> {l}[$myli][35] != 0) {

      if (!defined ($Awfif::clp-> {action}-> {transid})) {

        $Awfif::clp-> {action}-> {transid} = $Awfif::codelet-> {l}[$myli][35];
        };#if
      };#transid set
# groupsinvupoolu1
    if (($Awfif::codelet-> {l}[$myli][38] != 0)
    or ((defined ($Awfif::clp-> {action}-> {usepooling}))
      && ($Awfif::clp-> {action}-> {usepooling} > 0))
    ){

      $usedpooling = 't';
      };#transid set
# groupsinvsubpiu1
    if ($Awfif::codelet-> {l}[$myli][36] != 0) {

      if (!defined ($Awfif::clp-> {action}-> {subpi})) {

        $Awfif::clp-> {action}-> {subpi} = $Awfif::codelet-> {l}[$myli][36];
        };#if
      };#subpi set
# groupsinvtmgriu1
    if ($Awfif::codelet-> {l}[$myli][37] != 0) {

      if (!defined ($Awfif::clp-> {action}-> {transmgrid})) {

        $Awfif::clp-> {action}-> {transmgrid} = $Awfif::codelet-> {l}[$myli][37];
        };#if
      if ($Awfif::codelet-> {l} [$myli] [2] =~ /evaluator/i) {

        $Awfif::tmassl-> {submitted} [$Awfif::codelet-> {l}[$myli][37]] = $Awfif::codelet-> {l}[$myli][2];
        };#if
      };#transmgrid set
    $Awfif::clp-> {strategy} = "$strategy";
    if (defined ($ni)) {

      $Awfif::clp-> {bond}-> {ni} = $ni;
      };#if
    if (defined ($nidl)) {

      $Awfif::clp-> {bond}-> {nidl} = $nidl;
      };#if
    if (defined ($pi)) {

      $Awfif::clp-> {bond}-> {pi} = $pi;
      };#if
    if (defined ($model)) {

      $Awfif::clp-> {group}-> {model} = $model;
      };#if

    if ($sponsor ne '') {

      $Awfif::clp-> {group}-> {sponsor} = $sponsor;
      &updatelog ($myli,'gs',8, $Awfif::clp-> {group}-> {sponsor});
      };#if
# groupsinvpoolu1

    $newli = cdsubmitcodelet ($myli, \$Awfif::clp, $deferred, $addbreak);
    &updatelog ($myli,'gs',9, $Awfif::memes-> {codeleth});
    if ( (((defined ($usepooling)) && ($usepooling)) or ((defined ($usedpooling)) && ($usedpooling)) ) && (($ctail = poolctail ($myli, $Awfif::codelet-> {l} [$myli] [36], \$psponsori)) > 0) && ($Awfif::codelet-> {l} [$ctail] [38] > 0) ){

      $Awfif::subpl-> {q} [3] [$psponsori] [$Awfif::codelet-> {l} [$myli] [36]] = addpoolc ($newli, $Awfif::subpl-> {q} [3] [$psponsori] [$Awfif::codelet-> {l} [$myli] [36]]);
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("groupsinv1x ret $newli\n");
      };
    return $newli
    }# groupsinv1
#
#<!-- start tag scc -->
#
sub gclab {
    my ($myli, $as, $ae, $ael, $sponsor) = @_;
    my ($i, $i2, $label, $ltype, $aer);
# inversion of labinv1 gc code
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gclab myli $myli as $as ae $ae ");
      if ($myli > 0) {
        &itcpoutput ($myli);
        };
      };

    $label = '';
    $ltype = '';
    $i2 = 0;
    $aer = '';
#
# gclabnsu1

    $i = trwsoadr ($as, 1);
    while ((($ael && !$aer) or (!$ael && ($i != $ae))) && ( awsoadr ($i) != 0)) {
      if ($ael && ($i == $ae)) {
        $aer = 't';
        };
# sponsor is now stable can mark its position in group members wso

      if ($sponsor ne '') {# if use defined here no work gets done???
        my ($ngcsponsor);
        $ngcsponsor =
          $Awfif::wsol-> {l}[awsoadr ($i)][ $Awfif::memes-> {wsogcsponsor}]; #*** submacrok ***#

        if (($ngcsponsor != 0) && ($ngcsponsor != $sponsor)) {&break ()};
        $Awfif::wsol-> {l}[awsoadr ($i)][ $Awfif::memes-> {wsogcsponsor}] = $sponsor;#*** submacrok ***#
        $Awfif::wsol-> {l}[awsoadr ($i)][ $Awfif::memes-> {wsogcsponsored}] = $sponsor;#*** submacrok ***#
        };#update sponsor if specified
#
      $i = trwsoadr ($i, 1);
      };#while

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gclabx\n");
      };
    }# gclab
#
#<!-- end tag scc -->
#<!-- start tag gc -->
#
sub groupbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#codelet launch architecture requires the ignored parameters for its general interface
    my ($grouppresent, $from, $to, $target, $sponsor, $gtype, $model, $as, $ae,
      $wsoindisle, $wsoindisue, $hle, $hue, $dontactivate, $dontdeploy, $iedesc, $jhlsi, $transmgrid, $bcindex, $patelhwso,
      $signal, $schema, $swstype,#dummies for inverted proc get context
      $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat, $gbiest, $gbieet, $gbost, $gboet,
      $grkwp, $grkwpr, $cdn, $cdnx);
#
# create a group if the situation allows - and action appropriate schematic phenomena

    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3)) {#proceed
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      if (greaterwso ($Awfif::codelet-> {l}[$myli][7], $Awfif::codelet-> {l}[$myli][4])) {
        &itwsoutput ( trwsoadr ($Awfif::codelet-> {l}[$myli][7], 1), $Awfif::codelet-> {l}[$myli][4]);
        }
      else {
        &itwsoutput ( trwsoadr ($Awfif::codelet-> {l}[$myli][4], 1), $Awfif::codelet-> {l}[$myli][7]);
        };
      };
    if ($Awfif::memes-> {trace} == $Awfif::memes-> {tracehrtime}) {
      use Time::HiRes 'time';
      ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat) = localtime(time);
      };
    if (($model == $Awfif::memes-> {snnh} {indequiv})
    && (gcompleted ($from, $Awfif::codelet-> {l} [$myli] [37]))
    ) { # no point to do anything
      }
    else {
# groupbuilderwgcu1
# use the wontgroup cache

    $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{stop};
    if ( (defined ($Awfif::memes-> {grpbsp21break}))
    && ($Awfif::memes-> {grpbsp21break} == $Awfif::codelet-> {l} [$myli] [21])
    ){

      &break();
      };#if
    $hue = '';
    $grouppresent = "";
    $dontactivate = '';
    $dontdeploy = '';
    &csetuplog ($myli, 'gb', $Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][7]);
    &updatelog ($myli,'gb',1, $Awfif::codelet-> {l} [$myli][13]);
# it will fight any incompatible structures. And
# if it wins, it will
# destroy all incompatible structures,
# build the new group descriptor and

    $from = $Awfif::codelet-> {l} [$myli][4];
    $to = $Awfif::codelet-> {l} [$myli][7];
    $model = $Awfif::codelet-> {l} [$myli][16];
# update codelets sponsor info
    if ($model == $Awfif::memes->{groupsponsor}) { # this should be got from the slipnet

      $gtype = bndsgroup ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]);
      }# group sponsor
    elsif (($model == $Awfif::memes-> {snnh} {indequiv})
    && (!gcompleted ($from, $Awfif::codelet-> {l} [$myli] [37]))
    ) { # this should be got from the slipnet

      $gtype = bndsgroup ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]);
      }# ie telomere
    else {

      my ($sgdi, $sbind);
      $gtype = $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3];
      &fsgrpd ($myli, $sponsor, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );# has the sponsor moved?
      if ($sponsor != ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi})) {#migrate the sponsor
        $sponsor = ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi});
        $Awfif::codelet-> {l}[$myli][17] = $sponsor;
        };
      };
# groupbuilderiecu1
# see if can use indequiv cache

    if ( ( ($iedesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($sponsor)] [2], $Awfif::memes-> {snnh} {indequiv})) != 0 )
    && ( ($jhlsi = ($Awfif::workspace-> {l} [$iedesc] [2] - $Awfif::memes-> {snnh} {wsi})) != 0 )
    && ($Awfif::jhls-> {l} [$jhlsi] [15][1])
    ){
# groupbuildersgju3
      my ($miedesc);
      $miedesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($sponsor, -1))] [2], $Awfif::memes-> {snnh} {mindequiv});
# groupbuildertrau3
# check for transid

      $gbiest = time ();
      $Awfif::memes-> {gbiec}++;# groupbuilder ie entry counter
      my ($i, $sigcount, $a17, $ai, $transid, $atelhwso, $subpid, $ltransmgrid);
      my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);

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

        $transid = $Awfif::codelet-> {l} [$myli] [35];
        };#if
# groupbuildertramgru1
# see if get a transid and subpid from the transmgr

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

        $transmgrid = $Awfif::codelet-> {l} [$myli] [37];
        };#if
      if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

        $subpid = $Awfif::codelet-> {l} [$myli] [36];
        };#if
      $atelhwso = awsoadr ( trwsoadr($sponsor,-1));
      if ((defined($atelhwso)) && (($bcindex = matchbreakthawso ($atelhwso, $subpid)) > 0)
      ){

        &break ();
        };#if
# initiate group complete action
      $Awfif::memes-> {fatp}++;
# send activation to all the groups descriptor's Slipnet nodes

      $as = $Awfif::jhls-> {l}[$jhlsi][16][0];
      $ae = $Awfif::jhls-> {l}[$jhlsi][16][1];
      $i = $as;
      while (($i != trwsoadr ($ae, 1)) && ( ($ai = awsoadr ($i)) != 0)) {
        &actobj ($i, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), ampdesc ($myli, $sponsor));
        &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]| $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}])), undef());
        $i = trwsoadr ($i, 1);
        };#activate group's new object descriptors
      $hle = '';
      $hue = '';
# mark group as complete
# groupcgsicu1

      $a17 = awsoadr ($Awfif::codelet-> {l}[$myli][17]);#group sponsor
      $patelhwso = awsoadr (trwsoadr ($Awfif::codelet-> {l}[$myli][17],-1));
      if ((defined ($transmgrid)) && ($transmgrid != 0) && (defined ($subpid)) && ($subpid > 0)) {

        $ltransmgrid = $transmgrid;#should pass in undef unless the transmgr is associated with a subprogram
        };#if
      $Awfif::wsol-> {l} [$a17][2]
        = inccounter ( $gtype,
          ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($as, 1)), #must point to start
          $Awfif::memes-> {snnh} {groupstart},
          $Awfif::wsol-> {l} [$a17][2],
          $a17,
          undef (),
          undef (),
          undef (),
          $ltransmgrid,
          $patelhwso,
          -1);#indicate if setting a transaction managed counter
# groupcgeicu1

      $Awfif::wsol-> {l} [$a17][2]
        = inccounter ( $gtype,
          ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($ae, -1)), #must point to end
          $Awfif::memes-> {snnh} {groupend},
          $Awfif::wsol-> {l} [$a17][2],
          $a17,
          undef (),
          undef (),
          undef (),
          $ltransmgrid,
          $patelhwso,
          -1);#indicate if setting a transaction managed counter
# group completion invalidates group salience caches

      $i = trwsoadr ($as, 1);
      while (($i != $ae) && ( awsoadr ($i) != 0)) {
        &wsclinv (wsbasetype ($i), $Awfif::memes-> {currentwsbi}, ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {delta}]));
        &itwscachecor ('tdgroup', wsbasetype ($i), 'seq', 'groupbuilder1');
        $i = trwsoadr ($i, 1);
        };

      &setcache ('bugroup', 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}, (1 + $Awfif::memes-> {backoffactive} {'tdgroup'})) ;
# group completion increases energy
      $Awfif::memes-> {fatp} = $Awfif::memes-> {fatp} + $Awfif::memes-> {gatp};
# dname is activated in case it can now be deployed in the group
      &actnodes ($Awfif::memes-> {snnh} {dname}, $Awfif::memes-> {groupatype}, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
# apply the linking function of group completion
# groupbnsu1
      if (defined ($ltransmgrid)) {#indicate this is a subprogram

        $Awfif::wsol-> {l}[awsoadr ($sponsor)][ $Awfif::memes-> {wsosubpid}] = $subpid;#*** submacrok ***#
        }#if
      &gclab ($myli, $as, $ae, '', $sponsor);
      $sigcount = usebice ($Awfif::jhls-> {l} [$jhlsi] [16][2], \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
# if the groups labels result in a match with a signal then raise the signal
#

      if ($sigcount > 0) {
        my ($i2);
        for ($i = 0; $i < $sigcount; $i++) {
          if ($lomatchs[$i]) {#there is a link launch the action scout
# unless this is an operon
            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})) {
              my ($asponsor, $counteri);
# groupbuildersubpu3

              if ($Awfif::memes-> {gcnfcsuse}) {&itcsuse ();};
              $Awfif::clp = ();
              $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
              $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchm});
# see if can reflect the amplification in the urgency

              if ( ((defined ($Awfif::memes-> {gburgampbreak})) )
              && ($Awfif::memes-> {gburgampbreak})
              && (ampdesc ($myli, $sponsor) > 1)
              ){

                &break();
                };#if
              $Awfif::clp-> {urgency} = ($Awfif::clp-> {urgency} * ampdesc ($myli, $sponsor));
              if ($Awfif::codelet-> {l}[$myli][19] != 0) {
                $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
                }#wsi set
              else {
                $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
                };
# groupbuildertfu1
# apply cascadesponsorship

              $Awfif::clp-> {action}-> {tfree} = cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{getcassponsor});
              $Awfif::clp-> {strategy} = "tgoalscout";
# groupbuilderdsu2
# apply delayselect

              if ( (findcounter ($Awfif::wsol-> {l} [$a17][2], $Awfif::memes-> {snnh} {delayselect}, \$counteri))
              && ($Awfif::workspace-> {l} [$counteri] [9] > ($Awfif::memes-> {snnh} {wsi} + 0))
              ){

                $Awfif::clp-> {delayselect} = ($Awfif::workspace-> {l} [$counteri] [9] - $Awfif::memes-> {snnh} {wsi}) * $Awfif::memes-> {waitamp};
                &resetcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                &maskcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                };#if
              $Awfif::clp-> {action}-> {sponsor} = $sponsor;
              $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}-> {wsoname} = getwsoname ($lostrts[$i]);
              $Awfif::clp-> {action}-> {wse} = $loends[$i];
              $Awfif::clp-> {action}-> {jhlabeli} = $lola[$i];
              $Awfif::clp-> {action}-> {jhlabeloi} = gettjhlsoi (($asponsor = awsoadr($sponsor)), $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]);#*** submacrok ***#
# groupbuildersgju1
              if ($miedesc > 0){

                my ($sgjhlsi);
                $sgjhlsi = ($Awfif::workspace-> {l} [$miedesc][2] - $Awfif::memes-> {snnh} {wsi});
                $Awfif::clp-> {action}-> {sgjhlsi} = $sgjhlsi;
                };#if
# groupbuildertrau4
              if (defined ($transid)) {

                $Awfif::clp-> {action}-> {transid} = $transid;
                };#if
# groupbuildersubpu4
              if (defined ($subpid)) {

                $Awfif::clp-> {action}-> {subpi} = $subpid;
                $Awfif::clp-> {urgency} *= $Awfif::memes-> {submult};
                };#if
              if (defined ($transmgrid)) {

                $Awfif::clp-> {action}-> {transmgrid} = $transmgrid;
                };#if
              &icdsubmitcodelet ($myli, \$Awfif::clp, $Awfif::jhls-> {l} [$lola[$i]] [10], $grkwp, $grkwpr, \@$sactset);
              if (($bcindex = matchbreakthawso (awsoadr( trwsoadr($sponsor, -1)), $subpid)) > 0) {

                &remarrent ($bcindex, \@{$Awfif::memes-> {breakthwso}});
                &remarrent ($bcindex, \@{$Awfif::memes-> {breakthsubp}});
                $Awfif::memes-> {breakcodelet} [ ++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {submitted};
                $Awfif::memes-> {breaksubp} [ ++$Awfif::memes-> {breaksubp} [0]] = $subpid;
                };#if
              &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {group}, undef(), awsoadr( $sponsor), $Awfif::codelet-> {l} [$myli] [36]);
              &actnodes ( $Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {openatype},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
              &invcaches ($Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}]);
              }; #if its not an operon
            };#launch the action scout
          };#for
        };
# groupcompletemau2

      $gbieet = time ();
      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbiesum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbiesum}] + $gbieet - $gbiest;
      }# use indequiv cache
    else {#proceed with groupbuilder
# groupbtimeu2

    $gbost = time ();
    $Awfif::memes-> {gboc}++;# groupbuilder other entry counter
# allocate target
    if (($Awfif::codelet-> {l} [$myli][16] == $Awfif::memes->{groupsponsor})
    or ($Awfif::codelet-> {l} [$myli][16] == $Awfif::memes-> {snnh} {indequiv})
    or ($Awfif::codelet-> {l} [$myli][16] < 0)
# this fix works for successor but probably not for pred or adj
# have to work out what really happens
    ) {#gs and add update ni

      $target = $from;
      }
    else {# member updates pi

      $target = $to;
      };
# also target the activation
    $as = $target;
    $ae = $target;
# first check whether the proposed group hasn't been built in the mean time.
# - check the descriptor list at ni to see if their is a descriptor
# for a group category of the required type and to the target
# may look odd but all group descriptors have the group sponsor in [2] which traces as pi in findbond
#

    $grouppresent = findbond ($Awfif::wsol-> {l} [ awsoadr ($target)] [2], $sponsor, $gtype, $Awfif::memes-> {snnh} {groupcategory});
    &updatelog ($myli,'gb',2, $grouppresent);
#
# groupbgcu1

    my ($astelhwso, $rtransmgrid, $stransmgrid, $ssubpid, $susetrans);

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

      $rtransmgrid = $Awfif::codelet-> {l} [$myli] [37];
      };#if
    if ( ($Awfif::wsol-> {l} [($astelhwso = awsoadr ( trwsoadr($target,-1)))] [2] != 0)
    && ( (findtdesc ($Awfif::wsol-> {l} [ ($astelhwso)] [2], $Awfif::memes-> {snnh} {telomere})) != 0 )
    && ( (findtdesc ($Awfif::wsol-> {l} [ ($astelhwso)] [2], $Awfif::memes-> {snnh} {mindequiv})) != 0 )
    ){

      $susetrans = 0;
      $ssubpid = $Awfif::codelet-> {l} [$myli] [36];
      $stransmgrid = gettmgr ($myli, $astelhwso, $Awfif::memes-> {snnh} {stran}, \$susetrans, \$ssubpid);
      };#if
    if ((!($grouppresent)
      && (!gcompleted ($target, $stransmgrid)) #at this point still guessing where the atelhwso might be
      && (
        (!(wontgroup ($myli, $target, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset))
        or ((!($hue)) && (!$hle) && ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [wsbasetype ($target)] != 0))
      ))
      )
    or ((!gcompleted ($sponsor, $rtransmgrid))
      && (!gcompleted ($target, $stransmgrid)))
    ) {

      my ($sgdi, $dgdi, $sbind, $i, $pr);
# If not,
      $pr = $Awfif::memes-> {currentwsbi};
      print ("gc from=$pr:$from, to=$to, ptarget=$target ");
      &updatelog ($myli,'gb',3, $target);
# if will be deploying into an adjoining group then change that groups descriptors to this sponsor
      if ((($target == $to)
      && (fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      && (fsgrpd ($myli, $from, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind )))

      or (($target == $from)
      && (fsgrpd ($myli, trwsoadr ($target,-1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      && (fsgrpd ($myli, $target, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
      && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind )))
        ) {# convert the sponsors to match this one

        &updatelog ($myli,'gb',4, $target);
        if (greatergwso ($target, $from)) {#look ascending
          $as = $target;
          do {

            $ae = $target;
            $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
            $target = trwsoadr ($target,1);
            }

          while ((fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
          && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
          &&(!(wontgroup ($myli, $target, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue))));

          if ($hue) {
            $dontdeploy = 't';
# groupbuilderwgcu2
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            };
          if (((fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hue))
          && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))){

            $ae = $target;
            $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
            $target = trwsoadr ($target,1);
            }
          elsif ((!fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #want to add a group so make sure target pointing correctly when -- aplied

            && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {
            $target = trwsoadr ($target,1);
            }
          elsif ((!fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #this should have been stopped in the ge but .... lets ensure we don't deploy

            && (!fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {
            $dontdeploy = 't';
# groupbuilderwgcu3
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            };

          $target = trwsoadr ($target,-1);
          }
        else {# potentially both ways
          $ae = $target;
          $as = trwsoadr ($target,-1);

          if (
            (fsgrpd ($myli, trwsoadr ($target,1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
          && (wontgroup ($myli, trwsoadr ($target,1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset))
          && ($hle)
            ) {

            $dontdeploy = 't';
# groupbuilderwgcu4
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            }
          elsif (
            !fsgrpd ($myli, $target, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind )
            ) {# target does not have a bond

            $dontdeploy = 't';
# groupbuilderwgcu5
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            }
          elsif (
            (fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #if a group has appeared then don't want another one
            ) {# ni has been filled in so try and find a new target at the edge of the group
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $as = trwsoadr ($as,-1);
              }
            while ( (fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            && (!(wontgroup ($myli, $as, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hle))) );

            if (((fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hle))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {

              $as = trwsoadr ($as,-1);
              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              };

            $as = trwsoadr ($as, 1);
            $ae = trwsoadr ($target, 1);
            $target = $as;
            if ( (
              (fsgrpd ($myli, trwsoadr ($target, 1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (wontgroup ($myli, trwsoadr ($target, 1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset))
            && ($hle)
            )
            or (
              (fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #if a group has appeared then don't want another one
              )
              ) {
              $dontdeploy = 't';
# groupbuilderwgcu6
              if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
                $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
                };
              };
            fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae = trwsoadr ($ae, 1);
              }
            while ((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, trwsoadr ($ae, -1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            &&(!(wontgroup ($myli, $ae, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue))));

            if (((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hue))
            && (fsgrpd ($myli, trwsoadr ($ae, -1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))){

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae++;
              };

            $ae = trwsoadr ($ae, -1);
            print ("5.4.3 target=$target\n");
            }
          else {
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $as--;
              }
            while ( (fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            && (!(wontgroup ($myli, $as, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hle))) );

            if (((fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hle))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {

              $as = trwsoadr ($as,-1);
              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              };

            $as = trwsoadr ($as, 1);
            $ae = trwsoadr ($target, 1);
            fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae++;
              }
            while ((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, $ae-1, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            &&(!(wontgroup ($myli, $ae, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue))));

            if (((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hue))
            && (fsgrpd ($myli, $ae-1, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))){

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae = trwsoadr ($ae, 1);
              };

            $ae = trwsoadr ($ae, -1);
            print ("8.4.3 target=$target\n");
            };
          };#ok to deploy upwards
        }#target is from
      elsif (($target == $to) && (wontgroup ($myli, $from, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)&& ($wsoindisue) && ($hue))) {#do no deployment but later check if reached both ends

        print ("no target\n");
        $dontactivate = 't';
        $dontdeploy = 't';
        if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
          $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
          };
        &actnodes ($Awfif::memes->{snnh}{groupd}, $Awfif::memes-> {ntact},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        if (($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {groupu} < $Awfif::memes-> {actth}) && ($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snna}{groupd} > $Awfif::memes-> {actth})) {
          &setinhib ($Awfif::memes-> {snnh} {groupd}, 0);#limit flip-flop
          $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnafm} {groupu} = $Awfif::memes-> {fatigue};
          &setinhib ($Awfif::memes-> {snnh} {groupu}, $Awfif::memes-> {fatigue});#limit flip-flop
          };
        }
      elsif (($target == $from) && (wontgroup ($myli, $to, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)&& ($wsoindisle) && ($hle))) {#do no deployment but later check if reached both ends

        $dontactivate = 't';
        &actnodes ($Awfif::memes->{snnh}{groupu}, $Awfif::memes-> {ntact},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        $dontdeploy = 't';
        $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
        if (($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snna}{groupd} < $Awfif::memes-> {actth}) && ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {groupu} > $Awfif::memes-> {actth})) {
          &setinhib ($Awfif::memes-> {snnh} {groupu}, 0);#limit flip-flop
          $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnafm} {groupd} = $Awfif::memes-> {fatigue};
          &setinhib ($Awfif::memes-> {snnh} {groupd}, $Awfif::memes-> {fatigue});#limit flip-flop
          };
        print ("no target\n");
        }
      elsif (($target == $from)
        && (fsgrpd ($myli, $from, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
        ) {#do no deployment but later check if reached both ends

        $dontactivate = 't';
        $dontdeploy = 't';
        print ("no target\n");
        $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
        }

      if (!($dontdeploy)) {
        my ($atarget);
        $atarget = awsoadr ($target);
        print ("9 target=$target\n");
        &setusalcwsocache ($atarget, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}])), undef());
        $Awfif::wsol-> {l} [ $atarget][2]
        = setupdesc ( $gtype,
            ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]), #must point to sponsor
            $Awfif::memes-> {snnh} {groupcategory},
            $Awfif::wsol-> {l} [$atarget][2],
            $atarget);
        &updatelog ($myli,'gb',7, $Awfif::wsol-> {l} [$atarget][2]);
        };

      &invcaches (wsbasetype ($target), ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
      &invcaches (wsbasetype ($from), ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
      &invcaches (wsbasetype ($to), ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
      if (!($dontactivate)) {
        $Awfif::memes-> {fatp}++;
# send activation to all the groups descriptor's Slipnet nodes

        $i = $as;
        while (($i != trwsoadr ($ae, 1)) && ( awsoadr ($i) != 0)) {
          &actobj ($i, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), (ampdesc ($myli, $sponsor)));
          $i = trwsoadr ($i, 1);
          };#activate group's new object descriptors
        };

      $hle = '';
      $hue = '';
      $as = $Awfif::codelet-> {l}[$myli][17];
      $ae = $Awfif::codelet-> {l}[$myli][17];
      while ( (fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      && (!(wontgroup ($myli, $as, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hle))) ) {

        $as = trwsoadr ($as, -1);
        };
      if ($hle) {#as is expected to be beyond the group by 1
        $as = trwsoadr ($as, -1);
        }

      while ((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      &&(!(wontgroup ($myli, $ae, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue)))) {
        $ae = trwsoadr ($ae, 1);
        };
      if ($hue) {#ae is expected to be beyond the group by 1
        $ae = trwsoadr ($ae, 1);
        }
# align all the sponsors

      $i = trwsoadr ($as, 1);
      while (($i != $ae) && ($i != 0 ) && ( awsoadr ($i) != 0)) {

        &fsgrpd ($myli, $i, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );
        $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
        $i = trwsoadr ($i, 1);
        }
# if the group is now complete - i.e.its ends can't extend any further
# groupcomplete

      if ((wontgroup ($myli, trwsoadr ($as, 1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset) && ($wsoindisle) && ($hle))
      && (wontgroup ($myli, trwsoadr ($ae, -1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset) && ($wsoindisue) && ($hue))) {
# initiate group complete action
        my ($i, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $a17, $use, $ai);
# see if to use delta or not
        if (findtdesc ($Awfif::wsol-> {l} [ awsoadr ($as) ][2], $Awfif::memes-> {snnh} {telomere}) != 0){#telomere so delta use

          $use = 1;
          }#if
        else {

          $use = 0;
          };
# mark group as complete

        $a17 = awsoadr ($Awfif::codelet-> {l}[$myli][17]);
        $patelhwso = awsoadr (trwsoadr ($Awfif::codelet-> {l}[$myli][17], -1));
        $Awfif::wsol-> {l} [$a17][2]
          = inccounter ( $gtype,
            ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($as, 1)), #must point to start
            $Awfif::memes-> {snnh} {groupstart},
            $Awfif::wsol-> {l} [$a17][2],
            $a17);

        $Awfif::wsol-> {l} [$a17][2]
          = inccounter ( $gtype,
            ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($ae, -1)), #must point to end
            $Awfif::memes-> {snnh} {groupend},
            $Awfif::wsol-> {l} [$a17][2],
            $a17);
# group completion invalidates group salience caches

        $i = trwsoadr ($as, 1);
        while (($i != $ae) && (($ai = awsoadr ($i)) != 0)) {
# gbwscup
          &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}])), undef());
          &wsclinv (wsbasetype ($i), $Awfif::memes-> {currentwsbi},( $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
          &itwscachecor ('tdgroup', wsbasetype ($i), 'seq', 'groupbuilder1');
          $i = trwsoadr ($i, 1);
          };

        &setcache ('bugroup', 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}, $use + $Awfif::memes-> {backoffactive} {'tdgroup'}) ;
# group completion increases energy
        $Awfif::memes-> {fatp} = $Awfif::memes-> {fatp} + $Awfif::memes-> {gatp};
# dname is activated in case it can now be deployed in the group
        &actnodes ($Awfif::memes-> {snnh} {dname}, $Awfif::memes-> {groupatype}, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
# apply the linking function of group completion
        $sigcount = labinv1 ($myli, $as, $ae, '', $sponsor, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'notoporstbinding');
# if the groups labels result in a match with a signal then raise the signal
#

        if ($sigcount > 0) {
          my ($i2, $atti, $counteri);
          for ($i = 0; $i < $sigcount; $i++) {
            if ($lomatchs[$i]) {#there is a link launch the action scout
# unless this is an operon
              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})) {
                my ($asponsor, $transid, $subpid, $teldesc);
# if this is the first group complete
                if ($Awfif::wsol-> {l}[($asponsor = awsoadr ($sponsor))][ $Awfif::memes-> {wsogcspjhlsi}] == 0) {#*** submacrok ***##this is a new group complete
                  my ($newjhlsi, $atelhwso);
# initialise the ws specific slipnet items

                  ©sn1 ($Awfif::memes-> {currentwsbi}, $Awfif::memes->{snnih}{$Awfif::jhls-> {l} [$lola[$i]] [6]});
# add a jhlabel for this workspace group
# groupbuilderiecu5

                  $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}]);
# groupbuilderiecu6
# 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;
# groupbuildertrau1
# if this schemata has indequiv true check the telomeric head wso (logically sponsor - 1) for a transid descriptor
# if find one remember to deploy a transid

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

                      $transid = $Awfif::codelet-> {l} [$myli] [35];
                      };#if
                    }; #if
# groupbuildertramgru2
# see if get a transid and subpid from the transmgr
                  if (defined ($atelhwso)) {


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

                      $transmgrid = $Awfif::codelet-> {l} [$myli] [37];
                      };#if
                    if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

                      $subpid = $Awfif::codelet-> {l} [$myli] [36];
                      };#if
                    if ((defined($atelhwso)) && (($bcindex = matchbreakthawso ($atelhwso, $subpid)) > 0)
                    ){

                      &break ();
                      };#if
# groupbnsu2
                    if ((defined ($subpid)) && ($subpid > 0) ) {

                      $Awfif::wsol-> {l}[awsoadr ($sponsor)][ $Awfif::memes-> {wsosubpid}] = $subpid;#*** submacrok ***# cache a subpid for this subprogram schemata
                      };#if
# groupcgsicu2
                    if ((defined ($transmgrid)) && ($transmgrid != 0) && (defined ($subpid)) && ($subpid > 0)) {

                      $Awfif::wsol-> {l} [$a17][2]
                        = inccounter ( $gtype,
                        ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($as, 1)), #must point to start
                        $Awfif::memes-> {snnh} {groupstart},
                        $Awfif::wsol-> {l} [$a17][2],
                        $a17,
                        undef (),
                        undef (),
                        undef (),
                        $transmgrid,
                        $patelhwso,
                        -1); #indicate if setting a transaction managed counter
# groupcgeicu2

                      $Awfif::wsol-> {l} [$a17][2]
                        = inccounter ( $gtype,
                        ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($ae, -1)), #must point to end
                        $Awfif::memes-> {snnh} {groupend},
                        $Awfif::wsol-> {l} [$a17][2],
                        $a17,
                        undef (),
                        undef (),
                        undef (),
                        $transmgrid,
                        $patelhwso,
                        -1);#indicate if setting a transaction managed counter
                      };#if
                    };#if
# groupbuildersubpu1

# groupbuilderiecu3
# groupbuilderiecu2
                  if (writeiecok ($sponsor)
                  ){
# groupbuilderiecu4

                    $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
# groupcompleteclp

                &itcsuse ();
                $Awfif::clp = ();
                if ((defined ($myli)) && ((!defined ($Awfif::codelet-> {l} [$myli] [13])) or ($Awfif::codelet-> {l} [$myli] [13] == 0)) && (( $Awfif::wsol-> {l} [awsoadr ($sponsor)] [8] != 0)
                or ($Awfif::wsol-> {l}[awsoadr ($sponsor)][ $Awfif::memes-> {wsologucount}] != 0))) {&break()};#*** submacrok ***#
                $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
                $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchm});
# see if can reflect the amplification in the urgency
                if ( ((defined ($Awfif::memes-> {gburgampbreak})) && (defined ($teldesc)))
                && ($Awfif::memes-> {gburgampbreak})
                && ($teldesc > 0)
                && (ampdesc ($myli, $sponsor) > 1)
                ){

                  &break();
                  };#if

                $Awfif::clp-> {urgency} = ($Awfif::clp-> {urgency} * ampdesc ($myli, $sponsor));
                if ($Awfif::codelet-> {l}[$myli][19] != 0) {
                  $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
                  }#wsi set
                else {
                  $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
                  };
# groupbuildertfu2
# apply cascadesponsorship

                $Awfif::clp-> {action}-> {tfree} = cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{getcassponsor});
                $Awfif::clp-> {strategy} = "tgoalscout";
# groupbuilderdsu1
# apply delayselect

                if ( (findcounter ($Awfif::wsol-> {l} [$a17][2], $Awfif::memes-> {snnh} {delayselect}, \$counteri))
                && ($Awfif::workspace-> {l} [$counteri] [9] > ($Awfif::memes-> {snnh} {wsi} + 0))
                ){

                  $Awfif::clp-> {delayselect} = ($Awfif::workspace-> {l} [$counteri] [9] - $Awfif::memes-> {snnh} {wsi}) * $Awfif::memes-> {waitamp};
                  &resetcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                  &maskcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                  };#if
                $Awfif::clp-> {action}-> {sponsor} = $sponsor;
                $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}-> {wsoname} = getwsoname ($lostrts[$i]);
                $Awfif::clp-> {action}-> {wse} = $loends[$i];
                $Awfif::clp-> {action}-> {jhlabeli} = $lola[$i];
# gbwstup
                $Awfif::clp-> {action}-> {jhlabeloi} = gettjhlsoi ($asponsor, $Awfif::wsol-> {l}[$asponsor][$asponsor]);#*** submacrok ***#
# groupbuildertrau2
                if (defined ($transid)) {

                  $Awfif::clp-> {action}-> {transid} = $transid;
                  };#if
# groupbuildersubpu2
                if (defined ($subpid)) {

                  $Awfif::clp-> {action}-> {subpi} = $subpid;
                  $Awfif::clp-> {urgency} *= $Awfif::memes-> {submult};
                  };#if
                if (defined ($transmgrid)) {

                  $Awfif::clp-> {action}-> {transmgrid} = $transmgrid;
                  };#if
# groupbuildersgju2
                if ($teldesc > 0){

                  my ($sgjhlsi);
                  $sgjhlsi = ($Awfif::workspace-> {l} [$teldesc][2] - $Awfif::memes-> {snnh} {wsi});
                  $Awfif::clp-> {action}-> {sgjhlsi} = $sgjhlsi;
                  };#if
                &icdsubmitcodelet ($myli, \$Awfif::clp, $Awfif::jhls-> {l} [$lola[$i]] [10], $grkwp, $grkwpr, \@$sactset);
                if (($bcindex = matchbreakthawso (awsoadr( trwsoadr($sponsor, -1)), $subpid)) > 0) {

                  &remarrent ($bcindex, \@{$Awfif::memes-> {breakthwso}});
                  &remarrent ($bcindex, \@{$Awfif::memes-> {breakthsubp}});
                  $Awfif::memes-> {breakcodelet} [ ++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {submitted};
                  if ($subpid > 0) {
                    $Awfif::memes-> {breaksubp} [ ++$Awfif::memes-> {breaksubp} [0]] = $subpid;
                    };#if
                  };#if
                &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {group}, undef(), awsoadr( $sponsor), $Awfif::codelet-> {l} [$myli] [36]);
                &actnodes ( $Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {openatype},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
                &invcaches ($Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}]);
                }; #if its not an operon
              };#launch the action scout
            };#for
          };

# groupcompletemau1

        };#group complete
      };#if no group
      $gboet = time ();
      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbosum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbosum}] + $gboet - $gbost;
      };#else indequiv cache
      };#proceed wrap
# groupbuilderwgcu7
# drop the wontgroup cache

    $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh} {stop};
    };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);#should do role out of descriptors
    }# groupbuilder1
#
#<!-- end tag gc -->
#<!-- start tag smo -->
#<!-- start tag inh -->
#
sub nuclabmbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($sponsor, $signal, $schema, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $operoncount, $proceed, $swstype,
      $grkwp, $grkwpr, @operation, $cdn, $cdnx);
#
# updated for merged workspaces

# goals must use the full workspace

    $proceed = getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, undef(), \$cdn, \$cdnx, 3);
# handle rework

    if (($proceed) && ($Awfif::codelet-> {l} [$myli][14] != 0)) {#rework so use previous parameters
      &reuselog ($myli);

      if ((($signal == $Awfif::memes->{snnh}{mpsignal}) && (defined($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$schema])))) {
        my ($spws);
        $spws = $Awfif::codelet-> {l} [$myli] [20];
        &updatelog ($myli, 'tngs', 1, $signal);#
        &updatelog ($myli,'tngs', 2, $schema);#

        print ("tnms sp=$spws:$sponsor,\n");
        }#multipath signal

      }# rework
    elsif ($proceed) {#main line
# Top-down nuclear label group codelets search completed groups looking for a match with their sponsoring label
# when this is true the builder will
# use selsalact to indicate which of the wso in the subschema terminated by the /memgroup are salient.
# transcribe the salient wso string
# to the cytosolic workspace
# the transcription will be active for one iteration of group builder complete when the telomeric strings will become 0 and the
# string of wso will be destroyed
#

      if ((($signal == $Awfif::memes->{snnh}{mpsignal}) && (defined($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$schema])))) {
# Using the mplabel check the nuclear schema for groups that match
        my ($sws, $wss, $wse);
        $sws = $Awfif::codelet-> {l} [$myli] [20];
        $wss = $Awfif::codelet-> {l} [$myli][21];
        $wse = $Awfif::codelet-> {l} [$myli][22];

# nuclabbbice
        if ((defined ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli][23]] [13]))
        && ($Awfif::bicl-> {l} [$Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli][23]] [13]] [3] == $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli][23]] [5])
          ){#there is a cache element setup

          $operoncount = usebice ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli][23]] [13], \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
          }#if
        else {

          $operoncount = operonlmatch ($myli, $Awfif::codelet-> {l} [$myli][23], \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'specwsonlyopbinding', $Awfif::memes-> {currentwsbi});
          if (!defined ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli][23]] [13])) {
            $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli][23]] [13] = addbice ($sws, $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli][23]] [5], $wse, $operoncount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
            };#if
          };#else
        if ($operoncount > 0) {

          my ($loopcount, $bcindex, $loperoncount, @llomatchs, @llola, @lloends, @llostrts, @lloge, @llogb, $opcount, $satisfied, $dontgiveup, $note35, $ctfifound);
          $llomatchs[0] = '';
          $llola [0] = 0;
          $lloends [0] = 0;
          $llostrts [0] = 0;
          $lloge [0] = 0;
          $llogb [0] = 0;
          for ($opcount = 0; $opcount < $operoncount; $opcount++) {
            if ($lomatchs [$opcount]) {

              $loopcount = 0;
# use selsalact to identify salient areas of the subschema of each matching schema

              $satisfied = '';
              $dontgiveup = 't';$ctfifound = '';
              while ((!$satisfied) && ($dontgiveup)) {
                if (($loopcount++ > $Awfif::memes-> {nuclabmblth}) && ($Awfif::memes-> {nuclabmbbreak}) ){ &break ();};
                $llomatchs[0] = $lomatchs [$opcount];
                $llola [0] = $lola [$opcount];
                $lloends [0] = $loends [$opcount];
                $llostrts [0] = $lostrts [$opcount];
                $lloge [0] = $loge [$opcount];
                $llogb [0] = $logb [$opcount];
                $loperoncount = 1;
                @operation = selsaliam ($myli, $sws, $wss, $wse, $operoncount, \@llomatchs, \@llola, \@lloends, \@llostrts, \@lloge, \@llogb, \@$sactset, $Awfif::memes-> {snnh}{model});
                if (($operation[0] ne '')
                && (( $operation [7] == 0 )
                  or (($operation [7] != 0)
                    && ( ( (!defined ($Awfif::jhls-> {l} [$operation [7]][17]))
# nuclabminhu1
                      or ( $dontgiveup = ctficomp ($myli, $operation [7], $kwp, $kwpr, \@$sactset, \$ctfifound) ) ) ) ) )
                ){
                  my ($hashname);
                  $satisfied = 't';

                  if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
                    &itjhloutput ($operation [7]);
                    };
# nuclabinwfcu1
# if find deployment operon in wfc cache ref don't signal deployment

                  if ((! $Awfif::memes-> {wfcoptdep})
                  or (! defined ($hashname = $Awfif::wfcdefl-> {operon} {wsolistaschst ($operation [3], $operation [4], $Awfif::codelet-> {l} [$myli] [19])}))
                  or (!defined ($Awfif::wfchchainl-> {hashname} {$hashname}))# the evaluator has been purged
                  ){

                    $Awfif::clp = ();
                    $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] ); #* $Awfif::memes-> {evlaunchm});
                    $Awfif::clp-> {action}-> {schema} = $schema;
                    $Awfif::clp-> {action}-> {signal} = $signal;
                    $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$myli] [20];
                    $Awfif::clp-> {action}-> {wss} = $operation [3];
                    $Awfif::clp-> {action}-> {wse} = $operation [4];
                    if (($operation [5] != 0)
                    && ($operation [5] != $operation [6]) ){
                      $Awfif::clp-> {action}-> {wsgs} = $operation [5];
                      $Awfif::clp-> {action}-> {wsge} = $operation [6];
                      };#operon has a gap
# nuclabmieu5
                    if (($operation [7] != 0) ){

                      $Awfif::clp-> {action}-> {sgjhlsi} = $operation [7];
                      };#operon has a subgroup jhlsi
# nuclabmtrau1
                    $note35 = $Awfif::codelet-> {l} [$myli] [35];
                    if ( ((defined ($Awfif::codelet-> {l} [$myli] [35])) && ($Awfif::codelet-> {l} [$myli] [35] != 0))
                    && (!schabldr ($myli, $lola [$opcount], $operation [7]))
                    ){#must not propogate the transaction id to this deployment codelet

                      $Awfif::codelet-> {l} [$myli] [35] = 0;
                      };#if
                    $Awfif::clp-> {action}-> {jhlabeli} = $Awfif::codelet-> {l} [$myli][23];
# nuclabmbpoolu1
                    $bcindex = matchbreakcodelet ($myli);#note if there is a breakpoint to conserve
                    &groupsinv1 ($myli, $sponsor, trwsoadr ($sponsor,1), 0, $sponsor, 0, $operation[0], $$kwp, $kwpr, \@$sactset,
                      undef(), #deferred
                      undef(), #ignore wso name
                      't' #attempt usepooling if codelet l 38 is > 0
                      );
                    $Awfif::codelet-> {l} [$myli] [35] = $note35;
                    }#if not a wfc operon match
# nuclabinwfcu2
                  elsif ( (defined ($hashname))
                  && (defined ($Awfif::wfchchainl-> {hashname} {$hashname}))
                  ){#complete this wfc operon matched transaction

                    &compwfctran ($myli, $hashname, $lola [$opcount]);
                    };#elsif
                  }#valid operation
                elsif (($Awfif::codelet-> {l} [$myli] [35] > 0) && ($ctfifound) && (!$dontgiveup) ){#if launch is tf inhibited then terminate the transaction

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

                    $Awfif::tral-> {w} [$Awfif::codelet-> {l} [$myli] [35]][ $trali ] = $Awfif::memes-> {snnh} {terminated};
                    };#for
                  };#elsif
                };#while getting satisfied
              if ($bcindex > 0) {#setup for next child

                $Awfif::memes-> {breakcodelet}[++$Awfif::memes-> {breakcodelet}[0]] = $myli;
                $Awfif::memes-> {breaksubp}[++$Awfif::memes-> {breaksubp}[0]] = $Awfif::codelet-> {l} [$myli] [36];
                };#if
              &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
              };#if
            };# for
          if ((defined ($bcindex)) && ($bcindex > 0)) {

            $Awfif::memes-> {breaksubp}[$Awfif::memes-> {breaksubp}[0]--] = undef();
            $Awfif::memes-> {breakcodelet}[$Awfif::memes-> {breakcodelet}[0]--] = undef();
            };#if
          &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
          };#in group
        };# sps or mps signal
      };# main line

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# nuclabmbuilder1
#
#<!-- end tag inh -->
#<!-- end tag smo -->
#<!-- start tag scc -->
#<!-- start tag uts -->
#<!-- start tag ds -resweb -->
#
sub nsdepbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($sponsor, $signal, $schema, $proceed, $swstype, $noswstype, $telhdr, $atelhdr, $telhdrp1,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# updated for merged workspaces
# uses operon jhlabels

# goals must use the full workspace

    $noswstype = 't';
    $proceed = getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3);
# handle rework

    if (($proceed) && ($Awfif::codelet-> {l} [$myli][14] != 0)) {#rework so use previous parameters
      &reuselog ($myli);

      if ((($signal == $Awfif::memes->{snnh}{mpsignal}) && (defined($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$schema])))) {
        &updatelog ($myli, 'tngs', 1, $signal);#
        &updatelog ($myli,'tngs', 2, $schema);#

        print ("tngs sp=$sponsor,\n");
        }#multipath signal

      }# rework
    elsif ($proceed) {#main line
      my ($i, $dontdepiedesc, $bcindex);
# Top-down nuclear label group scouts validate their calling information and then call in an evaluator to
# match operon jhlabels of completed groups in their workspace with their sponsoring label
# where ever they find a completed group if there is a match request a builder transcribes a salient aspect of the following wso string
# to the cytosolic workspace
# the transcription will be active for one iteration of group builder complete when the telomeric strings will become 0 and the
# string of wso will be destroyed
#

      if ((($signal == $Awfif::memes->{snnh}{mpsignal}) && (defined($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$schema])))) {
        $dontdepiedesc = '';
        if (($Awfif::codelet-> {l} [$myli][30] ne '') && ($Awfif::codelet-> {l} [$myli][30] != 0)) {
          my ($pr);
# nsdepbosu

          $pr = $Awfif::codelet-> {l} [$myli][30];
          };#must add original sponsor to telomeric details
# nsdepubo1
# engage suppressor
        my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $gsws, $gswso, $agswso, $cwsbi2, $counteri);
        if ( (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@{$Awfif::memes-> {sactset}}) == 1)
        ){#

          $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws);
          if ( (ifindb ($myli, 1, 'goalscon', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $$kwp, $kwpr, \@{$Awfif::memes-> {sactset}}, $gsws) == 1)
          ){#
            $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws);
            $cwsbi2 = $Awfif::memes-> {currentwsbi};
            $Awfif::memes-> {currentwsbi} = $gsws;
            $agswso = awsoadr ($gswso);
# if find a notgcompleted then deploy a backoff
            if (findcounter ($Awfif::wsol-> {l} [$agswso][2], $Awfif::memes-> {snnh} {notgcompleted}, \$counteri)) {

              $Awfif::wsol-> {l} [$agswso][2]
                = inccounter (
                  undef (),
                  undef (),
                  $Awfif::memes-> {snnh} {backoff},
                  $Awfif::wsol-> {l} [$agswso] [2],
                  $agswso);
              };#if
            $Awfif::memes-> {currentwsbi} = $cwsbi2;
            };#if goal suppressor present
          };#if
# nsdepieu2
# if there is a sgjhlsi which is marked with deployment cache jhlsi
# nsdepbsubpiu2

        if ((defined ($Awfif::codelet-> {l} [$myli] [31]))
        && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [0])
        && (defined ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]))
        && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3] != 0)
        ){
          my ($cwsbi);

          $cwsbi = $Awfif::memes-> {currentwsbi};
          $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
# nsdeptrmau2
          ($telhdr=$Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]);
          $atelhdr = awsoadr ($telhdr);
          $telhdrp1 = trwsoadr ($telhdr, 1);
          if ((defined ($Awfif::memes-> {nsdepschemabreak}))
          && ($telhdrp1 == $Awfif::memes-> {nsdepschemabreak})
          ){

            &break ();
            };#if
# 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
          $Awfif::codelet-> {l}[$myli] [37] = assandmaptran ($myli, $myli, $Awfif::codelet-> {l}[$myli] [37], $atelhdr, $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l}[$myli] [36]);
# nsdepieu3
          ¬gcompleted ($myli,
            $telhdrp1,
            teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),
            undef(), #esupp
            undef(), #strategy
            undef(), #dontamp
            undef(), #stws
            undef(), #issubp
            undef(), #subp
            't', #nodebug
            't', #nodelayselect
            undef (), #delayselamp
            't' #usepooling
            );# sponsor should be one after telomeric header
          if (($bcindex = matchbreakcodelet ($myli)) > 0) {

            &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
            $Awfif::memes-> {breakthwso} [ ++$Awfif::memes-> {breakthwso} [0]] = $atelhdr;
            $Awfif::memes-> {breakthsubp} [ ++$Awfif::memes-> {breakthsubp} [0]] = $Awfif::memes-> {breaksubp}[$bcindex];
            &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
            };#if
          &trackcodelet ($myli, $myli, $Awfif::memes-> {snnh} {telomere}, undef(), $atelhdr, $Awfif::codelet-> {l} [$myli] [36]);
          $dontdepiedesc = 't';
          if ( ($Awfif::codelet-> {l} [$myli] [17] == 0)
          && ($telhdr != 0)
          ){#ensure that codelet sponsor is set before do any roleout

            $Awfif::codelet-> {l} [$myli] [17] = $telhdrp1;
            };#if
# switch back ws
          $Awfif::memes-> {currentwsbi} = $cwsbi;
          }#if
        else {

          &depssast ($myli, $sponsor, $Awfif::codelet-> {l} [$myli] [20], $Awfif::codelet-> {l} [$myli][21], $Awfif::codelet-> {l} [$myli][22], $Awfif::memes-> {currentwsbi});
          $Awfif::memes-> {newdep}++;#note that there are new telomeric schemata for applycodelet etc
          };
# nsdepbieu1
# if there is a sgjhlsi

        if ((defined ($Awfif::codelet-> {l} [$myli] [31]))
# && the ie cache is enabled
        && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [0])
        && (!$dontdepiedesc)
        ){
          my ($ni, $ani, $descid, $cwsbi, @matches, @matchne, @matchni, $endmatch);
# get the telomeric header (it should have one in this situation and in the target ws it will point to the latest telomeric header wso)

          if ((($descid = findtelhd ($Awfif::codelet-> {l} [$myli] [20]))>0)
          && (($ni = ($Awfif::workspace-> {l} [$descid] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
          ) {
# so can deploy descriptor
# go to the target ws

            $cwsbi = $Awfif::memes-> {currentwsbi};
            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
            $ani = awsoadr ($ni);
            if ( ($Awfif::codelet-> {l} [$myli] [17] == 0)
            && ($ni != 0)
            ){#ensure that codelet sponsor is set before do any roleout

              $Awfif::codelet-> {l} [$myli] [17] = trwsoadr ($ni, 1);
              };#if
            if (($bcindex = matchbreakcodelet ($myli)) > 0) {

              &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
              $Awfif::memes-> {breakthwso} [ ++$Awfif::memes-> {breakthwso} [0]] = $ani;
              $Awfif::memes-> {breakthsubp} [ ++$Awfif::memes-> {breakthsubp} [0]] = $Awfif::memes-> {breaksubp}[$bcindex];
              &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
              };#if
            &trackcodelet ($myli, $myli, $Awfif::memes-> {snnh} {telomere}, undef(), $ani, $Awfif::codelet-> {l} [$myli] [36]);
# write the description

            $Awfif::wsol-> {l} [$ani][2]
            = setupdesc ( $cwsbi + $Awfif::memes-> {snnh} {wsi},
                ($Awfif::codelet-> {l} [$myli][31] + $Awfif::memes-> {snnh} {wsi}),
                $Awfif::memes-> {snnh} {mindequiv},
                $Awfif::wsol-> {l} [$ani] [2],
                $ani);
# nsdepbappsu1
# a new telomeric deployment has occured. Search for matching deployments in the telomeric list and add this to the jhls

            $endmatch = '';
            $matches [0] = $Awfif::codelet-> {l} [$myli] [31];
            &gmatches ($myli, \@matches, 1, \@matchni, \@matchne, \$endmatch);
            if ((defined ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [23]][19])) && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [23]][19] > 0)) {

              $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [23]][19] = addamoff ($Awfif::codelet-> {l} [$myli] [21], $ani, $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [23]][19]);
              }#if
            else {

              $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [23]][19] = addamoff ($Awfif::codelet-> {l} [$myli] [21], $ani, 0);
              };#else
# note the parent of the mindequiv so that it can be referenced when its children are identified as a match

            $Awfif::wsol-> {l} [$ani][2]
            = setupdesc ( $cwsbi + $Awfif::memes-> {snnh} {wsi},
                ($Awfif::codelet-> {l} [$myli][23] + $Awfif::memes-> {snnh} {wsi}),
                $Awfif::memes-> {snnh} {pindequiv},
                $Awfif::wsol-> {l} [$ani] [2],
                $ani);
# for each match found - get the pindequiv and add all matches, if not already present, to the match list
            for ($i = 0; defined ($matchni [$i]); $i ++) {
              my ($found, $linki, $i2, $pindesc, $p, $gotit);

              $found = '';
              if ( ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($matchni [$i])] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 )
              && (($p = ($Awfif::workspace-> {l} [$pindesc] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
              ){

                $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] == awsoadr ($matchni [$i])) {

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

                  if (!defined ($Awfif::amoffl-> {l} [$gotit] [2])) {#note that have applied match to this item

                    $Awfif::amoffl-> {l} [$gotit] [2] = 0;
                    };#if
                  for ($i2 = 0; $i2 <= $Awfif::amoffl-> {l} [$gotit] [2]; $i2++) {

                    if ($Awfif::amoffl-> {m} [$gotit] [$i2] == awsoadr ($matchni [$i])) {

                      $found = 't';
                      };#if
                    };#for
                  };#if
                };#if
              if ((!$found)
              ){

                my ($i3);
                for ($i3 = 0; defined ($matchni[$i3]); $i3++) {
                  if( ($Awfif::amoffl-> {l} [$gotit] [4] != awsoadr ($matchni [$i3])) #try not to include self
                    ){

                    $Awfif::amoffl-> {m} [$gotit] [$Awfif::amoffl-> {l} [$gotit] [2]++] = awsoadr ($matchni [$i3]);
                    };#if
# for each match update the matches {m} with new deployment ani
                  if ($ani != awsoadr ($matchni[$i3])) {

                };#if
              };#for
# nsdepbtrau1
# if codelet [35] indicates that the deployed schema is protected in a transaction describe this also
# nsdepbsubpiu1
# if codelet [36] indicates that the deployed schema is part of a sub-program
# record the transaction info in the transaction manager
# nsdepbassoctu1
# 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

            my ($ltelhdr, $ltelhdrp1);
            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
            $ltelhdr = grwsoadr ($ani);
            $ltelhdrp1 = trwsoadr ($ltelhdr, 1);
            if ((defined ($Awfif::memes-> {nsdepschemabreak}))
            && ($ltelhdrp1 == $Awfif::memes-> {nsdepschemabreak})
            ){

              &break ();
              };#if
            $Awfif::codelet-> {l}[$myli] [37] = assandmaptran ($myli, $myli, $Awfif::codelet-> {l}[$myli] [37], $ani, $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l}[$myli] [36]);

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

            $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15][3] = $ni;
            };#if
          };#if
        };# sps or mps signal
      };# main line

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);# we change codelet {l} [37] groupstart and end etc
    }# nsdepbuilder1
#
#<!-- end tag sss -->
#<!-- end tag ds -->
#<!-- end tag uts -->
#<!-- start tag sir -->
#
sub coderack (%) {
    my($kwp, $kwpr, $sactset, $restoring, $metaname )= @_;
    my(
#<!-- end tag scc -->
    $codelet, $s, $oktodelete, $wait, $ikwp, $ikwpr, $wslp, $cwsbi, $linitialkwp, $lkwpr, $moreurgent,
    @notetemp,
#<!-- start tag scc -->
    $initialkwp, $wasaachange, $buffer, $dsponsor, $dirprefix,
    %ics,
    );
#
#
# coderack is a routine that implements a parallel terraced scan and
# probabalistically selects and passes control to codelets.
#
#
# checked for merged workspaces
#

    use Time::HiRes 'time';
# coderackrestor1

    ($Awfif::starttime-> {sec},
    $Awfif::starttime-> {min},
    $Awfif::starttime-> {hour},
    $Awfif::starttime-> {mday},
    $Awfif::starttime-> {mon},
    $Awfif::starttime-> {year},
    $Awfif::starttime-> {wday},
    $Awfif::starttime-> {yday},
    $Awfif::starttime-> {isdat}) = localtime(time);
    &ittimerzero (\%ics);
# coderackvbtrestore
# setup the store restore dirprefix
    $dirprefix = '';
    if ($metaname =~ /vbt/){

      $dirprefix = 'vbt';
      };#if
    if ((!defined ($restoring)) or (!$restoring)){
      $Awfif::memes-> {kwpr} = $kwpr;
      $Awfif::memes-> {kwp} = $$kwp;
      $initialkwp = $$kwp;
      $wasaachange = '';
# setup the wait and relay workspace
# coderackwarws

      $buffer = '<waitarelay><schema><integration>';
      $dsponsor = $Awfif::wsbl->{wsoh}[2];# convbws requires a sponsor
      &inewstws ($Awfif::memes-> {codeleth}, \$buffer, \$$kwp, $kwpr, $dsponsor);
# setup the receptor signal buffer workspace
# coderacksigws

      $buffer = '<signal><schema><integration>' . '<signal><integrate><sequence><integration>' . '<signal><compare><streams><sequence><integration>' . '<signal><match><name><sequence><integration>';
      $dsponsor = $Awfif::wsbl->{wsoh}[2];# convbws requires a sponsor
      &inewstws ($Awfif::memes-> {codeleth}, \$buffer, \$$kwp, $kwpr, $dsponsor);
# setup the goal suppressor structural workspace
# coderackugssw

      $buffer = '<schema><partconstrained><model><selector><schema>';
      $dsponsor = $Awfif::wsbl->{wsoh}[2];# convbws requires a sponsor
      &inewstws ($Awfif::memes-> {codeleth}, \$buffer, \$$kwp, $kwpr, $dsponsor);
      &actnodes ($Awfif::memes-> {snnh} {terminate}, - $Awfif::memes->{actmax});# if a previous command/test schemata activated termination then reset it
      };#if not restoring
#<!-- end tag scc -->

    do {

      $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {endtime}] = time ();
      $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {starttime}];

      &ittimetr (\@{$Awfif::memes-> {time}}, $Awfif::memes-> {codelettime}, $Awfif::memes-> {coderacktime}, $Awfif::memes-> {spctime}, $Awfif::memes-> {satime}, $Awfif::memes-> {sttime}, $Awfif::memes-> {sltime}, $Awfif::memes-> {hatime}, $Awfif::memes-> {tetime}, $Awfif::memes-> {seltime}, $Awfif::memes-> {fotime}, $Awfif::memes-> {ldtime}, $Awfif::memes-> {frtime}, $Awfif::memes-> {sumtime},\%ics);
      $wait = 0;
      if ($Awfif::memes-> {allowspigrabamp} > 0) {

        $Awfif::memes-> {allowspigrabamp}--;#this ensures that spigrabamp will enter. If it fails to make progress it will inhibit further amplification until gets back to here again
        };#if
      $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {starttime}] = time ();
      &itcpdist ($Awfif::memes->{codeleth}, $Awfif::starttime-> {hour}, $Awfif::starttime-> {min}, $Awfif::starttime-> {sec});
# setup each of the active workspaces
      $cwsbi = $Awfif::memes-> {currentwsbi};
      $wslp = $Awfif::wsbl->{h};
      $lkwpr = $Awfif::memes-> {kwpr};
      $linitialkwp = $initialkwp;
      while (($wslp != 1) && ($wslp != $Awfif::wsbl->{t})) {#setup salience for this workspace
        $Awfif::memes-> {currentwsbi} = $wslp;
# coderackactws

        if ($Awfif::wsbl-> {wsactive} [$wslp]) {

          if ($Awfif::memes-> {iphase} < $Awfif::memes-> {iphasecomp}) {

            if (($Awfif::memes-> {iphase} == ($Awfif::memes-> {iphasecomp}-1)) && ($wslp != 2)){

              for my $act (@$sactset) {
                &setinhib ($Awfif::memes->{snnh}{$act},0);
                };#for

# all lines of the ws cache should be invalid across all ws
              &wstcinv (\@$sactset);
              };#if
            $Awfif::memes-> {iphase}++;#mark the initial phase of coderack activity
            };#if

          if ($Awfif::wsbl-> {wsas}[$wslp]) {#supports sentinals etc
            $initialkwp = $Awfif::wsbl-> {wsoh}[$wslp];
            $Awfif::memes-> {kwpr} = $Awfif::wsbl-> {wsft}[$wslp];

            $ikwpr = $Awfif::wsbl-> {wsft}[$wslp];
            }
          else {
            $initialkwp = $linitialkwp;
            $Awfif::memes-> {kwpr} = $lkwpr;
            };

# define the focus of the coderack
          $ikwp = $Awfif::wsbl-> {winkwp}[$wslp];
          $ikwpr = $Awfif::wsbl-> {winkwpr}[$wslp];
          &crfocus ($initialkwp, \$$kwp, $kwpr, \$ikwp, \$ikwpr);
          $Awfif::wsbl-> {winkwp}[$wslp] = $ikwp;
          $Awfif::wsbl-> {winkwpr}[$wslp] = $ikwpr;
# calculate the instantaneous salience of the workspace

          if (($Awfif::memes-> {activationchange} [$Awfif::memes-> {currentwsbi}] != 0) or (!$wasaachange)) {
#

            $Awfif::memes-> {time} [$Awfif::memes-> {sttime}] [$Awfif::memes-> {starttime}] = time ();
            &itstrengths ($ikwp, $ikwpr, \@$sactset);
            $Awfif::memes-> {time} [$Awfif::memes-> {sttime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {sttime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {sttime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {sttime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {sttime}] [$Awfif::memes-> {starttime}];
#
            $Awfif::memes-> {time} [$Awfif::memes-> {sltime}] [$Awfif::memes-> {starttime}] = time ();
            &itsalience ($ikwp, $ikwpr, \@$sactset);
            $Awfif::memes-> {time} [$Awfif::memes-> {sltime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {sltime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {sltime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {sltime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {sltime}] [$Awfif::memes-> {starttime}];
#
# happiness will use salience calculation to decide how loud to shout
#
            $Awfif::memes-> {time} [$Awfif::memes-> {hatime}] [$Awfif::memes-> {starttime}] = time ();
            &ithappiness ($ikwp, $ikwpr, \@$sactset);
            $Awfif::memes-> {time} [$Awfif::memes-> {hatime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {hatime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {hatime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {hatime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {hatime}] [$Awfif::memes-> {starttime}];
#
# adjust the temperature to reflect changes in the environment
#
            $Awfif::memes-> {time} [$Awfif::memes-> {tetime}] [$Awfif::memes-> {starttime}] = time ();
            &ittemperature ($ikwp, $ikwpr, \@$sactset);
            $Awfif::memes-> {time} [$Awfif::memes-> {tetime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {tetime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {tetime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {tetime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {tetime}] [$Awfif::memes-> {starttime}];
#
# spread activation, initiate top down processes and action decay
            $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {starttime}] = time ();
            &supactivatn ($ikwp, $ikwpr, \@$sactset);
            $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {starttime}];
            };#activation changed in this workspace
          };#active rather than structural workspace
        $wslp = $Awfif::wsbl->{l}[$wslp] [0];
        };#while each active workspace

      $Awfif::memes-> {currentwsbi} = $cwsbi;
      if ($Awfif::wsbl-> {wsas}[$Awfif::memes-> {currentwsbi}]) {#supports sentinals etc

        $initialkwp = $Awfif::wsbl-> {wsoh}[$Awfif::memes-> {currentwsbi}];
        $Awfif::memes-> {kwpr} = $Awfif::wsbl-> {wsft}[$Awfif::memes-> {currentwsbi}];
        $ikwpr = $Awfif::wsbl-> {wsft}[$Awfif::memes-> {currentwsbi}];
        }
      else {

        $initialkwp = $linitialkwp;
        $Awfif::memes-> {kwpr} = $lkwpr;
        };
      do {
        my ($cwsbi, $freeup, $bcindex);
        $wait++;
# warm place up if no top down cooling
        if (($Awfif::memes->{temp} [$Awfif::memes-> {currentwsbi}] < $Awfif::memes-> {bondthreshold}) && (($wait == 1) or (((int($wait/100)) *100) == $wait ))) {

          $Awfif::memes->{temp} [$Awfif::memes-> {currentwsbi}]++;
          };
        if ($Awfif::memes-> {drwait} >= $Awfif::memes-> {crwait}) {

          $Awfif::memes-> {drwait} = 0;
          }#if
        else {

          $Awfif::memes-> {drwait}++;
          };#else
#
# ********* allow some codelet to execute ***********
#
        $Awfif::memes-> {time} [$Awfif::memes-> {seltime}] [$Awfif::memes-> {starttime}] = time ();

        $codelet = selcodelet (\$moreurgent);
        $Awfif::memes-> {time} [$Awfif::memes-> {seltime}] [$Awfif::memes-> {endtime}] = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {seltime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {seltime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {seltime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {seltime}] [$Awfif::memes-> {starttime}];
#
        $s = $Awfif::codelet-> {l} [$codelet] [2];
        if ($codelet != 0) {# execute the strategy routine

          if ($Awfif::codelet-> {l} [$codelet] [2] eq 0) {

            print ("empty strategy $s\n");
            };
# atppenalty5
          if ($Awfif::memes-> {fatp} > 0) {# codelets use up energy

            $Awfif::memes-> {fatp}--;
            };
          if ($Awfif::memes-> {fgtp} > 0) {# codelets use up energy

            $Awfif::memes-> {fgtp}--;
            };
          $cwsbi = $Awfif::memes-> {currentwsbi};
          if ($Awfif::codelet-> {l} [$codelet] [19]) {# knows which ws it operates on

            $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$codelet] [19];
            };# setup ws for codelet

          if ($Awfif::memes-> {currentwsbi} == 0) {&break ();};
          if ($Awfif::wsbl-> {wsas}[$Awfif::memes-> {currentwsbi}]) {#supports sentinals etc

            $initialkwp = $Awfif::wsbl-> {wsoh}[$Awfif::memes-> {currentwsbi}];
            $Awfif::memes-> {kwpr} = $Awfif::wsbl-> {wsft}[$Awfif::memes-> {currentwsbi}];
            $ikwpr = $Awfif::wsbl-> {wsft}[$Awfif::memes-> {currentwsbi}];
            }
          else {

            $initialkwp = $linitialkwp;
            $Awfif::memes-> {kwpr} = $lkwpr;
            };
#
          $ikwp = $Awfif::wsbl-> {winkwp}[$Awfif::memes-> {currentwsbi}];
          $ikwpr = $Awfif::wsbl-> {winkwpr}[$Awfif::memes-> {currentwsbi}];
          if ($wait != 1) {

            $Awfif::memes-> {time} [$Awfif::memes-> {fotime}] [$Awfif::memes-> {starttime}] = time ();
            &crfocus ($initialkwp, \$$kwp, $kwpr, \$ikwp, \$ikwpr);
            $Awfif::wsbl-> {winkwp}[$Awfif::memes-> {currentwsbi}] = $ikwp;
            $Awfif::wsbl-> {winkwpr}[$Awfif::memes-> {currentwsbi}] = $ikwpr;
            $Awfif::memes-> {time} [$Awfif::memes-> {fotime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {fotime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {fotime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {fotime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {fotime}] [$Awfif::memes-> {starttime}];
# spread activation, initiate top down processes and action decay
#
            $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {starttime}] = time ();
            &supactivatn ($ikwp, $ikwpr, \@$sactset);
            $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {satime}] [$Awfif::memes-> {starttime}];
#
            $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {endtime}] = time ();

            $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {starttime}];
            };#if
          $Awfif::memes-> {time} [$Awfif::memes-> {codelettime}] [$Awfif::memes-> {starttime}] = time ();
          $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {starttime}] = time ();
          if (($Awfif::memes-> {currentwsbi} == 1)
          or (!$Awfif::wsbl-> {wsactive} [$Awfif::memes-> {currentwsbi}])
          ){
            &break();
            };#if corrupted wsbi
#
# ********* run the codelet ********
#
          no strict 'refs';

# break if codelet matches breakcodelet
          if (($bcindex = matchbreakcodelet ($codelet)) > 0) {

            break ();
            };#if
          if (!defined ($Awfif::memes-> {binds}-> {$Awfif::codelet-> {l} [$codelet] [2]})) {

            break ();
            }#if
          else {
# coderfreepu1

            $Awfif::memes-> {cruna}[ ++$Awfif::memes-> {cruna}[0] ] = $codelet;#protect the running codelet from freecodelet
            $Awfif::memes-> {binds}-> {$Awfif::codelet-> {l} [$codelet] [2]}-> ($codelet, \$ikwp, $ikwpr, \@$sactset);
            $Awfif::memes-> {cruna}[ $Awfif::memes-> {cruna}[0]-- ] = undef();

            if ($Awfif::memes-> {currentwsbi} == 0) {&break ();};
            };
          $Awfif::memes-> {breakmyli} = 0;
          $Awfif::memes-> {bmbcindex} = 0;
# applycsharecru1
# update sharing info with applycodelet
          if (($Awfif::memes-> {applycount}) <= 1) {
            $Awfif::memes-> {applycount} = $Awfif::memes-> {applycth} + $Awfif::memes-> {applyramp};
            };#if
#
#
          $Awfif::memes-> {time} [$Awfif::memes-> {codelettime}] [$Awfif::memes-> {endtime}] = time ();
          $Awfif::memes-> {time} [$Awfif::memes-> {codelettime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {codelettime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {codelettime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {codelettime}] [$Awfif::memes-> {starttime}];
          $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {endtime}] = time ();
          if ($Awfif::codelet-> {l} [$codelet] [27] ne '') {

            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [27]}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [27]}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {starttime}];
            }#if
          else {

            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$ics{$Awfif::codelet-> {l} [$codelet] [2]}] [$Awfif::memes-> {starttime}];
            };#else

          $Awfif::memes-> {time} [$Awfif::memes-> {coderacktime}] [$Awfif::memes-> {starttime}] = time ();
# process learning signals

          $Awfif::memes-> {currentwsbi} = $cwsbi;
#
          $Awfif::memes-> {time} [$Awfif::memes-> {ldtime}] [$Awfif::memes-> {starttime}] = time ();
# crldlearn
          $Awfif::memes-> {ldsignal} = ldlearning ();
          $Awfif::memes-> {time} [$Awfif::memes-> {ldtime}] [$Awfif::memes-> {endtime}] = time ();
          $Awfif::memes-> {time} [$Awfif::memes-> {ldtime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {ldtime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {ldtime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {ldtime}] [$Awfif::memes-> {starttime}];
          if ($Awfif::memes-> {ldsignal} < 0) {
# reduce the activation of recently participating concepts

            }
          elsif ($Awfif::memes-> {ldsignal} > 0) {
# increase the activation of recently participating concepts

            };
# remove the codelet
#
          $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {starttime}] = time ();
          &freecodelet ($codelet, 1);
          $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {endtime}] = time ();
          $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {starttime}];
# crcpstate
          if ($Awfif::memes-> {storetheds}) {

            $Awfif::memes-> {storetheds} = '';
            &storetofiles ($codelet, $dirprefix);
            };#if
          }# run the codelet
# crmapenergy
# respond to the instantaneous temperature
        if (($moreurgent != 0)
        && (!defined ($notetemp[$Awfif::memes-> {currentwsbi}]))
        ){

          $notetemp [$Awfif::memes-> {currentwsbi}] = $Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}];
          $Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] = $Awfif::memes-> {manthreshold} - 1;#reduce codelet submissions
          }#if
        elsif (($moreurgent != 0)
        && (defined ($notetemp[$Awfif::memes-> {currentwsbi}]))
        ){

          $Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] = $Awfif::memes-> {manthreshold} - 1;#reduce codelet submissions
          }#elsif
        elsif (($moreurgent == 0)
        && (defined ($notetemp [$Awfif::memes-> {currentwsbi}]))
        ){

          $Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] = $notetemp [$Awfif::memes-> {currentwsbi}];
          $notetemp [$Awfif::memes-> {currentwsbi}] = ();
          };#elsif
# crbucodelets
        &crsubmitcodelets ($wait);
        if ($moreurgent == 0){
# crlcodelets

          $freeup = toomanycodelets ();#
          $oktodelete = 1;
          while (($freeup > 0) && ($oktodelete != 0)) {
# filter out the oldest active codelets
#

            my ($tail);
            $tail = $Awfif::memes-> {codelett};
            $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {starttime}] = time ();
            $oktodelete = freecodelet ($tail);
            $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {endtime}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {sumtime}] = $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {sumtime}] + $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {endtime}] - $Awfif::memes-> {time} [$Awfif::memes-> {frtime}] [$Awfif::memes-> {starttime}];
            if ($oktodelete > 0){# 0 => stop & -1 => redo last attempt

              $freeup--;
              };#if
            };#while
          };#if not bumped by more urgent codelets
        }#do while
      while (($codelet != 0) && ($wait < $Awfif::memes-> {crwait}) && (!($wasaachange = actchange ())) && (!$Awfif::memes-> {storestop}));

      }
    while ((($codelet != 0)
    or ($Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] > -5))
    && ($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snna}{terminate} < $Awfif::memes-> {actth})
    && (!$Awfif::memes-> {storestop})
    );
#<!-- start tag scc -->

    return $Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}];
    }} # of coderack
#<!-- end tag sir -->
#<!-- end tag scc -->
Market Centric Workshops
The Physics - Politics, Economics & Evolutionary Psychology
Politics, Economics & Evolutionary Psychology

Business Physics
Nature and nurture drive the business eco-system
Human nature
Emerging structure and dynamic forces of adaptation


integrating quality appropriate for each market
 
This page looks at schematic structures and their uses.  It discusses a number of examples:
  • Schematic ideas are recombined in creativity. 
  • Similarly designers take ideas and rules about materials and components and combine them. 
  • Schematic Recipes help to standardize operations. 
  • Modular components are combined into strategies for use in business plans and business models. 

As a working example it presents part of the contents and schematic details from the Adaptive Web Framework (AWF)'s operational plan. 

Finally it includes a section presenting our formal representation of schematic goals. 
Each goal has a series of associated complex adaptive system (CAS) strategy strings. 
These goals plus strings are detailed for various chess and business examples. 
Strategy
| Design |
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. 
Program Management
| Home

Profiles | Papers | Glossary | E-mail us