<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Convert Procedural DS2 code into MAS module and run it in Calculate window in Streaming Analytics</title>
    <link>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/503677#M105</link>
    <description>&lt;P&gt;I'm trying to migrate code from 4.3 to 5.2 but script doesn't work until I translate Procedural window DS2 code into MAS module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code I have in 4.3:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data esp.out;
        dcl integer ID;
        retain ID 0; 
        dcl double AGG3H;
        dcl integer EVENT_TYPE;
        dcl integer IS_TRIGGERED;
        dcl double TOTAL_BONUS;
        dcl double BONUS_LEFT;
        dcl timestamp LAST_USAGE_DTTM;
        dcl integer COUNT;
        dcl timestamp PREV_EXP_DTTM;
        dcl timestamp TO_BOUGHT_DTTM;
    method run();
        set esp.in;
            ID = ID + 1;
            BONUS_LEFT = -1 * RO_CCP1_USED_VOLUME;
            COUNT = 0;
            PREV_EXP_DTTM = to_timestamp(0); 
            TO_BOUGHT_DTTM = to_timestamp(2552317828);
            LAST_USAGE_DTTM = CALL_END_DTTM;
            TOTAL_BONUS = 0;
            IS_TRIGGERED = 0;
            EVENT_TYPE = 3;
            /*AGG3H = 0;*/
            _opcode = 1;
    end;
enddata;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And code I put in MAS module so I can call it in Calculate window:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ds2_options sas;
package module_1/overwrite=yes;
    method compute_usage(in_out int EVENT_TYPE, timestamp LAST_TO_BOUGHT_DTTM, in_out double BONUS_LEFT, in_out double TOTAL_BONUS, in_out timestamp EXP_DTTM, timestamp LAST_USAGE_DTTM, in_out timestamp PREV_EXP_DTTM, in_out double AVG_USAGE_LAST3HRS, in_out int COUNT, int TO_VALIDITY, int TO_BONUS);
        LAST_USAGE_DTTM = LAST_USAGE_DTTM;
        EXP_DTTM =to_timestamp(to_double(LAST_TO_BOUGHT_DTTM) + (TO_VALIDITY * 24 * 60 *60));
        BONUS_LEFT = TO_BONUS * 1024 * 1024;
        TOTAL_BONUS =  TO_BONUS * 1024 * 1024;
        AVG_USAGE_LAST3HRS = 0.0;
        COUNT = 1;
        EVENT_TYPE = 1;
        PREV_EXP_DTTM = TO_BOUGHT_DTTM;
    end;
