From 60628da6ed9424ed783624891a6f9c6d4ba2a3a0 Mon Sep 17 00:00:00 2001 From: mt1976 Date: Mon, 20 Jan 2020 21:16:25 +0000 Subject: [PATCH] THRUPPENCE --- SIENA.BP/SIENA.BC.FXSPOT.HELPER | 2 +- SIENA.BP/SIENA.ECB.HELPER | 2 +- SIENA.BP/SIENA.FORWARDS.HELPER | 6 +- SIENA.BP/SIENA.FXCCYUPDATE.HELPER | 96 +++++++----- SIENA.BP/SIENA.FXSP.HELPER | 2 +- SIENA.BP/SIENA.GILTS.HELPER | 2 +- SIENA.BP/SIENA.MM.HELPER | 2 +- SIENA.BP/SIENA.NI.NAME | 2 +- SIENA.BP/SIENA.SCRIPT.HELPER | 2 +- SIENA.BP/SIENA.TBILLS.HELPER | 2 +- .../{ccyDatabases.list => ccyPair.list} | 0 .../{forwards.list => ccyPairSources.list} | 2 +- .../{forward_tenors.list => ccyTenor.list} | 0 UTIL.BP/I_UTIL.LOG.EVENT.H | 29 ---- UTIL.BP/I_UTIL.TRANSLATE.H | 12 -- UTIL.BP/U_MSSQL.EXECUTE | 141 ++++++++++-------- UTIL.BP/U_MSSQL.SELECT | 90 +++++------ UTIL.BP/U_TRANSLATE | 2 +- 18 files changed, 193 insertions(+), 201 deletions(-) rename SIENA.CONFIG/{ccyDatabases.list => ccyPair.list} (100%) mode change 100644 => 100755 rename SIENA.CONFIG/{forwards.list => ccyPairSources.list} (90%) mode change 100755 => 100644 rename SIENA.CONFIG/{forward_tenors.list => ccyTenor.list} (100%) delete mode 100644 UTIL.BP/I_UTIL.LOG.EVENT.H delete mode 100644 UTIL.BP/I_UTIL.TRANSLATE.H diff --git a/SIENA.BP/SIENA.BC.FXSPOT.HELPER b/SIENA.BP/SIENA.BC.FXSPOT.HELPER index 84c73348ad6..7e1edda3e82 100755 --- a/SIENA.BP/SIENA.BC.FXSPOT.HELPER +++ b/SIENA.BP/SIENA.BC.FXSPOT.HELPER @@ -9,7 +9,7 @@ SUBROUTINE SIENA.BC.FXSPOT.HELPER(PROCESS.NAME) * : on ldn-srv-ubnt01 (Linux) * ----------------------------------------------------------------------------- * -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H $INCLUDE UTIL.BP I_RATECSV.H $INCLUDE UTIL.BP I_UTIL.H diff --git a/SIENA.BP/SIENA.ECB.HELPER b/SIENA.BP/SIENA.ECB.HELPER index aacd0070777..435248dcf67 100755 --- a/SIENA.BP/SIENA.ECB.HELPER +++ b/SIENA.BP/SIENA.ECB.HELPER @@ -9,7 +9,7 @@ SUBROUTINE SIENA.ECB.HELPER(PROCESS.NAME) * : on ldn-srv-ubnt01 (Linux) * ----------------------------------------------------------------------------- * -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H $INCLUDE UTIL.BP I_RATECSV.H * INITIALISE diff --git a/SIENA.BP/SIENA.FORWARDS.HELPER b/SIENA.BP/SIENA.FORWARDS.HELPER index cd5e9c24b46..7ef5effe763 100755 --- a/SIENA.BP/SIENA.FORWARDS.HELPER +++ b/SIENA.BP/SIENA.FORWARDS.HELPER @@ -9,7 +9,7 @@ SUBROUTINE SIENA.FORWARDS.HELPER(PROCESS.NAME) * : on ldn-srv-ubnt01 (Linux) * ----------------------------------------------------------------------------- * -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H $INCLUDE UTIL.BP I_RATECSV.H $INCLUDE UTIL.BP I_UTIL.H @@ -40,10 +40,10 @@ $INCLUDE UTIL.BP I_UTIL.H PRECISION precisionValue CCYPAIR.LIST = "" ; NO.PAIRS = -1 - CALL U_OS.GET.LIST("SIENA.CONFIG", "forwards", "X", CCYPAIR.LIST, NO.PAIRS) + CALL U_OS.GET.LIST("SIENA.CONFIG", "ccyPair", "X", CCYPAIR.LIST, NO.PAIRS) TENOR.LIST = "" ; NO.TENORS = -1 - CALL U_OS.GET.LIST("SIENA.CONFIG", "forward_tenors", "TENOR", TENOR.LIST, NO.TENORS) + CALL U_OS.GET.LIST("SIENA.CONFIG", "ccyTenor", "TENOR", TENOR.LIST, NO.TENORS) CALL U_CRT.INFO("NO PAIRS", NO.PAIRS) OUTPUT.DATA = "" diff --git a/SIENA.BP/SIENA.FXCCYUPDATE.HELPER b/SIENA.BP/SIENA.FXCCYUPDATE.HELPER index 97f8d84a5a0..60f1c1d6961 100644 --- a/SIENA.BP/SIENA.FXCCYUPDATE.HELPER +++ b/SIENA.BP/SIENA.FXCCYUPDATE.HELPER @@ -13,59 +13,75 @@ $INCLUDE UTIL.BP I_UTIL.H $INCLUDE UTIL.BP F_UTIL.LOG.EVENT.H * INITIALISE - CALL U_START(PROCESS.NAME) + CALL U_START(PROCESS.NAME) * Setup some temp locations for input data + FN.SIENA.CONFIG = "SIENA.CONFIG" ; FV.SIENA.CONFIG = "" ; STOP.ON.ERROR = @TRUE ; ERROR.TEXT = "" + CALL U_OPENFILE(FN.SIENA.CONFIG, FV.SIENA.CONFIG, STOP.ON.ERROR, ERROR.TEXT) + ID.SIENA.CONFIG = "" -ID.SIENA.CONFIG = "" - - ERROR.TEXT = ""; STOP.ON.ERROR = @TRUE ; VERBOSE = @TRUE + ERROR.TEXT = ""; STOP.ON.ERROR = @TRUE ; VERBOSE = @TRUE * OPEN FILES - CALL U_HEADER("SIENA - Update CCY's to Deliver") + CALL U_HEADER("eurobase - Update CCY's to request") + + SOURCES.LIST = "" ; NO.SOURCES = -1 + CALL U_OS.GET.LIST("SIENA.CONFIG", "ccyPairSources", "SOURCE", SOURCES.LIST, NO.SOURCES) + + FOR I = 1 TO NO.SOURCES + + THIS.SOURCE = SOURCES.LIST + THIS.SOURCE = CONVERT("|", @AM, THIS.SOURCE) + + SQL.FIELDS = "CodeMajorCurrencyIsoCode,CodeMinorCurrencyIsoCode" + SQL.TABLE = "dbo.CurrencyPair" + SQL.WHERE = "Active=1" + RES.COLUMNS = "" + RES.DATA = "" + RES.COUNT = "" + SQL.KNOWN.AS = THIS.SOURCE<1> + SQL.ADDRESS = THIS.SOURCE<2> + SQL.DATABASE = THIS.SOURCE<3> + + CALL U_CRT.INFO("SOURCE", THIS.SOURCE) - SQL.FIELDS = "CodeMajorCurrencyIsoCode,CodeMinorCurrencyIsoCode" - SQL.TABLE = "dbo.CurrencyPair" - SQL.DATABASE = "rel_gateway_sal_prd_demo-sys-3" - SQL.WHERE = "Active=1" - RES.COLUMNS = "" - RES.DATA = "" - RES.COUNT = "" + GOSUB UPDATE.LIST + NEXT I + CALL U_STOP(PROCESS.NAME) - CALL U_MSSQL.SELECT(SQL.FIELDS, SQL.TABLE, SQL.DATABASE, SQL.WHERE, VERBOSE, ID.RESULT,RES.COLUMNS,RES.DATA,RES.COUNT) + RETURN - CALL U_CRT.INFO("RESULT", ID.RESULT) - CALL U_CRT.RECORD(RES.COLUMNS) - CALL U_CRT.RECORD(RES.DATA) - CALL U_CRT.INFO("NO RECORDS",RES.COUNT) +UPDATE.LIST: + CALL U_MSSQL.SELECT(SQL.FIELDS, SQL.TABLE, SQL.ADDRESS, SQL.DATABASE, SQL.WHERE, VERBOSE, ID.RESULT,RES.COLUMNS,RES.DATA,RES.COUNT) + CALL U_CRT.INFO("RESULT", ID.RESULT) + CALL U_CRT.RECORD(RES.COLUMNS) + CALL U_CRT.RECORD(RES.DATA) + CALL U_CRT.INFO("NO RECORDS",RES.COUNT) -ID.SIENA.CONFIG = SQL.DATABASE:"_forwards.list" + ID.SIENA.CONFIG = "tmp_":SQL.KNOWN.AS:"_ccyPair.list" -R.NEW.LIST = "" -R.NEW.LIST<-1> = "#=----------------------------------------------------------------------------=" -R.NEW.LIST<-1> = "#=AUTO GENERATED - FX SPOT & FORWARD CURVES TO FETCH=" -R.NEW.LIST<-1> = "#=GENERATED at ":OCONV(TIME(),"MTS."):" on ":OCONV(DATE(),"D4/"):"=" -R.NEW.LIST<-1> = "#=For ":ID.SIENA.CONFIG:" in SIENA.CONFIG=" -R.NEW.LIST<-1> = "#=----------------------------------------------------------------------------=" + R.NEW.LIST = "" + R.NEW.LIST<-1> = "#=----------------------------------------------------------------------------=" + R.NEW.LIST<-1> = "#=AUTO GENERATED - FX SPOT & FORWARD CURVES TO FETCH=" + R.NEW.LIST<-1> = "#=GENERATED at ":OCONV(TIME(),"MTS."):" on ":OCONV(DATE(),"D4/"):"=" + R.NEW.LIST<-1> = "#=Temp file is ":ID.SIENA.CONFIG:" in SIENA.CONFIG=" + R.NEW.LIST<-1> = "#=----------------------------------------------------------------------------=" -FOR THIS.PAIR.POS = 1 TO RES.COUNT -CCY.PAIR = RES.DATA:RES.DATA -CALL U_CRT.INFO("PAIR",CCY.PAIR) -R.NEW.LIST<-1> = "X=":CCY.PAIR:"=" -NEXT THIS.PAIR.POS + FOR THIS.PAIR.POS = 1 TO RES.COUNT + CCY.PAIR = RES.DATA:RES.DATA + CALL U_CRT.INFO("PAIR",CCY.PAIR) + R.NEW.LIST<-1> = "X=":CCY.PAIR:"=" + NEXT THIS.PAIR.POS -FN.SIENA.CONFIG = "SIENA.CONFIG" ; FV.SIENA.CONFIG = "" ; STOP.ON.ERROR = @TRUE ; ERROR.TEXT = "" -CALL U_OPENFILE(FN.SIENA.CONFIG, FV.SIENA.CONFIG, STOP.ON.ERROR, ERROR.TEXT) -CALL U_WRITE(FV.SIENA.CONFIG, ID.SIENA.CONFIG, R.NEW.LIST, STOP.ON.ERROR, ERROR.TEXT) + CALL U_WRITE(FV.SIENA.CONFIG, ID.SIENA.CONFIG, R.NEW.LIST, STOP.ON.ERROR, ERROR.TEXT) -R.UTIL.LOG.EVENT = "" -R.UTIL.LOG.EVENT = 'REGENERATE' -R.UTIL.LOG.EVENT = 'SIENA.CONFIG UPDATED' -R.UTIL.LOG.EVENT = ID.SIENA.CONFIG + R.UTIL.LOG.EVENT = "" + R.UTIL.LOG.EVENT = 'REGENERATE' + R.UTIL.LOG.EVENT = 'SIENA.CONFIG UPDATED' + R.UTIL.LOG.EVENT = ID.SIENA.CONFIG -CALL U_CRT.RECORD(R.NEW.LIST) -CALL U_LOG.CMD("", R.UTIL.LOG.EVENT) + CALL U_CRT.RECORD(R.NEW.LIST) + CALL U_LOG.CMD("", R.UTIL.LOG.EVENT) - CALL U_STOP(PROCESS.NAME) +RETURN - RETURN END diff --git a/SIENA.BP/SIENA.FXSP.HELPER b/SIENA.BP/SIENA.FXSP.HELPER index 68ac2072e7c..1d41b8e0a7a 100755 --- a/SIENA.BP/SIENA.FXSP.HELPER +++ b/SIENA.BP/SIENA.FXSP.HELPER @@ -9,7 +9,7 @@ SUBROUTINE SIENA.FXSP.HELPER(PROCESS.NAME) * : on ldn-srv-ubnt01 (Linux) * ----------------------------------------------------------------------------- * -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H $INCLUDE UTIL.BP I_RATECSV.H $INCLUDE UTIL.BP I_UTIL.H diff --git a/SIENA.BP/SIENA.GILTS.HELPER b/SIENA.BP/SIENA.GILTS.HELPER index e9dbabe8d29..efab3f47497 100755 --- a/SIENA.BP/SIENA.GILTS.HELPER +++ b/SIENA.BP/SIENA.GILTS.HELPER @@ -11,7 +11,7 @@ SUBROUTINE SIENA.GILTS.HELPER(PROCESS.NAME) * $INCLUDE UTIL.BP I_UTIL.H $INCLUDE UTIL.BP I_UKTREASURY.H -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H *** https://www.londonstockexchange.com/download/csv/tbLSEBondsDownloadCSV_en.csv *** * INITIALISE diff --git a/SIENA.BP/SIENA.MM.HELPER b/SIENA.BP/SIENA.MM.HELPER index ee17b9aeae3..c9221c428b8 100755 --- a/SIENA.BP/SIENA.MM.HELPER +++ b/SIENA.BP/SIENA.MM.HELPER @@ -9,7 +9,7 @@ SUBROUTINE SIENA.MM.HELPER(PROCESS.NAME, PROCESS.TYPE) * : on ldn-srv-ubnt01 (Linux) * ----------------------------------------------------------------------------- * -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H $INCLUDE UTIL.BP I_RATECSV.H * INITIALISE CALL U_START(PROCESS.NAME) diff --git a/SIENA.BP/SIENA.NI.NAME b/SIENA.BP/SIENA.NI.NAME index 50489df5ea6..b2e38ecef15 100755 --- a/SIENA.BP/SIENA.NI.NAME +++ b/SIENA.BP/SIENA.NI.NAME @@ -10,7 +10,7 @@ SUBROUTINE SIENA.NI.NAME(IO.NAME, COUPON.VALUE, MATURITY.DATE) * ----------------------------------------------------------------------------- * $INCLUDE UTIL.BP I_UTIL.H -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H MANIP.ARRAY = CONVERT(" ", @AM, IO.NAME) diff --git a/SIENA.BP/SIENA.SCRIPT.HELPER b/SIENA.BP/SIENA.SCRIPT.HELPER index 1d347077cbe..ffbb1e68eec 100755 --- a/SIENA.BP/SIENA.SCRIPT.HELPER +++ b/SIENA.BP/SIENA.SCRIPT.HELPER @@ -9,7 +9,7 @@ SUBROUTINE SIENA.SCRIPT.HELPER(SCRIPT.NAME) * : on ldn-srv-ubnt01 (Linux) * ----------------------------------------------------------------------------- * -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H $INCLUDE UTIL.BP I_RATECSV.H * INITIALISE diff --git a/SIENA.BP/SIENA.TBILLS.HELPER b/SIENA.BP/SIENA.TBILLS.HELPER index fc1c0c54caa..48f741911e4 100755 --- a/SIENA.BP/SIENA.TBILLS.HELPER +++ b/SIENA.BP/SIENA.TBILLS.HELPER @@ -9,7 +9,7 @@ SUBROUTINE SIENA.ECB.HELPER(PROCESS.NAME) * : on ldn-srv-ubnt01 (Linux) * ----------------------------------------------------------------------------- * -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H $INCLUDE UTIL.BP I_RATECSV.H * INITIALISE diff --git a/SIENA.CONFIG/ccyDatabases.list b/SIENA.CONFIG/ccyPair.list old mode 100644 new mode 100755 similarity index 100% rename from SIENA.CONFIG/ccyDatabases.list rename to SIENA.CONFIG/ccyPair.list diff --git a/SIENA.CONFIG/forwards.list b/SIENA.CONFIG/ccyPairSources.list old mode 100755 new mode 100644 similarity index 90% rename from SIENA.CONFIG/forwards.list rename to SIENA.CONFIG/ccyPairSources.list index 9c36c329da7..16f29431133 --- a/SIENA.CONFIG/forwards.list +++ b/SIENA.CONFIG/ccyPairSources.list @@ -1,6 +1,6 @@ #=----------------------------------------------------------------------------= #=FX SPOT & FORWARD CURVES TO FETCH= -X=GBPUSD= +SOURCE=37-3|192.168.1.1|rel_gw3= X=EURUSD= X=USDCAD= X=EURCAD= diff --git a/SIENA.CONFIG/forward_tenors.list b/SIENA.CONFIG/ccyTenor.list similarity index 100% rename from SIENA.CONFIG/forward_tenors.list rename to SIENA.CONFIG/ccyTenor.list diff --git a/UTIL.BP/I_UTIL.LOG.EVENT.H b/UTIL.BP/I_UTIL.LOG.EVENT.H deleted file mode 100644 index cec0876eea1..00000000000 --- a/UTIL.BP/I_UTIL.LOG.EVENT.H +++ /dev/null @@ -1,29 +0,0 @@ -* -* AUTOGENERATED FIELD DEFINITIONS -* FILE : "UTIL.BP" -* NAME : "I_UTIL.LOG.EVENT.H" -* NAME : "U_LOG_" -* BUILT : 20 JAN 2020 at 11.56.46 -* -equate U_LOG_EVENT to 1 -equate U_LOG_DATE to 2 -equate U_LOG_TIME to 3 -equate U_LOG_USER to 4 -equate U_LOG_MSG to 5 -equate U_LOG_ID to 6 -equate U_LOG_CMD to 7 -equate U_LOG_URI to 8 -equate U_LOG_RETCD to 9 -equate U_LOG_SUBR to 10 -equate U_LOG_TTY to 11 -equate U_LOG_USERNO to 12 -equate U_LOG_PATH to 13 -equate U_LOG_WHO to 14 -equate U_LOG_SENTENCE to 15 -equate U_LOG_HOST to 16 -equate U_LOG_IP to 17 -equate U_LOG_PLATFORM to 18 -equate U_LOG_START to 19 -equate U_LOG_STOP to 20 -equate U_LOG_ELAPSED to 21 -equate U_LOG_PROCESS to 22 diff --git a/UTIL.BP/I_UTIL.TRANSLATE.H b/UTIL.BP/I_UTIL.TRANSLATE.H deleted file mode 100644 index 778ed397d4f..00000000000 --- a/UTIL.BP/I_UTIL.TRANSLATE.H +++ /dev/null @@ -1,12 +0,0 @@ -* -* AUTOGENERATED FIELD DEFINITIONS -* FILE : "UTIL.BP" -* NAME : "I_UTIL.TRANSLATE.H" -* NAME : "U_TRNS." -* BUILT : 20 JAN 2020 at 11.56.50 -* -equate U_TRNS.RVSERVER to 1 -equate U_TRNS.UKTDATA to 2 -equate U_TRNS.NIPART to 3 -equate U_TRNS.NINAME to 4 -equate U_TRNS.BARCHARTCOM to 5 diff --git a/UTIL.BP/U_MSSQL.EXECUTE b/UTIL.BP/U_MSSQL.EXECUTE index 139acc668b0..99824666bb4 100644 --- a/UTIL.BP/U_MSSQL.EXECUTE +++ b/UTIL.BP/U_MSSQL.EXECUTE @@ -1,8 +1,8 @@ -SUBROUTINE U_MSSQL.EXECUTE(SQL.STATEMENT, SQL.DATABASE, VERBOSE, ID.RESULT) +SUBROUTINE U_MSSQL.EXECUTE(SQL.STATEMENT, SQL.ADDRESS, SQL.DATABASE, VERBOSE, ID_UTIL.SQL.RESPONSE) ** INFORMATION **************************************************************** * Routine Name : U_MSSQL.EXECUTE * Type : SUBROUTINE -* Params : SQL.STATEMENT, SQL.DATABASE, VERBOSE, ID.RESULT +* Params : SQL.STATEMENT, SQL.DATABASE, VERBOSE, ID_UTIL.SQL.RESPONSE * Loc : UTIL.BP * ----------------------------------------------------------------------------- * Info Updated : 20200120 at 16.53.17 in MWT-QM-DEV by sales @@ -11,80 +11,95 @@ SUBROUTINE U_MSSQL.EXECUTE(SQL.STATEMENT, SQL.DATABASE, VERBOSE, ID.RESULT) * $INCLUDE UTIL.BP I_UTIL.H $INCLUDE UTIL.BP F_UTIL.LOG.EVENT.H +$INCLUDE UTIL.BP F_UTIL.SQL.CMD.H * SQL SERVER * ------------------- * Uses a headless MS SQL server commandline to scrape fully rendered results from MS SQL Server -FN.UTIL.SQL.CMD = "UTIL.SQL.CMD" -FV.UTIL.SQL.CMD = "" -FP.UTIL.SQL.CMD = "" -STOP.ON.ERROR = @TRUE -ERROR.TEXT = "" -CALL U_OPENFILE(FN.UTIL.SQL.CMD, FV.UTIL.SQL.CMD, STOP.ON.ERROR, ERROR.TEXT) -CALL U_OS.FILE.PATH(FV.UTIL.SQL.CMD, FP.UTIL.SQL.CMD) -CALL U_CRT.INFO(FN.UTIL.SQL.CMD,FP.UTIL.SQL.CMD) -FN.UTIL.SQL.RESPONSE = "UTIL.SQL.RESPONSE" -FV.UTIL.SQL.RESPONSE = "" -FP.UTIL.SQL.RESPONSE = "" -STOP.ON.ERROR = @TRUE -ERROR.TEXT = "" -CALL U_OPENFILE(FN.UTIL.SQL.RESPONSE, FV.UTIL.SQL.RESPONSE, STOP.ON.ERROR, ERROR.TEXT) -CALL U_OS.FILE.PATH(FV.UTIL.SQL.RESPONSE, FP.UTIL.SQL.RESPONSE) -CALL U_CRT.INFO(FN.UTIL.SQL.RESPONSE,FP.UTIL.SQL.RESPONSE) +* OPEN FILES START + FN_UTIL.SQL.CMD = "UTIL.SQL.CMD" + FV_UTIL.SQL.CMD = "" + FP_UTIL.SQL.CMD = "" + STOP.ON.ERROR = @TRUE + ERROR.TEXT = "" + CALL U_OPENFILE(FN_UTIL.SQL.CMD, FV_UTIL.SQL.CMD, STOP.ON.ERROR, ERROR.TEXT) + CALL U_OS.FILE.PATH(FV_UTIL.SQL.CMD, FP_UTIL.SQL.CMD) + CALL U_CRT.INFO(FN_UTIL.SQL.CMD,FP_UTIL.SQL.CMD) + FN_UTIL.SQL.RESPONSE = "UTIL.SQL.RESPONSE" + FV_UTIL.SQL.RESPONSE = "" + FP_UTIL.SQL.RESPONSE = "" + STOP.ON.ERROR = @TRUE + ERROR.TEXT = "" + CALL U_OPENFILE(FN_UTIL.SQL.RESPONSE, FV_UTIL.SQL.RESPONSE, STOP.ON.ERROR, ERROR.TEXT) + CALL U_OS.FILE.PATH(FV_UTIL.SQL.RESPONSE, FP_UTIL.SQL.RESPONSE) +* OPEN FILES END + CALL U_CRT.INFO(FN_UTIL.SQL.RESPONSE,FP_UTIL.SQL.RESPONSE) * Get the location of the chrome executable; - SQL.AGENT = "" ; SQL.USERNAME = "" ; SQL.PASSWORD = "" ; SQL.ADDRESS = "" ; SQL.DEFAULTDB = ""; - CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "command", SQL.AGENT) - CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "username", SQL.USERNAME) - CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "password", SQL.PASSWORD) - CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "server", SQL.ADDRESS) - CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "defaultdb", SQL.DEFAULTDB) - - IF SQL.DATABASE = "" THEN SQL.DATABASE = SQL.DEFAULTDB - - CALL U_CRT.INFO("SQL.AGENT",SQL.AGENT) - CALL U_CRT.INFO("SQL.USERNAME",SQL.USERNAME) - CALL U_CRT.INFO("SQL.PASSWORD",SQL.PASSWORD) - CALL U_CRT.INFO("SQL.ADDRESS",SQL.ADDRESS) - CALL U_CRT.INFO("SQL.DEFAULTDB",SQL.DEFAULTDB) - CALL U_CRT.INFO("SQL.DATABASE",SQL.DATABASE) - CALL U_CRT.INFO("MSSQL.FETCH", "START") - - CALL U_UNIQUE.ID(TEMP.ID) - TEMP.LEN = LEN(TEMP.ID)-4 - SQL.ID = LEFT(TEMP.ID,TEMP.LEN):".sql" - OUT.ID = LEFT(TEMP.ID,TEMP.LEN):".out" - - CALL U_CRT.INFO("REQUEST ID",SQL.ID) - CALL U_CRT.INFO("RESPONSEID",OUT.ID) - - STMT.EX = SQL.AGENT - STMT.EX = STMT.EX:" -S ":SQL.ADDRESS - STMT.EX = STMT.EX:" -d ":SQL.DATABASE - STMT.EX = STMT.EX:" -U ":SQL.USERNAME - STMT.EX = STMT.EX:" -P ":SQL.PASSWORD - STMT.EX = STMT.EX:" -i ":FP.UTIL.SQL.CMD:"/":SQL.ID - STMT.EX = STMT.EX:" -o ":FP.UTIL.SQL.RESPONSE:"/":OUT.ID + SQL.AGENT = "" ; SQL.USERNAME = "" ; SQL.PASSWORD = "" ; SQL.DEFAULTIP = "" ; SQL.DEFAULTDB = ""; + CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "command", SQL.AGENT) + CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "username", SQL.USERNAME) + CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "password", SQL.PASSWORD) + CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "server", SQL.DEFAULTIP) + CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "defaultdb", SQL.DEFAULTDB) + + IF SQL.DATABASE = "" THEN SQL.DATABASE = SQL.DEFAULTDB + IF SQL.ADDRESS = "" THEN SQL.ADDRESS = SQL.DEFAULTIP + + CALL U_CRT.INFO("SQL.AGENT",SQL.AGENT) + CALL U_CRT.INFO("SQL.USERNAME",SQL.USERNAME) + CALL U_CRT.INFO("SQL.PASSWORD",SQL.PASSWORD) + CALL U_CRT.INFO("SQL.ADDRESS",SQL.ADDRESS) + CALL U_CRT.INFO("SQL.DEFAULTDB",SQL.DEFAULTDB) + CALL U_CRT.INFO("SQL.DATABASE",SQL.DATABASE) + CALL U_CRT.INFO("MSSQL.FETCH", "START") + + CALL U_UNIQUE.ID(ID_UNIQUE) + TEMP.LEN = LEN(ID_UNIQUE)-4 + ID_UTIL.SQL.CMD = LEFT(ID_UNIQUE,TEMP.LEN):".sql" + ID_UTIL.SQL.RESPONSE = LEFT(ID_UNIQUE,TEMP.LEN):".out" + + CALL U_CRT.INFO("MSSQL.COMMAND ",ID_UTIL.SQL.CMD) + CALL U_CRT.INFO("MSSQL.RESPONSE",ID_UTIL.SQL.RESPONSE) + + STMT.EX = SQL.AGENT + STMT.EX = STMT.EX:" -S ":SQL.ADDRESS + STMT.EX = STMT.EX:" -d ":SQL.DATABASE + STMT.EX = STMT.EX:" -U ":SQL.USERNAME + STMT.EX = STMT.EX:" -P ":SQL.PASSWORD + STMT.EX = STMT.EX:" -i ":FP_UTIL.SQL.CMD:"/":ID_UTIL.SQL.CMD + STMT.EX = STMT.EX:" -o ":FP_UTIL.SQL.RESPONSE:"/":ID_UTIL.SQL.RESPONSE * The last part tells MSSQL to output in CSV and use commas. CALL U_CRT.INFO("STMT.EX",STMT.EX) - ID.RESULT = OUT.ID + R.UTIL.SQL.CMD = SQL.STATEMENT + + CALL U_WRITE(FV_UTIL.SQL.CMD, ID.UTIL.SQL.CMD, R.UTIL.SQL.CMD, STOP.ON.ERROR, ERROR.TEXT) + + TIME.START = TIME() + + CALL U_CRT.INFO("MSSQL.EX", "START @ ":OCONV(TIME.START,"MTS.")) + + OS.EXECUTE STMT.EX CAPTURING RESULT - ID.UTIL.SQL.CMD = SQL.ID - R.UTIL.SQL.CMD = SQL.STATEMENT - CALL U_WRITE(FV.UTIL.SQL.CMD, ID.UTIL.SQL.CMD, R.UTIL.SQL.CMD, STOP.ON.ERROR, ERROR.TEXT) + TIME.STOP = TIME() + TIME.ELAPSED = TIME.STOP - TIME.START - OS.EXECUTE STMT.EX CAPTURING RESULT + CALL U_CRT.INFO("MSSQL.EX", "STOP @ ":OCONV(TIME.START,"MTS.")) + CALL U_CRT.INFO("MSSQL.EX", "ELAPSED @ ":OCONV(TIME.ELAPSED,"MTS.")) + CALL U_CRT.INFO("MSSQL.EX", "STOP") - CALL U_CRT.INFO("MSSQL.FETCH", "STOP") + R.EVENT = "" + R.EVENT = "MSSQL.EXECUTE" + R.EVENT = STMT.EX + R.EVENT = SQL.STATEMENT<1> + R.EVENT = @SYSTEM.RETURN.CODE + R.EVENT = "U_MSSQL.EXECUTE" + R.EVENT = OCONV(TIME.START,"MTS.") + R.EVENT = OCONV(TIME.STOP,"MTS.") + R.EVENT = OCONV(TIME.ELAPSED,"MTS.") - R.EVENT = "" - R.EVENT = "MS.SQL.SERVER" - R.EVENT = STMT.EX - R.EVENT = SQL.STATEMENT<1> - R.EVENT = @SYSTEM.RETURN.CODE - R.EVENT = "U_MSSQL.EXECUTE" + CALL U_LOG.CMD(RESULT, R.EVENT) - CALL U_LOG.CMD(RESULT, R.EVENT) RETURN END diff --git a/UTIL.BP/U_MSSQL.SELECT b/UTIL.BP/U_MSSQL.SELECT index 4dfba6d9567..4cd7296b4ef 100644 --- a/UTIL.BP/U_MSSQL.SELECT +++ b/UTIL.BP/U_MSSQL.SELECT @@ -1,4 +1,4 @@ -SUBROUTINE U_MSSQL.SELECT(SQL.FIELDS, SQL.TABLE, SQL.DATABASE, SQL.WHERE, VERBOSE, ID.RESULT, RESULT.COLUMNS,RESULT.DATA,RESULT.COUNT) +SUBROUTINE U_MSSQL.SELECT(SQL.FIELDS, SQL.TABLE, SQL.ADDRESS, SQL.DATABASE, SQL.WHERE, VERBOSE, ID.RESULT, RESULT.COLUMNS,RESULT.DATA,RESULT.COUNT) ** INFORMATION **************************************************************** * Routine Name : U_MSSQL.SELECT * Type : SUBROUTINE @@ -12,58 +12,60 @@ SUBROUTINE U_MSSQL.SELECT(SQL.FIELDS, SQL.TABLE, SQL.DATABASE, SQL.WHERE, VERBOS $INCLUDE UTIL.BP I_UTIL.H $INCLUDE UTIL.BP F_UTIL.LOG.EVENT.H -RESULT.DATA = "" + RESULT.DATA = "" -FN.UTIL.SQL.RESPONSE = "UTIL.SQL.RESPONSE" -FV.UTIL.SQL.RESPONSE = "" -FP.UTIL.SQL.RESPONSE = "" -STOP.ON.ERROR = @TRUE -ERROR.TEXT = "" + FN.UTIL.SQL.RESPONSE = "UTIL.SQL.RESPONSE" + FV.UTIL.SQL.RESPONSE = "" + FP.UTIL.SQL.RESPONSE = "" + STOP.ON.ERROR = @TRUE + ERROR.TEXT = "" -CALL U_OPENFILE(FN.UTIL.SQL.RESPONSE, FV.UTIL.SQL.RESPONSE, STOP.ON.ERROR, ERROR.TEXT) -CALL U_OS.FILE.PATH(FV.UTIL.SQL.RESPONSE, FP.UTIL.SQL.RESPONSE) -CALL U_CRT.INFO(FN.UTIL.SQL.RESPONSE,FP.UTIL.SQL.RESPONSE) + CALL U_OPENFILE(FN.UTIL.SQL.RESPONSE, FV.UTIL.SQL.RESPONSE, STOP.ON.ERROR, ERROR.TEXT) + CALL U_OS.FILE.PATH(FV.UTIL.SQL.RESPONSE, FP.UTIL.SQL.RESPONSE) + CALL U_CRT.INFO(FN.UTIL.SQL.RESPONSE,FP.UTIL.SQL.RESPONSE) -CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "resultDelim", SQL.DELIM) + CALL U_OS.GET.PROPERTY("UTIL.CONFIG", "mssql", "resultDelim", SQL.DELIM) -IN.STATEMENT = "" -IN.STATEMENT = IN.STATEMENT:"select " -IF SQL.FIELDS <> "" THEN - IN.STATEMENT = IN.STATEMENT:SQL.FIELDS -END ELSE - IN.STATEMENT = IN.STATEMENT:"*" -END -IN.STATEMENT = IN.STATEMENT:" from ":SQL.TABLE -IF SQL.WHERE <> "" THEN - IN.STATEMENT = IN.STATEMENT:" where ":SQL.WHERE -END + IN.STATEMENT = "" + IN.STATEMENT = IN.STATEMENT:"select " + IF SQL.FIELDS <> "" THEN + IN.STATEMENT = IN.STATEMENT:SQL.FIELDS + END ELSE + IN.STATEMENT = IN.STATEMENT:"*" + END -CALL U_MSSQL.EXECUTE(IN.STATEMENT,SQL.DATABASE,@TRUE,ID.RESULT) + IN.STATEMENT = IN.STATEMENT:" from ":SQL.TABLE + IF SQL.WHERE <> "" THEN + IN.STATEMENT = IN.STATEMENT:" where ":SQL.WHERE + END -CALL U_READ(FV.UTIL.SQL.RESPONSE, ID.RESULT, R.UTIL.SQL.RESPONSE, STOP.ON.ERROR, ERROR.TEXT) + CALL U_MSSQL.EXECUTE(IN.STATEMENT, SQL.ADDRESS, SQL.DATABASE, @TRUE, ID.RESULT) -NO.COLUMNS = DCOUNT(R.UTIL.SQL.RESPONSE<2>,SQL.DELIM)-2 + CALL U_READ(FV.UTIL.SQL.RESPONSE, ID.RESULT, R.UTIL.SQL.RESPONSE, STOP.ON.ERROR, ERROR.TEXT) -CALL U_CRT.INFO("NO.FIELDS",DCOUNT(SQL.FIELDS,",")) -CALL U_CRT.INFO("NO.COLUMNS",NO.COLUMNS) + NO.COLUMNS = DCOUNT(R.UTIL.SQL.RESPONSE<2>,SQL.DELIM)-2 + + CALL U_CRT.INFO("NO.FIELDS",DCOUNT(SQL.FIELDS,",")) + CALL U_CRT.INFO("NO.COLUMNS",NO.COLUMNS) * get column names -RESULT.COLUMNS = TRIM(CHANGE(R.UTIL.SQL.RESPONSE<2>,SQL.DELIM,@AM)) -DEL RESULT.COLUMNS<1> -NO.CDS = DCOUNT(RESULT.COLUMNS,@AM) -DEL RESULT.COLUMNS -RESULT.COLUMNS = TRIMWS(RESULT.COLUMNS) -CALL U_CRT.RECORD(RESULT.COLUMNS) + RESULT.COLUMNS = TRIM(CHANGE(R.UTIL.SQL.RESPONSE<2>,SQL.DELIM,@AM)) + DEL RESULT.COLUMNS<1> + NO.CDS = DCOUNT(RESULT.COLUMNS,@AM) + DEL RESULT.COLUMNS + RESULT.COLUMNS = TRIMWS(RESULT.COLUMNS) + CALL U_CRT.RECORD(RESULT.COLUMNS) + + NO.ROWS = DCOUNT(R.UTIL.SQL.RESPONSE,@AM) + START.ROW = 4 + END.ROW = NO.ROWS - 2 + FOR PROCESS.ROW = START.ROW TO END.ROW + RESULT.DATA.TMP = CHANGE(R.UTIL.SQL.RESPONSE,SQL.DELIM,@VM) + DEL RESULT.DATA.TMP<1,1> + DEL RESULT.DATA.TMP<1,NO.CDS> + RESULT.DATA<-1> = TRIMWS(RESULT.DATA.TMP) + NEXT PROCESS.ROW + RESULT.COUNT = DCOUNT(RESULT.DATA,@AM) -NO.ROWS = DCOUNT(R.UTIL.SQL.RESPONSE,@AM) -START.ROW = 4 -END.ROW = NO.ROWS - 2 -FOR PROCESS.ROW = START.ROW TO END.ROW -RESULT.DATA.TMP = CHANGE(R.UTIL.SQL.RESPONSE,SQL.DELIM,@VM) -DEL RESULT.DATA.TMP<1,1> -DEL RESULT.DATA.TMP<1,NO.CDS> -RESULT.DATA<-1> = TRIMWS(RESULT.DATA.TMP) -NEXT PROCESS.ROW -RESULT.COUNT = DCOUNT(RESULT.DATA,@AM) - RETURN + RETURN END diff --git a/UTIL.BP/U_TRANSLATE b/UTIL.BP/U_TRANSLATE index 85c1b45487f..40bd4e223c9 100755 --- a/UTIL.BP/U_TRANSLATE +++ b/UTIL.BP/U_TRANSLATE @@ -10,7 +10,7 @@ SUBROUTINE U_TRANSLATE(TYPE, IN.TEXT, FIELD.NO, OUT.TEXT) * ----------------------------------------------------------------------------- * $INCLUDE UTIL.BP I_UTIL.H -$INCLUDE UTIL.BP I_UTIL.TRANSLATE.H +$INCLUDE UTIL.BP F_UTIL.TRANSLATE.H IF FIELD.NO<>"" THEN FN.TRANSLATE="UTIL.TRANSLATE" FV.TRANSLATE = ""