From dd3aaad4a6d7640efac99c7ca576d70e65955650 Mon Sep 17 00:00:00 2001 From: "Infineon\\Mitchem" Date: Wed, 8 Jan 2025 15:25:45 -0700 Subject: [PATCH] Enhancements to COC_AVAILABILITY to reduce false positives and add additional logging. --- LSL2/STPROC/FTP_SERVICES.txt | 10 ++++-- LSL2/STPROC/SHIPMENT_SERVICES.txt | 60 +++++++++++++++++++------------ 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/LSL2/STPROC/FTP_SERVICES.txt b/LSL2/STPROC/FTP_SERVICES.txt index 9a0108c..38e7ae9 100644 --- a/LSL2/STPROC/FTP_SERVICES.txt +++ b/LSL2/STPROC/FTP_SERVICES.txt @@ -22,6 +22,7 @@ Function FTP_Services(@Service, @Params) History : (Date, Initials, Notes) 07/10/18 dmb Original programmer. 11/13/24 djm Add ListDirectory service. + 01/08/24 djm Changed ListDirectory to preserve host error message and set Error_Services. ***********************************************************************************************************************/ @@ -822,7 +823,6 @@ Service ListDirectory(Host=HOSTS, Username, Password, RemoteDirectory, Query, Sc If (Host NE '') AND (RemoteDirectory NE '') then ScriptPath = FTP_Services('CreateScript', ScriptPath, Host, '', Username, Password, '', RemoteDirectory, Query, 'list', SSH) If Error_Services('NoError') then - //FTP_Services('RunScript', ScriptPath, Host, Username, Password, '', RemoteDirectory, DeleteScript, SSH) If SSH EQ True$ then Command = 'psftp' If Username NE '' then @@ -837,9 +837,12 @@ Service ListDirectory(Host=HOSTS, Username, Password, RemoteDirectory, Query, Sc end else Command = 'ftp -i -n -s:' : ScriptPath end - //Command = 'psftp ' : ScriptPath DirectoryList = SRP_Run_Command(Command, 'VAR') - Gosub LsToMls + If Count(DirectoryList, 'ssh_init') EQ 0 then + Gosub LsToMls + end else + Error_Services('Add', DirectoryList) + end Response = DirectoryList If OutputPath NE '' then OutputDirectoryList = DirectoryList @@ -899,3 +902,4 @@ return + diff --git a/LSL2/STPROC/SHIPMENT_SERVICES.txt b/LSL2/STPROC/SHIPMENT_SERVICES.txt index 136329a..847a6da 100644 --- a/LSL2/STPROC/SHIPMENT_SERVICES.txt +++ b/LSL2/STPROC/SHIPMENT_SERVICES.txt @@ -18,6 +18,7 @@ Compile function Shipment_Services(@Service, @Params) History : (Date, Initials, Notes) 11/13/24 djm Original programmer. + 1/8/2025 djm Added parsing for connection errors and logging for loop resets. Removed emails for COC_AVAILABILITY. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler @@ -75,6 +76,7 @@ Service CycleRetentionDates() PotentialEndDate = CurrEndDate - 10 Begin Case Case CurrStartDate EQ EarliestDate + gosub LogLoopReset StartDate = TodayDate - 10 EndDate = TodayDate Case PotentialStartDate LT EarliestDate @@ -93,6 +95,7 @@ Service CycleRetentionDates() EndDate = Oconv(EndDate, 'D4-') Shipment_Services('CheckFileAvailability', StartDate, EndDate) end else + gosub LogLoopReset StartDate = TodayDate - 10 EndDate = TodayDate NewRec = '' @@ -151,14 +154,16 @@ Service CheckFileAvailability(StartDate, EndDate) DeleteScript = True$ Query = '*' : COCNo : '*' QueryResult = FTP_Services('ListDirectory', FTPHost, Username, Password, RemoteDirectory, Query, '', DeleteScript, SSH, '') - If QueryResult EQ '' then - Error_Services('Add', 'Expected file for shipment ' : COCNo : ' missing.') - NewCOC = False$ - Gosub LogMissingFile - end else - NewCOC = True$ + If Count(QueryResult, 'ssh_init') EQ 0 then + If QueryResult EQ '' then + Error_Services('Add', 'Expected file for shipment ' : COCNo : ' missing.') + NewCOC = False$ + Gosub LogMissingFile + end else + NewCOC = True$ + end + Database_Services('WriteDataRow', 'COC', COCNo, NewCOC, True$, False$, False$) end - Database_Services('WriteDataRow', 'COC', COCNo, NewCOC, True$, False$, False$) end END REPEAT @@ -219,18 +224,18 @@ Service SetMONACritical(MONAResource=MONAResources, ErrorMessage) IF MONAResource = 'FILE_GENERATION' OR MONAResource = 'FILE_TRANSMISSION' OR MONAResource = 'FILE_AVAILABILITY' then Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_COC', MONAResource, 'CRITICAL') - If ErrorMessage NE '' then - // Send an internal OI message to FI Support - Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', 'USER_ID', 'X') - SentFrom = 'SYSTEM' - Subject = 'COC ' : MONAResource : ' Error!' - Message = ErrorMessage - AttachWindow = '' - AttachKey = '' - SendToGroup = '' - Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup - obj_Notes('Create',Parms) - End +* If ErrorMessage NE '' then +* // Send an internal OI message to FI Support +* Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', 'USER_ID', 'X') +* SentFrom = 'SYSTEM' +* Subject = 'COC ' : MONAResource : ' Error!' +* Message = ErrorMessage +* AttachWindow = '' +* AttachKey = '' +* SendToGroup = '' +* Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup +* obj_Notes('Create',Parms) +* End end else Error_Services('Add', 'Invalid COC MONA resource.') end @@ -277,10 +282,7 @@ End Service // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//---------------------------------------------------------------------------------------------------------------------- -// LogMissingFile -// -//---------------------------------------------------------------------------------------------------------------------- + LogMissingFile: LogData = '' @@ -292,6 +294,17 @@ LogMissingFile: return +LogLoopReset: + + LogData = '' + LogData<1> = LoggingDTM + LogData<2> = '' + LogData<3> = 'Loop Restart' + LogData<4> = '' + Logging_Services('AppendLog', objLog, LogData, @RM, @FM) + +return + CompanyExceptionCheck: @@ -326,3 +339,4 @@ CompanyExceptionCheck: return +