endpackage;&lt;/PRE&gt;&lt;P&gt;But something doesn't work and logs are not really helpful in this case:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;2018-10-12T11:59:58,383; DEBUG; 00004981; DF.ESP; (dfESPwindow_join.cpp:415); [Join0016] dfESPwindow_join::buildSchema() for window OneE_CDR_CM_To_Activation_Join: fieldName: MSISDN, side:1, type: 3, key: 0
2018-10-12T11:59:58,383; INFO ; 00004981; DF.ESP; (dfESPwindow_join.cpp:447); [Join0033] dfESPwindow_join::buildSchema() for window OneE_CDR_CM_To_Activation_Join: Built schema &amp;lt;ID*:int64,SUBSCRIPTION_SK:int64,TO_BOUGHT_DTTM:stamp,TO_BONUS:int64,TO_VALIDITY:int32,TO_KEYWORD:string,MSISDN:string&amp;gt;
2018-10-12T11:59:58,384; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Invoked calculate window finalizer
2018-10-12T11:59:58,384; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Successfully loaded tk extension "tksautil"
2018-10-12T11:59:58,386; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Successfully loaded tk extension "tksamas"
MAS map: window "OneE_CDR_CM_To_Activation_Join" -&amp;gt; (one_join,first_run,0)
2018-10-12T11:59:58,386; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Finished creating instance
2018-10-12T11:59:58,412; ERROR; 00004981; App.tk.MAS; (tksf.c:5313); Module 'one_join' failed to compile in user context '&amp;lt;esp&amp;gt;::&amp;lt;HDHA_migrate&amp;gt;'.
2018-10-12T11:59:58,412; INFO ; 00004981; DF.ESP.SA.TKSAMAS ; (sklstoj.c:118); Line 21: Invalid conversion for date or time type.
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Failed to initialize model
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Failed to finalize calculate window "&amp;lt;esp&amp;gt;::&amp;lt;HDHA_migrate&amp;gt;::&amp;lt;cq1&amp;gt;::&amp;lt;Calculate1&amp;gt;"
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP; (dfESPwindow.cpp:1433); [Window0003] dfESPwindow::finalizeForRun() for window Calculate1: user user defined finalize callback returned failure
2018-10-12T11:59:58,413; ERROR; 00004981; DF.ESP; (dfESPwindow.cpp:1472); [Window0002] dfESPwindow::finalizeForRun() for window Calculate1: Finalization failed
2018-10-12T11:59:58,413; FATAL; 00004981; DF.ESP; (dfESPproject.cpp:640); [Project0004] dfESPproject::finalizeProject() for project HDHA_migrate: Failed finalizing continuous query: cq1
2018-10-12T11:59:58,413; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Invoked calculate window destructor&lt;/PRE&gt;&lt;P&gt;I was looking for some online examples, but all of them are pretty simple and basic. Any kind of help or hint is welcomed. Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Oct 2018 10:53:36 GMT</pubDate>
    <dc:creator>jovic92</dc:creator>
    <dc:date>2018-10-12T10:53:36Z</dc:date>
    <item>
      <title>Convert Procedural DS2 code into MAS module and run it in Calculate window</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/503677#M105</link>
      <description>&lt;P&gt;I'm trying to migrate code from 4.3 to 5.2 but script doesn't work until I translate Procedural window DS2 code into MAS module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code I have in 4.3:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data esp.out;
        dcl integer ID;
        retain ID 0; 
        dcl double AGG3H;
        dcl integer EVENT_TYPE;
        dcl integer IS_TRIGGERED;
        dcl double TOTAL_BONUS;
        dcl double BONUS_LEFT;
        dcl timestamp LAST_USAGE_DTTM;
        dcl integer COUNT;
        dcl timestamp PREV_EXP_DTTM;
        dcl timestamp TO_BOUGHT_DTTM;
    method run();
        set esp.in;
            ID = ID + 1;
            BONUS_LEFT = -1 * RO_CCP1_USED_VOLUME;
            COUNT = 0;
            PREV_EXP_DTTM = to_timestamp(0); 
            TO_BOUGHT_DTTM = to_timestamp(2552317828);
            LAST_USAGE_DTTM = CALL_END_DTTM;
            TOTAL_BONUS = 0;
            IS_TRIGGERED = 0;
            EVENT_TYPE = 3;
            /*AGG3H = 0;*/
            _opcode = 1;
    end;
enddata;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And code I put in MAS module so I can call it in Calculate window:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ds2_options sas;
package module_1/overwrite=yes;
    method compute_usage(in_out int EVENT_TYPE, timestamp LAST_TO_BOUGHT_DTTM, in_out double BONUS_LEFT, in_out double TOTAL_BONUS, in_out timestamp EXP_DTTM, timestamp LAST_USAGE_DTTM, in_out timestamp PREV_EXP_DTTM, in_out double AVG_USAGE_LAST3HRS, in_out int COUNT, int TO_VALIDITY, int TO_BONUS);
        LAST_USAGE_DTTM = LAST_USAGE_DTTM;
        EXP_DTTM =to_timestamp(to_double(LAST_TO_BOUGHT_DTTM) + (TO_VALIDITY * 24 * 60 *60));
        BONUS_LEFT = TO_BONUS * 1024 * 1024;
        TOTAL_BONUS =  TO_BONUS * 1024 * 1024;
        AVG_USAGE_LAST3HRS = 0.0;
        COUNT = 1;
        EVENT_TYPE = 1;
        PREV_EXP_DTTM = TO_BOUGHT_DTTM;
    end;
