From 7782918afdf64be5fdab062d24e44793658768f5 Mon Sep 17 00:00:00 2001 From: "Infineon\\Mitchem" Date: Tue, 3 Dec 2024 10:20:52 -0700 Subject: [PATCH] Added lock protection for COC service. --- LSL2/STPROC/SHIPMENT_SERVICES.txt | 86 +++++++++++++++++-------------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/LSL2/STPROC/SHIPMENT_SERVICES.txt b/LSL2/STPROC/SHIPMENT_SERVICES.txt index 8ea07c7..136329a 100644 --- a/LSL2/STPROC/SHIPMENT_SERVICES.txt +++ b/LSL2/STPROC/SHIPMENT_SERVICES.txt @@ -27,6 +27,7 @@ $Insert COC_EQUATES $Insert COMPANY_EQUATES Declare function Error_Services, Company_Services, FTP_Services, Environment_Services, Logging_Services, Shipment_Services +Declare function Database_Services Declare subroutine Error_Services, Mona_Services, Rlist, SRP_Stopwatch, Logging_Services, Database_Services Declare subroutine Shipment_Services, OBJ_Notes @@ -61,47 +62,51 @@ Options MonaResources = 'FILE_GENERATION', 'FILE_TRANSMISSION', 'FILE_AVAILABILI //---------------------------------------------------------------------------------------------------------------------- Service CycleRetentionDates() - CycleRec = Xlate('APP_INFO', 'COC_AVAILABILITY', '', 'X') - TodayDate = Date() - EarliestDate = Shipment_Services('GetEarliestDate') - - If CycleRec<1> EQ TodayDate then - CurrStartDate = CycleRec<2> - CurrEndDate = CycleRec<3> - PotentialStartDate = CurrStartDate - 10 - PotentialEndDate = CurrEndDate - 10 - Begin Case - Case CurrStartDate EQ EarliestDate - StartDate = TodayDate - 10 - EndDate = TodayDate - Case PotentialStartDate LT EarliestDate - StartDate = EarliestDate - EndDate = EarliestDate + 10 - Case Otherwise$ - StartDate = PotentialStartDate - EndDate = PotentialEndDate - End Case + hSysLists = Database_Services('GetTableHandle', 'SYSLISTS') + Lock hSysLists, ServiceKeyID then + CycleRec = Xlate('APP_INFO', 'COC_AVAILABILITY', '', 'X') + TodayDate = Date() + EarliestDate = Shipment_Services('GetEarliestDate') - NewRec = CycleRec - NewRec<2> = StartDate - NewRec<3> = EndDate - Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) - StartDate = Oconv(StartDate, 'D4-') - EndDate = Oconv(EndDate, 'D4-') - Shipment_Services('CheckFileAvailability', StartDate, EndDate) - end else - StartDate = TodayDate - 10 - EndDate = TodayDate - NewRec = '' - NewRec<1> = TodayDate - - NewRec<2> = StartDate - NewRec<3> = EndDate - Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) - - StartDate = Oconv(StartDate, 'D4-') - EndDate = Oconv(EndDate, 'D4-') - Shipment_Services('CheckFileAvailability', StartDate, EndDate) + If CycleRec<1> EQ TodayDate then + CurrStartDate = CycleRec<2> + CurrEndDate = CycleRec<3> + PotentialStartDate = CurrStartDate - 10 + PotentialEndDate = CurrEndDate - 10 + Begin Case + Case CurrStartDate EQ EarliestDate + StartDate = TodayDate - 10 + EndDate = TodayDate + Case PotentialStartDate LT EarliestDate + StartDate = EarliestDate + EndDate = EarliestDate + 10 + Case Otherwise$ + StartDate = PotentialStartDate + EndDate = PotentialEndDate + End Case + + NewRec = CycleRec + NewRec<2> = StartDate + NewRec<3> = EndDate + Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) + StartDate = Oconv(StartDate, 'D4-') + EndDate = Oconv(EndDate, 'D4-') + Shipment_Services('CheckFileAvailability', StartDate, EndDate) + end else + StartDate = TodayDate - 10 + EndDate = TodayDate + NewRec = '' + NewRec<1> = TodayDate + + NewRec<2> = StartDate + NewRec<3> = EndDate + Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) + + StartDate = Oconv(StartDate, 'D4-') + EndDate = Oconv(EndDate, 'D4-') + Shipment_Services('CheckFileAvailability', StartDate, EndDate) + end + Unlock hSysLists, ServiceKeyID else null end end service @@ -320,3 +325,4 @@ CompanyExceptionCheck: return +