The problem part of the code looks like this:Case AddRecord
Declare z / I3 = frmDataEntry.tblMHMES_List.ClickRow;
If stkMHMES.FocCount EQ 0
Begin
Compute errorFlag = 1
Compute errorMessage = 'ERROR: No record recalled.';
Perform MessageAdd;
Goto EndCase;
EndBegin
Else If stkMHMESList(z).ViewColumn NE '===>' Then
Begin
Compute errorFlag = 1
Compute errorMessage = 'ERROR: Not including the record that you viewed.';
Perform MessageAdd;
Goto EndCase;
EndBegin
Compute stkMHMES.UNIT01 = If entryUnit01 EQ ' ' Then
displayUnit01
Else
entryUnit01;
Compute stkMHMES.UNIT02 = If entryUnit02 EQ ' ' Then
displayUnit02
Else
entryUnit02;
Compute stkMHMES.UNIT03 = If entryUnit03 EQ ' ' Then
displayUnit03
Else
entryUnit03;
Compute stkMHMES.UNIT04 = If entryUnit04 EQ ' ' Then
displayUnit04
Else
entryUnit04;
Compute stkMHMES.UNIT05 = If entryUnit05 EQ ' ' Then
displayUnit05
Else
entryUnit05;
Compute stkMHMES.UNIT06 = If entryUnit06 EQ ' ' Then
displayUnit06
Else
entryUnit06;
Compute stkMHMES.UNIT07 = If entryUnit07 EQ ' ' Then
displayUnit07
Else
entryUnit07;
Compute stkMHMES.UNIT08 = If entryUnit08 EQ ' ' Then
displayUnit08
Else
entryUnit08;
Compute stkMHMES.UNIT09 = If entryUnit09 EQ ' ' Then
displayUnit09
Else
entryUnit09;
Compute stkMHMES.UNIT10 = If entryUnit10 EQ ' ' Then
displayUnit10
Else
entryUnit10;
Compute stkMHMES.UNIT11 = If entryUnit11 EQ ' ' Then
displayUnit11
Else
entryUnit11;
Compute stkMHMES.UNIT12 = If entryUnit12 EQ ' ' Then
displayUnit12
Else
entryUnit12;
Compute stkMHMES.UNIT13 = If entryUnit13 EQ ' ' Then
displayUnit13
Else
entryUnit13;
Compute stkMHMES.UNIT14 = If entryUnit14 EQ ' ' Then
displayUnit14
Else
entryUnit14;
Compute stkMHMES.UNIT15 = If entryUnit15 EQ ' ' Then
displayUnit15
Else
entryUnit15;
Compute stkMHMES.UNIT16 = If entryUnit16 EQ ' ' Then
displayUnit16
Else
entryUnit16;
Compute stkMHMES.UNIT17 = If entryUnit17 EQ ' ' Then
displayUnit17
Else
entryUnit17;
Compute stkMHMES.UNIT18 = If entryUnit18 EQ ' ' Then
displayUnit18
Else
entryUnit18;
Compute stkMHMES.UNIT19 = If entryUnit19 EQ ' ' Then
displayUnit19
Else
entryUnit19;
Compute stkMHMES.UNIT20 = If entryUnit20 EQ ' ' Then
displayUnit20
Else
entryUnit20;
Compute stkMHMES.UNIT21 = If entryUnit21 EQ ' ' Then
displayUnit21
Else
entryUnit21;
Compute stkMHMES.UNIT22 = If entryUnit22 EQ ' ' Then
displayUnit22
Else
entryUnit22;
Compute stkMHMES.UNIT23 = If entryUnit23 EQ ' ' Then
displayUnit23
Else
entryUnit23;
Compute stkMHMES.UNIT24 = If entryUnit24 EQ ' ' Then
displayUnit24
Else
entryUnit24;
Compute stkMHMES.UNIT25 = If entryUnit25 EQ ' ' Then
displayUnit25
Else
entryUnit25;
Compute stkMHMES.UNIT26 = If entryUnit26 EQ ' ' Then
displayUnit26
Else
entryUnit26;
Compute stkMHMES.UNIT27 = If entryUnit27 EQ ' ' Then
displayUnit27
Else
entryUnit27;
Compute stkMHMES.UNIT28 = If entryUnit28 EQ ' ' Then
displayUnit28
Else
entryUnit28;
Compute stkMHMES.UNIT29 = If entryUnit29 EQ ' ' Then
displayUnit29
Else
entryUnit29;
Compute stkMHMES.UNIT30 = If entryUnit30 EQ ' ' Then
displayUnit30
Else
entryUnit30;
Compute stkMHMES.UNIT31 = If entryUnit31 EQ ' ' Then
displayUnit31
Else
entryUnit31;
If stkMHMES.DATE_MOVED EQ 0 OR stkMHMES.RECORD_TYPE EQ '6' Then
Begin
Compute stkMHMES.DATE_MOVED = 0;
Compute stkMHMES.CHANGE_USER = userName;
Compute stkMHMES.CHANGE_DATE = currentSmartDate;
Compute stkMHMES.UNAME = userFullName;
Compute errorMessage = 'ERROR: Update failed.';
Perform UpdateMHMES;
If FocError NE 0 Then
Goto EndCase;
EndBegin
Else
Begin
Compute stkMHMES.DATE_MOVED = 0;
Compute stkMHMES.CHANGE_USER = userName;
Compute stkMHMES.CHANGE_DATE = currentSmartDate;
Compute stkMHMES.UNAME = userFullName;
Compute stkMHMES.RECORD_TYPE = '6';
Compute errorMessage = 'ERROR: Failed record type 6 include.';
Perform SaveMHMES;
If FocError NE 0 Then
Goto EndCase;
stkMHMES.RECORD_TYPE = '2';
Compute errorMessage = 'ERROR: Failed record type 2 delete.';
Perform DeleteRecordType;
If FocError NE 0 Then
Goto EndCase;
EndBegin
Commit;
If FocCurrent NE 0 Then
Begin
Compute errorMessage = 'ERROR: Commit Failed';
Compute errorFlag = 1;
Perform MessageAdd;
Goto EndCase;
EndBegin
Else
Begin
Compute errorMessage = 'Record for BSU: ' | stkMHMES.BSU_ID |
' Client ID: ' | stkMHMES.CLIENT_ID |
' successfully updated.';
Compute errorFlag = 0;
Perform MessageAdd;
EndBegin
Perform ClearUnits;
displayUnit01 = stkMHMES.UNIT01;
displayUnit02 = stkMHMES.UNIT02;
displayUnit03 = stkMHMES.UNIT03;
displayUnit04 = stkMHMES.UNIT04;
displayUnit05 = stkMHMES.UNIT05;
displayUnit06 = stkMHMES.UNIT06;
displayUnit07 = stkMHMES.UNIT07;
displayUnit08 = stkMHMES.UNIT08;
displayUnit09 = stkMHMES.UNIT09;
displayUnit10 = stkMHMES.UNIT10;
displayUnit11 = stkMHMES.UNIT11;
displayUnit12 = stkMHMES.UNIT12;
displayUnit13 = stkMHMES.UNIT13;
displayUnit14 = stkMHMES.UNIT14;
displayUnit15 = stkMHMES.UNIT15;
displayUnit16 = stkMHMES.UNIT16;
displayUnit17 = stkMHMES.UNIT17;
displayUnit18 = stkMHMES.UNIT18;
displayUnit19 = stkMHMES.UNIT19;
displayUnit20 = stkMHMES.UNIT20;
displayUnit21 = stkMHMES.UNIT21;
displayUnit22 = stkMHMES.UNIT22;
displayUnit23 = stkMHMES.UNIT23;
displayUnit24 = stkMHMES.UNIT24;
displayUnit25 = stkMHMES.UNIT25;
displayUnit26 = stkMHMES.UNIT26;
displayUnit27 = stkMHMES.UNIT27;
displayUnit28 = stkMHMES.UNIT28;
displayUnit29 = stkMHMES.UNIT29;
displayUnit30 = stkMHMES.UNIT30;
displayUnit31 = stkMHMES.UNIT31;
stkMHMESList(z).UNIT01 = stkMHMES.UNIT01;
stkMHMESList(z).UNIT02 = stkMHMES.UNIT02;
stkMHMESList(z).UNIT03 = stkMHMES.UNIT03;
stkMHMESList(z).UNIT04 = stkMHMES.UNIT04;
stkMHMESList(z).UNIT05 = stkMHMES.UNIT05;
stkMHMESList(z).UNIT06 = stkMHMES.UNIT06;
stkMHMESList(z).UNIT07 = stkMHMES.UNIT07;
stkMHMESList(z).UNIT08 = stkMHMES.UNIT08;
stkMHMESList(z).UNIT09 = stkMHMES.UNIT09;
stkMHMESList(z).UNIT10 = stkMHMES.UNIT10;
stkMHMESList(z).UNIT11 = stkMHMES.UNIT11;
stkMHMESList(z).UNIT12 = stkMHMES.UNIT12;
stkMHMESList(z).UNIT13 = stkMHMES.UNIT13;
stkMHMESList(z).UNIT14 = stkMHMES.UNIT14;
stkMHMESList(z).UNIT15 = stkMHMES.UNIT15;
stkMHMESList(z).UNIT16 = stkMHMES.UNIT16;
stkMHMESList(z).UNIT17 = stkMHMES.UNIT17;
stkMHMESList(z).UNIT18 = stkMHMES.UNIT18;
stkMHMESList(z).UNIT19 = stkMHMES.UNIT19;
stkMHMESList(z).UNIT20 = stkMHMES.UNIT20;
stkMHMESList(z).UNIT21 = stkMHMES.UNIT21;
stkMHMESList(z).UNIT22 = stkMHMES.UNIT22;
stkMHMESList(z).UNIT23 = stkMHMES.UNIT23;
stkMHMESList(z).UNIT24 = stkMHMES.UNIT24;
stkMHMESList(z).UNIT25 = stkMHMES.UNIT25;
stkMHMESList(z).UNIT26 = stkMHMES.UNIT26;
stkMHMESList(z).UNIT27 = stkMHMES.UNIT27;
stkMHMESList(z).UNIT28 = stkMHMES.UNIT28;
stkMHMESList(z).UNIT29 = stkMHMES.UNIT29;
stkMHMESList(z).UNIT30 = stkMHMES.UNIT30;
stkMHMESList(z).UNIT31 = stkMHMES.UNIT31;
Compute stkMHMESList(z).TotalUnits = stkMHMESList(z).UNIT01 +
stkMHMESList(z).UNIT02 + stkMHMESList(z).UNIT03 + stkMHMESList(z).UNIT04 +
stkMHMESList(z).UNIT05 + stkMHMESList(z).UNIT06 + stkMHMESList(z).UNIT07 +
stkMHMESList(z).UNIT08 + stkMHMESList(z).UNIT09 + stkMHMESList(z).UNIT10 +
stkMHMESList(z).UNIT11 + stkMHMESList(z).UNIT12 + stkMHMESList(z).UNIT13 +
stkMHMESList(z).UNIT14 + stkMHMESList(z).UNIT15 + stkMHMESList(z).UNIT16 +
stkMHMESList(z).UNIT17 + stkMHMESList(z).UNIT18 + stkMHMESList(z).UNIT19 +
stkMHMESList(z).UNIT20 + stkMHMESList(z).UNIT21 + stkMHMESList(z).UNIT22 +
stkMHMESList(z).UNIT23 + stkMHMESList(z).UNIT24 + stkMHMESList(z).UNIT25 +
stkMHMESList(z).UNIT26 + stkMHMESList(z).UNIT27 + stkMHMESList(z).UNIT28 +
stkMHMESList(z).UNIT29 + stkMHMESList(z).UNIT30 + stkMHMESList(z).UNIT31;
Perform GrandTotal;
Compute stkMHMESList(z).DATE_MOVED = 0;
Compute stkMHMESList(z).CHANGE_USER = userName;
Compute stkMHMESList(z).CHANGE_DATE = currentSmartDate;
Compute stkMHMESList(z).UNAME = userFullName;
EndCase
Case SaveMHMES
Stack Clear stkSaveMHMES;
Copy From stkMHMES Into stkSaveMHMES;
Reposition mhmes.ROOT_SEG.CLIENT_ID;
Include
mhmes.ROOT_SEG.CLIENT_ID
mhmes.ID_SEG.BSU_ID
mhmes.FAC_SEG.FACILITY_NO
mhmes.FAC_SEG.GROUP
mhmes.MON_SEG.YEAR
mhmes.MON_SEG.MONTH
mhmes.PAC_SEG.PAC
mhmes.TYPE_SEG.SERV_TYPE
mhmes.TYPE_SEG.THER_TYPE
mhmes.TYPE_SEG.OUTCOME
mhmes.TYPE_SEG.FUNDING
mhmes.TYPE_SEG.RECORD_TYPE
From stkSaveMHMES;
If FocError NE 0 Then
Begin
Rollback;
errorFlag = 1;
Perform MessageAdd;
EndBegin
Stack Clear stkSaveMHMES;
EndCase
Case DeleteRecordType
Stack Clear stkDeleteMHMES;
Copy From stkMHMES Into stkDeleteMHMES;
Reposition mhmes.ROOT_SEG.CLIENT_ID;
Match
mhmes.ROOT_SEG.CLIENT_ID
mhmes.ID_SEG.BSU_ID
mhmes.FAC_SEG.FACILITY_NO
mhmes.MON_SEG.YEAR
mhmes.MON_SEG.MONTH
mhmes.PAC_SEG.PAC
mhmes.TYPE_SEG.SERV_TYPE
mhmes.TYPE_SEG.THER_TYPE
mhmes.TYPE_SEG.OUTCOME
mhmes.TYPE_SEG.FUNDING
mhmes.TYPE_SEG.RECORD_TYPE
From stkDeleteMHMES;
On Match
Begin
For all delete
mhmes.ROOT_SEG.CLIENT_ID
mhmes.ID_SEG.BSU_ID
mhmes.FAC_SEG.FACILITY_NO
mhmes.MON_SEG.YEAR
mhmes.MON_SEG.MONTH
mhmes.PAC_SEG.PAC
mhmes.TYPE_SEG.SERV_TYPE
mhmes.TYPE_SEG.THER_TYPE
mhmes.TYPE_SEG.OUTCOME
mhmes.TYPE_SEG.FUNDING
mhmes.TYPE_SEG.RECORD_TYPE
From stkDeleteMHMES;
If FocError NE 0 Then
Begin
Rollback;
errorFlag = 1;
Perform MessageAdd;
EndBegin
EndBegin
On NoMatch
Begin
errorFlag = 1;
errorMessage = 'ERROR: Cannot Delete. Record does not exist.';
Perform MessageAdd;
EndBegin
EndCase
The master looks like this:FILE=mhmes, SUFFIX=FOC
SEGNAME=ROOT_SEG, SEGTYPE=S1, $
FIELD=CLIENT_ID, ALIAS=CLID, FORMAT=A13, $
SEGNAME=ID_SEG, SEGTYPE=S1, PARENT=ROOT_SEG, $
FIELD=BSU_ID, ALIAS=ID, FORMAT=I9, $
SEGNAME=FAC_SEG, SEGTYPE=S1, PARENT=ID_SEG, $
FIELD=FACILITY_NO, ALIAS=FN, FORMAT=I8, $
FIELD=GROUP, ALIAS=GRP, FORMAT=I3, $
SEGNAME=MON_SEG, SEGTYPE=S2, PARENT=FAC_SEG, $
FIELD=YEAR, ALIAS=FY, FORMAT=I4, $
FIELD=MONTH, ALIAS=MO, FORMAT=I2, $
SEGNAME=PAC_SEG, SEGTYPE=S1, PARENT=MON_SEG, $
FIELD=PAC, ALIAS=PAC, FORMAT=A8, $
SEGNAME=TYPE_SEG, SEGTYPE=S5, PARENT=PAC_SEG, $
FIELD=SERV_TYPE, ALIAS=ST, FORMAT=A1, $
FIELD=THER_TYPE, ALIAS=TT, FORMAT=A1, $
FIELD=OUTCOME, ALIAS=OUT, FORMAT=A2, $
FIELD=FUNDING, ALIAS=FS, FORMAT=A1, $
FIELD=RECORD_TYPE, ALIAS=RT, FORMAT=A1, $
FIELD=UNIT01, ALIAS=US01, FORMAT=I2, $
FIELD=UNIT02, ALIAS=US02, FORMAT=I2, $
FIELD=UNIT03, ALIAS=US03, FORMAT=I2, $
FIELD=UNIT04, ALIAS=US04, FORMAT=I2, $
FIELD=UNIT05, ALIAS=US05, FORMAT=I2, $
FIELD=UNIT06, ALIAS=US06, FORMAT=I2, $
FIELD=UNIT07, ALIAS=US07, FORMAT=I2, $
FIELD=UNIT08, ALIAS=US08, FORMAT=I2, $
FIELD=UNIT09, ALIAS=US09, FORMAT=I2, $
FIELD=UNIT10, ALIAS=US10, FORMAT=I2, $
FIELD=UNIT11, ALIAS=US11, FORMAT=I2, $
FIELD=UNIT12, ALIAS=US12, FORMAT=I2, $
FIELD=UNIT13, ALIAS=US13, FORMAT=I2, $
FIELD=UNIT14, ALIAS=US14, FORMAT=I2, $
FIELD=UNIT15, ALIAS=US15, FORMAT=I2, $
FIELD=UNIT16, ALIAS=US16, FORMAT=I2, $
FIELD=UNIT17, ALIAS=US17, FORMAT=I2, $
FIELD=UNIT18, ALIAS=US18, FORMAT=I2, $
FIELD=UNIT19, ALIAS=US19, FORMAT=I2, $
FIELD=UNIT20, ALIAS=US20, FORMAT=I2, $
FIELD=UNIT21, ALIAS=US21, FORMAT=I2, $
FIELD=UNIT22, ALIAS=US22, FORMAT=I2, $
FIELD=UNIT23, ALIAS=US23, FORMAT=I2, $
FIELD=UNIT24, ALIAS=US24, FORMAT=I2, $
FIELD=UNIT25, ALIAS=US25, FORMAT=I2, $
FIELD=UNIT26, ALIAS=US26, FORMAT=I2, $
FIELD=UNIT27, ALIAS=US27, FORMAT=I2, $
FIELD=UNIT28, ALIAS=US28, FORMAT=I2, $
FIELD=UNIT29, ALIAS=US29, FORMAT=I2, $
FIELD=UNIT30, ALIAS=US30, FORMAT=I2, $
FIELD=UNIT31, ALIAS=US31, FORMAT=I2, $
FIELD=USERID, ALIAS=USER, FORMAT=A8, $
FIELD=ENTRYDATE, ALIAS=EDATE, FORMAT=MDYY, $
FIELD=DATE_MOVED, ALIAS=MARK, FORMAT=MDYY, $
FIELD=CHANGE_USER, ALIAS=CUSER, FORMAT=A8, $
FIELD=CHANGE_DATE, ALIAS=CDATE, FORMAT=MDYY, $
FIELD=LAST_NAME, ALIAS=LN, FORMAT=A20, $
FIELD=FIRST_NAME, ALIAS=FN, FORMAT=A15, $
FIELD=BIRTH_NAME, ALIAS=BN, FORMAT=A20, $
FIELD=UNAME, ALIAS=USER_NAME, FORMAT=A25, $
Sandbox Version: 8.1.04
Sandbox Platform: Windows 2008 R2
Testing Version: 7.7.02M
Testing Platform: Windows Server 2008 R2
WF Production Version: 7.7.02M
Production Platform: Windows Server 2008