ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 更新essbase 日期变量

更新essbase 日期变量

原创 Linux操作系统 作者:chengdsc 时间:2011-05-24 15:27:26 0 删除 编辑

批处理脚本内容如下

:: ********************* Set up the Day, Month, Year Variables **************************
   FOR /f "tokens=1-4 delims=- " %%a in ('date /t') do (
    set yy=%%a
    set mm=%%b
    set dd=%%c
    )
                                                                             
 set /a pr_mm=%mm%-1
 set /a pr_yy=%yy%-1

:: ***************** set up mapping table ************************
  set monthmap=00-Dec;01-Jan;02-Feb;03-Mar;04-Apr;05-May;06-Jun;07-Jul;08-Aug;09-Sep;10-Oct;11-Nov;12-Dec
::*************** set current month variable ************
 CALL SET cur_month=%%monthmap:*%mm%-=%%
 SET cur_month=%cur_month:;=&rem.%

::*************** set prior month variable **************
 CALL SET pr_month=%%monthmap:*%pr_mm%-=%%
 SET pr_month=%pr_month:;=&rem.%

echo current_month: %cur_month%
echo prior_month: %pr_month%

::*************** set current & prior year variables ***********
 set cur_yr=FY%yy:~-2%
 set pr_yr=FY%pr_yy:~-2%

echo current_year: %cur_yr%
echo prior_year: %pr_yr%

::************ set up CurrActMonth & CurrActYear variables ***************                                                                                         
 IF %cur_month% EQU Jan goto Var_Jan
 IF %dd% LSS 25 goto before25
 IF %dd% GEQ 25 goto after25
 
:Var_Jan
 IF %dd% LSS 25 goto before25_Jan
 goto after25

:before25_Jan
 SET CurrActMonth=Dec
 SET CurrActYear=%pr_yr%
 goto End
  
:before25
 SET CurrActMonth=%pr_month%
 SET CurrActYear=%cur_yr%
 goto End
  
:after25
 SET CurrActMonth=%cur_month%
 SET CurrActYear=%cur_yr%
 goto End
:End

echo CurrActMonth: %CurrActMonth%
echo CurrActYear: %CurrActYear%

:: ***************** Excute the MAXL script. if the date is 25th ***********************
 IF %dd% EQU 25 goto MAXL_update_date
 exit

REM /============ excute MAXL script. to update the Substitution Variables ======================/
:MAXL_update_date
 essmsh SubVar_CurrActMonth_Year.msh

SubVar_CurrActMonth_Year.msh

/* --------------------------------------------------------------------------
*  LOGIN AND SETUP SCRIPT. VARIABLES - &CurrActMonth and &CurrActYear
* -------------------------------------------------------------------------- */

/* NB -- user, password, and server are set up separately as Windows
  environment variables.    */
login "$ESS_USERID" "$ESS_PASSWD" on "$ESS_SERVER";

/* ---------------- SET UP SUBSTITUTION VARIALBES --------------------------- */
alter system set variable 'CurrActMonth' $CurrActMonth;
alter system set variable 'CurrActYear' $CurrActYear;

logout;
exit;

在msh文件中引用系统临时变量需要在变量前加“$”!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7477027/viewspace-696150/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Essbase Stufff
请登录后发表评论 登录
全部评论

注册时间:2008-05-13

  • 博文量
    138
  • 访问量
    238417