endpackage;&lt;/PRE&gt;&lt;P&gt;But something doesn't work and logs are not really helpful in this case:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;2018-10-12T11:59:58,383; DEBUG; 00004981; DF.ESP; (dfESPwindow_join.cpp:415); [Join0016] dfESPwindow_join::buildSchema() for window OneE_CDR_CM_To_Activation_Join: fieldName: MSISDN, side:1, type: 3, key: 0
2018-10-12T11:59:58,383; INFO ; 00004981; DF.ESP; (dfESPwindow_join.cpp:447); [Join0033] dfESPwindow_join::buildSchema() for window OneE_CDR_CM_To_Activation_Join: Built schema &amp;lt;ID*:int64,SUBSCRIPTION_SK:int64,TO_BOUGHT_DTTM:stamp,TO_BONUS:int64,TO_VALIDITY:int32,TO_KEYWORD:string,MSISDN:string&amp;gt;
2018-10-12T11:59:58,384; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Invoked calculate window finalizer
2018-10-12T11:59:58,384; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Successfully loaded tk extension "tksautil"
2018-10-12T11:59:58,386; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Successfully loaded tk extension "tksamas"
MAS map: window "OneE_CDR_CM_To_Activation_Join" -&amp;gt; (one_join,first_run,0)
2018-10-12T11:59:58,386; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Finished creating instance
2018-10-12T11:59:58,412; ERROR; 00004981; App.tk.MAS; (tksf.c:5313); Module 'one_join' failed to compile in user context '&amp;lt;esp&amp;gt;::&amp;lt;HDHA_migrate&amp;gt;'.
2018-10-12T11:59:58,412; INFO ; 00004981; DF.ESP.SA.TKSAMAS ; (sklstoj.c:118); Line 21: Invalid conversion for date or time type.
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Failed to initialize model
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Failed to finalize calculate window "&amp;lt;esp&amp;gt;::&amp;lt;HDHA_migrate&amp;gt;::&amp;lt;cq1&amp;gt;::&amp;lt;Calculate1&amp;gt;"
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP; (dfESPwindow.cpp:1433); [Window0003] dfESPwindow::finalizeForRun() for window Calculate1: user user defined finalize callback returned failure
2018-10-12T11:59:58,413; ERROR; 00004981; DF.ESP; (dfESPwindow.cpp:1472); [Window0002] dfESPwindow::finalizeForRun() for window Calculate1: Finalization failed
2018-10-12T11:59:58,413; FATAL; 00004981; DF.ESP; (dfESPproject.cpp:640); [Project0004] dfESPproject::finalizeProject() for project HDHA_migrate: Failed finalizing continuous query: cq1
2018-10-12T11:59:58,413; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Invoked calculate window destructor&lt;/PRE&gt;&lt;P&gt;I was looking for some online examples, but all of them are pretty simple and basic. Any kind of help or hint is welcomed. Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 10:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/503677#M105</guid>
      <dc:creator>jovic92</dc:creator>
      <dc:date>2018-10-12T10:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Procedural DS2 code into MAS module and run it in Calculate window</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/503781#M106</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/179286"&gt;@jovic92&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to migrate code from 4.3 to 5.2 but script doesn't work until I translate Procedural window DS2 code into MAS module.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code I have in 4.3:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data esp.out;
        dcl integer ID;
        retain ID 0; 
        dcl double AGG3H;
        dcl integer EVENT_TYPE;
        dcl integer IS_TRIGGERED;
        dcl double TOTAL_BONUS;
        dcl double BONUS_LEFT;
        dcl timestamp LAST_USAGE_DTTM;
        dcl integer COUNT;
        dcl timestamp PREV_EXP_DTTM;
        dcl timestamp TO_BOUGHT_DTTM;
    method run();
        set esp.in;
            ID = ID + 1;
            BONUS_LEFT = -1 * RO_CCP1_USED_VOLUME;
            COUNT = 0;
            PREV_EXP_DTTM = to_timestamp(0); 
            TO_BOUGHT_DTTM = to_timestamp(2552317828);
            LAST_USAGE_DTTM = CALL_END_DTTM;
            TOTAL_BONUS = 0;
            IS_TRIGGERED = 0;
            EVENT_TYPE = 3;
            /*AGG3H = 0;*/
            _opcode = 1;
    end;
enddata;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And code I put in MAS module so I can call it in Calculate window:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ds2_options sas;
package module_1/overwrite=yes;
    method compute_usage(in_out int EVENT_TYPE, timestamp LAST_TO_BOUGHT_DTTM, in_out double BONUS_LEFT, in_out double TOTAL_BONUS, in_out timestamp EXP_DTTM, timestamp LAST_USAGE_DTTM, in_out timestamp PREV_EXP_DTTM, in_out double AVG_USAGE_LAST3HRS, in_out int COUNT, int TO_VALIDITY, int TO_BONUS);
        LAST_USAGE_DTTM = LAST_USAGE_DTTM;
        EXP_DTTM =to_timestamp(to_double(LAST_TO_BOUGHT_DTTM) + (TO_VALIDITY * 24 * 60 *60));
        BONUS_LEFT = TO_BONUS * 1024 * 1024;
        TOTAL_BONUS =  TO_BONUS * 1024 * 1024;
        AVG_USAGE_LAST3HRS = 0.0;
        COUNT = 1;
        EVENT_TYPE = 1;
        PREV_EXP_DTTM = TO_BOUGHT_DTTM;
    end;
