test \( -z "$BKSERVER_HOST" \) -a \( -z "$EDG_JOBID" \) && usage
 
+if [[ $0 =~ "cream_" ]]; then TYPE=-c; fi
+
 if [ -z "$EDG_JOBID" ] 
 then
        # initial sequence code & jobid (normaly returned by job_reg)
        EDG_JOBID=
-       SCRIPT=`$JOB_REG $LBPROXY_REG -m $BKSERVER_HOST -s UserInterface | tail -n 2`
+       SCRIPT=`$JOB_REG $TYPE $LBPROXY_REG -m $BKSERVER_HOST -s UserInterface | tail -n 2`
        eval $SCRIPT
        test -z "$EDG_JOBID" && exit 4
        echo EDG_JOBID=$EDG_JOBID
 
        COMMAND
        CMDID
        CALLEE
+       DESTID
 /;
 
            };
 
            $type = { type=>'char *',defval=>'NULL' } if $f->{codes};
-
+            warn "$fn: $vars{$fn}->{type} to $type->{type}\n"
+                        if $vars{$fn} && ($vars{$fn}->{type} ne $type->{type}
+                               || $vars{$fn}->{defval} ne $type->{defval});
            $vars{$fn} = $type;
        }
     }
 
  */
 typedef char *edg_wll_LogLine;
 
+enum edg_wll_CREAMCommand {
+       EDG_WLL_CREAM_CMD_UNDEFINED = 0,
+       EDG_WLL_CREAM_CMD_START = 0,
+       EDG_WLL_CREAM_CMD_CANCEL = 0,
+       EDG_WLL_CREAM_CMD_PURGE = 0,
+       EDG_WLL_CREAM_CMD_SUSPEND = 0,
+       EDG_WLL_CREAM_CMD_RESUME = 0,
+};
 
 /**
  * \typedef edg_wll_EventCode
  * related StringTo_code and _code_ToString function prototypes
  */
 @@@{
+
+%enum_done = ();
 $indent = "\t";
 selectType $event '_common_';
 for ($event->getFieldsOrdered) {
                my $c = "${fn}"; # new code
                my $enum = "enum edg_wll\_$c"; # new enum name
 
+               next if $enum_done{$enum};
+               $enum_done{$enum} = 1;
+
 # enum
                gen qq{
 /**
                        my $c = "$t${fn}"; # new code
                        my $enum = "enum edg_wll\_$c"; # new enum name
 
+                       next if $enum_done{$enum};
+                       $enum_done{$enum} = 1;
 # enum
                        gen qq{
 /**
                                $main::defined_undefs{$tu} = 1;
                        }
                        for (@{$f->{codes}}) {
-                               gen $indent."EDG_WLL_$tu$_->{name},\t/**< $_->{comment} */ \n";
+                               my $alias = '';
+                               if ($f->{ptype} ne $t) {
+                                       my $ptu = uc($f->{ptype}) .'_';
+                                       $alias = " = EDG_WLL_$ptu$_->{name}";
+                               } 
+                               gen $indent."EDG_WLL_$tu$_->{name}$alias,\t/**< $_->{comment} */ \n";
                        }
                        gen "};\n";
 
 
                        ret = strdup(ctx->p_seqcode.condor);
                        break;
                case EDG_WLL_SEQ_CREAM:
-                       ret = strdup("");       /* XXX: not yet */
+                       ret = strdup("no_seqcodes_with_CREAM"); /* XXX: not yet */
                        break;
                default:
                        edg_wll_SetError(ctx,EINVAL,"edg_wll_GetSequenceCode(): sequence code type");
 
        if (!strstr(b, "LBS")) snprintf(scb,EDG_WLL_SEQ_SIZE,"%s:LBS=000000",b);
        else snprintf(scb,EDG_WLL_SEQ_SIZE,"%s",b);
 
-       assert(EDG_WLL_SOURCE__LAST == 10);
-
        res =  sscanf(sca, "UI=%d:NS=%d:WM=%d:BH=%d:JSS=%d:LM=%d:LRMS=%d:APP=%d:LBS=%d",
                        &c[EDG_WLL_SOURCE_USER_INTERFACE],
                        &c[EDG_WLL_SOURCE_NETWORK_SERVER],
                        &c[EDG_WLL_SOURCE_LRMS],
                        &c[EDG_WLL_SOURCE_APPLICATION],
                        &c[EDG_WLL_SOURCE_LB_SERVER]);
-       if (res != EDG_WLL_SOURCE__LAST-1) {
+       if (res != 9) {
 /* FIXME:              syslog(LOG_ERR, "unparsable sequence code %s\n", sca); */
                fprintf(stderr, "unparsable sequence code %s\n", sca);
                return -1;
                        &d[EDG_WLL_SOURCE_LRMS],
                        &d[EDG_WLL_SOURCE_APPLICATION],
                        &d[EDG_WLL_SOURCE_LB_SERVER]);
-       if (res != EDG_WLL_SOURCE__LAST-1) {
+       if (res != 9) {
 /* FIXME:              syslog(LOG_ERR, "unparsable sequence code %s\n", scb); */
                fprintf(stderr, "unparsable sequence code %s\n", scb);
                return 1;
 
 sub addField {
        my $self = shift;
        my $field = shift;
+
        
        die "unselected type" unless $self->{type};
        $self->{fields}->{$self->{type}}->{$field->{name}} = $field;
        $self->selectField($field->{name});
+
+       my $f = $self->{field};
+       my $t = $self->{type};
+       push @{$field->{refs}},"$t:$f";
        1;
 }
 
                        my $f = $self->getField();
                        $f->{index} = 1;
                }
+               elsif ($ftype eq '_ref_') {
+                       my ($rt,$rf) = split /:/,$fname;
+                       $self->addField(my $f = $self->{fields}->{$rt}->{$rf});
+               }
                elsif ($ftype eq '_pad_') {
                        my $f = $self->getField();
                        $f->{pad} = $fname;
                }
                else {
                        my $f = new StructField $fname,$ftype,$comment,$.;
+                       $f->{ptype} = $self->{type};
                        $self->addField($f);
                }
        }
 
 
 @type CREAMCall        Processing command and calling BLAH or LRMS
        logsrc  callee  
-       int     command         The command
+       _ref_   CREAMStore:command
        string  cmdid           Id of the command, as stored previously
        _optional_
+       string  destid  
+       _optional_
        int     result
        _code_  START
        _code_  OK