ESP dSeries Workload Automation

 View Only
  • 1.  how to create a Global variable in WADE

    Posted Oct 07, 2020 10:37 AM
    ​I would like to create and use a date variable using the Global variable of WADE as shown below.

    I would like to know how to create a Global variable to use as below.

    1. Date Format : YYYYMMDD
       Global Variable : YDAY :   Yesterday
                                   TDAY : Today
    2. Date Format : YYYYMM
      Global Variable : PM : the previous month
                                 CM :  current month


  • 2.  RE: how to create a Global variable in WADE
    Best Answer

    Broadcom Employee
    Posted Oct 07, 2020 01:13 PM
    Hi, 
    Below are a 3 examples using 3 different methods.  I prefer the first method. Especially if the variable is only used in the current application.  Let me know if there are any questions. 
    NOTE: "less 1 workday" will need to be changed to "less 1 day"
    There may be much better ways to make this happen. 

    ********************************************************************************************************************************

    Option 1 - Creating a Application level variable - ********************************************************************************************************************************

    In the Event

    genTime('DB','today less 1 workday'); 

    APPL.year=DBYEAR; 

    APPL.month=DBMM; 

    APPL.day=DBDD; 

    APPL.yy=DBYEAR - 2000;

    In the job "Arguments to pass" Below is a sample arg. 

    "%APPL.day-%APPL.month-%APPL.yy"

     

    ********************************************************************************************************************************

    Option 2 - Setting an ESP level variable. 

    ********************************************************************************************************************************

    The event JavaScript

    genTime('DB','today less 1 workday'); 

    APPL.year=DBYEAR; 

    APPL.month=DBMM; 

    APPL.day=DBDD; 

    APPL.yy=DBYEAR - 2000;

    ESP.FHLB_DT3 = "%APPL.day-%APPL.month-%APPL.yy";

     

    In the job "Arguments to pass" below is a sample arg

     "%ESP.FHLB_DT3"

     

     

    ********************************************************************************************************************************

    Option 3 - Global Variable Table - this will need to be run daily to recalculate the global variable daily

    ********************************************************************************************************************************

    Below is the method using the global variable table. 

    In order to set the global variable you would need to issue a set command in the JavaScript. 

    Example: Modifying a Global Variable in a JavaScript Script. This would need to be run daily to set the variable. 

    The following example modifies the value of a global variable named FHLB_DT2. The FHLB_DT2 variable is assigned a value of the date representing "Today less 1 workday". 

    genTime('DB','today less 1 workday'); 

    APPL.year=DBYEAR; 

    APPL.month=DBMM; 

    APPL.day=DBDD; 

    APPL.yy=DBYEAR - 2000;

    setVar('FHLB_DT2','%APPL.day-%APPL.month-%APPL.yy');

    Example: Retieving the Global Variable in a JavaScript Script

    JavaScript in the job will need to be used to retrieve the variable.   

    ESP.date2 = getVar('FHLB_DT2');

     

    In the job…Below is a sample arg..

    "%ESP.date2"

     

    Don