endpackage;&lt;/PRE&gt;
&lt;P&gt;But something doesn't work and logs are not really helpful in this case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;2018-10-12T11:59:58,383; DEBUG; 00004981; DF.ESP; (dfESPwindow_join.cpp:415); [Join0016] dfESPwindow_join::buildSchema() for window OneE_CDR_CM_To_Activation_Join: fieldName: MSISDN, side:1, type: 3, key: 0
2018-10-12T11:59:58,383; INFO ; 00004981; DF.ESP; (dfESPwindow_join.cpp:447); [Join0033] dfESPwindow_join::buildSchema() for window OneE_CDR_CM_To_Activation_Join: Built schema &amp;lt;ID*:int64,SUBSCRIPTION_SK:int64,TO_BOUGHT_DTTM:stamp,TO_BONUS:int64,TO_VALIDITY:int32,TO_KEYWORD:string,MSISDN:string&amp;gt;
2018-10-12T11:59:58,384; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Invoked calculate window finalizer
2018-10-12T11:59:58,384; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Successfully loaded tk extension "tksautil"
2018-10-12T11:59:58,386; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Successfully loaded tk extension "tksamas"
MAS map: window "OneE_CDR_CM_To_Activation_Join" -&amp;gt; (one_join,first_run,0)
2018-10-12T11:59:58,386; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Finished creating instance
2018-10-12T11:59:58,412; ERROR; 00004981; App.tk.MAS; (tksf.c:5313); Module 'one_join' failed to compile in user context '&amp;lt;esp&amp;gt;::&amp;lt;HDHA_migrate&amp;gt;'.
2018-10-12T11:59:58,412; INFO ; 00004981; DF.ESP.SA.TKSAMAS ; (sklstoj.c:118); Line 21: Invalid conversion for date or time type.
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Failed to initialize model
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Failed to finalize calculate window "&amp;lt;esp&amp;gt;::&amp;lt;HDHA_migrate&amp;gt;::&amp;lt;cq1&amp;gt;::&amp;lt;Calculate1&amp;gt;"
2018-10-12T11:59:58,412; ERROR; 00004981; DF.ESP; (dfESPwindow.cpp:1433); [Window0003] dfESPwindow::finalizeForRun() for window Calculate1: user user defined finalize callback returned failure
2018-10-12T11:59:58,413; ERROR; 00004981; DF.ESP; (dfESPwindow.cpp:1472); [Window0002] dfESPwindow::finalizeForRun() for window Calculate1: Finalization failed
2018-10-12T11:59:58,413; FATAL; 00004981; DF.ESP; (dfESPproject.cpp:640); [Project0004] dfESPproject::finalizeProject() for project HDHA_migrate: Failed finalizing continuous query: cq1
2018-10-12T11:59:58,413; DEBUG; 00004981; DF.ESP.SA  ; (sklstoj.c:118); Invoked calculate window destructor&lt;/PRE&gt;
&lt;P&gt;I was looking for some online examples, but all of them are pretty simple and basic. Any kind of help or hint is welcomed. Thanks in advance.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think you might think carefully about this line:&lt;/P&gt;
&lt;PRE&gt;2018-10-12T11:59:58,412; INFO ; 00004981; DF.ESP.SA.TKSAMAS ; (sklstoj.c:118); Line 21: Invalid conversion for &lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;date or time&lt;/FONT&gt; &lt;/STRONG&gt;type.
&lt;/PRE&gt;
&lt;P&gt;and the values of any variables used in a date or time role.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 16:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/503781#M106</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-12T16:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Procedural DS2 code into MAS module and run it in Calculate window</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/503801#M107</link>
      <description>&lt;P&gt;The timestamp type isn't supported as a DS2 data type by MAS.&amp;nbsp; I think there is a debug message about this if you turn up the debug levels enough.&amp;nbsp; Here is a table for the conversion between ESP data types and MAS datatypes for DS2 and Python&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=masag&amp;amp;docsetTarget=n0nsznpd1r9wd8n1sd6qsm8efyjg.htm&amp;amp;docsetVersion=5.1&amp;amp;locale=en" target="_blank"&gt;https://go.documentation.sas.com/?docsetId=masag&amp;amp;docsetTarget=n0nsznpd1r9wd8n1sd6qsm8efyjg.htm&amp;amp;docsetVersion=5.1&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want the timestamp to be a bigint.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 17:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/503801#M107</guid>
      <dc:creator>AndyT_SAS</dc:creator>
      <dc:date>2018-10-12T17:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Procedural DS2 code into MAS module and run it in Calculate window</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/504274#M108</link>
      <description>&lt;P&gt;This means that I can't use a variable as a timestamp in a previous window from which I import part of schema?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ds2_options sas;
package module_1/overwrite=yes;
    dcl int EVENT_TYPE;
    dcl double BONUS_LEFT;
    dcl double TOTAL_BONUS;
    dcl double AVG_USAGE_LAST3HRS;
    dcl BIGINT EXP_DTTM;
    dcl int COUNT;
    dcl int TO_VALIDITY;
    dcl int TO_BONUS;
    method first_run(in_out int EVENT_TYPE, timestamp LAST_TO_BOUGHT_DTTM, in_out double BONUS_LEFT, in_out double TOTAL_BONUS, in_out BIGINT EXP_DTTM, in_out BIGINT AVG_USAGE_LAST3HRS, in_out int COUNT, int TO_VALIDITY, int TO_BONUS);
        EXP_DTTM =(to_double(LAST_TO_BOUGHT_DTTM) + (TO_VALIDITY * 24 * 60 *60));
        BONUS_LEFT = TO_BONUS * 1024 * 1024;
        TOTAL_BONUS =  TO_BONUS * 1024 * 1024;
        AVG_USAGE_LAST3HRS = 0.0;
        COUNT = 1;
        EVENT_TYPE = 1;
    end;
endpackage;&lt;/PRE&gt;&lt;P&gt;Where LAST_TO_BOUGHT_DTTM is timestamp&amp;nbsp;:&lt;/P&gt;&lt;P&gt;I only get&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="logesp.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24006i9D09E3A38F3A3BB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="logesp.png" alt="logesp.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if I put BIGINT instead timestamp for LAST_TO_BOUGHT_DTTM, I got an error like in question from the opening topic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The previous window is "join window" and there are&amp;nbsp;a few variables with timestamp type, how to handle that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't&amp;nbsp;find any example using BIGINT or any timestamp values, most time I run on volume = quantity * price and that's pretty basic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem is that I can't start a new project (simplest&amp;nbsp;one) until I migrate this one to 5.2 version.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 12:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/504274#M108</guid>
      <dc:creator>jovic92</dc:creator>
      <dc:date>2018-10-15T12:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Procedural DS2 code into MAS module and run it in Calculate window</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/504449#M109</link>
      <description>&lt;P&gt;In ESP, a date or a timestamp is stored as a int64.&amp;nbsp; A date is the number of seconds since Unix epoch.&amp;nbsp; A timestamp is the number of milliseconds since Unix epoch.&amp;nbsp; So, it should be able to be passed as a bigint to DS2, which will correctly hold the value.&amp;nbsp; I'm not sure why the model won't start when&amp;nbsp;LAST_TO_BOUGHT_DTTM is set to bigint.&amp;nbsp; Can you add the model so I can take a look?&amp;nbsp; Or we can create a track for this, if you would like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 19:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/504449#M109</guid>
      <dc:creator>AndyT_SAS</dc:creator>
      <dc:date>2018-10-15T19:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Procedural DS2 code into MAS module and run it in Calculate window</title>
      <link>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/504477#M110</link>
      <description>&lt;P&gt;Andy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like if you can&amp;nbsp;create a track for this so I can send you a mail with the model in the attachment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 20:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Streaming-Analytics/Convert-Procedural-DS2-code-into-MAS-module-and-run-it-in/m-p/504477#M110</guid>
      <dc:creator>jovic92</dc:creator>
      <dc:date>2018-10-15T20:14:00Z</dc:date>
    </item>
  </channel>
</rss>

