Focal Point
Maintain SOS

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6591023082

April 13, 2008, 07:07 PM
DOJJoe
Maintain SOS
The following MAINTAIN code does not delete the data in the focus file based on the stack. I verified that the delete stack was loaded with three rows. The FOCERROR is getting set to 1 . Help!!

INFER PNDAGENV.PNDAGENV.TG_DOCNO INTO STK_AUTH_EDIT;
Reposition PNDAGENV.PNDAGENV.TG_DOCNO;
Stack clear STK_AUTH_EDIT ;
For all next PNDAGENV.PNDAGENV.TG_DOCNO into STK_AUTH_EDIT WHERE TG_OBLTBLSEG EQ "FINANCE";

INFER PNDAGENV.PNDAGENV.TG_DOCNO INTO STK_AUTH_DELETE;
STACK CLEAR STK_AUTH_DELETE;
Stack copy from STK_AUTH_EDIT into STK_AUTH_DELETE Where (TG_SOURCE EQ "E");


-*WINFORM SHOW Form1;

COMPUTE STK_AUTH_DELETE.FocIndex = 1;
REPOSITION PNDAGENV.PNDAGENV.TG_DOCNO;
FOR ALL Delete pndagenv.PNDAGENV.TG_DOCNO from STK_AUTH_DELETE ;
COMPUTE MESSAGE=FOCERROR
COMMIT;


Configuration Date: 10/31/2007
Build Date: 09/15/2007
Gen Number: 231
Release: 763
Source Date: 09/14/2007
WF jar seq number: 71
WF jar release: 7.6.3
Build Sys: Linux Kernel-2.6.5-glibc-2.3.3 zSeries 64bit
Support Sys: Linux Kernel-2.6.5-glibc-2.3.3 and up zSeries 64bit
April 14, 2008, 05:09 AM
Alan B
On the basis of the code here there should be no problems, but I assume this is a snippet.

Firstly the first INFER is not required, the 'for all next' will create the stack, and the COMPUTE STK_AUTH_DELETE.FocIndex = 1; does nothing.

However that won't help you.

The only thing I can think of is that somewhere, outside the code snippet, you may be adding to STK_AUTH_DELETE.FocCount.

Just prior to the DELETE, verify the key field values in STK_AUTH_DELETE, by typing them out. FocError of 1 is pretty specific that it cannot find a record to delete.

Are you using FDS?
Is the segment an S1 or SH1?


Alan.
WF 7.705/8.007
April 14, 2008, 10:49 AM
DOJJoe
Thanks Alan.

I stripped the code down to the minimum and removed the unecessary instructions per your message. Now it looks like this:

MAINTAIN FILE PNDAGENV

$$Declarations

Case Top

For all next PNDAGENV.PNDAGENV.TG_DOCNO into STK_AUTH_EDIT WHERE TG_OBLTBLSEG EQ "FINANCE";

INFER PNDAGENV.PNDAGENV.TG_DOCNO INTO STK_AUTH_DELETE;
Stack copy from STK_AUTH_EDIT into STK_AUTH_DELETE Where (TG_SOURCE EQ "E");


REPOSITION PNDAGENV.PNDAGENV.TG_DOCNO;

REPEAT STK_AUTH_DELETE.FOCCOUNT ROW/I4=1;
SAY "STK_AUTH_DELETE.TG_DOCNO IS " STK_AUTH_DELETE(ROW).TG_DOCNO ".
"
ENDREPEAT ROW=ROW+1;

FOR ALL Delete pndagenv.PNDAGENV.TG_DOCNO from STK_AUTH_DELETE ;
SAY "FOCERROR IS " FOCERROR
COMMIT;

EndCase

END

The results are as follows (Note the last "SAY")

STK_AUTH_DELETE.TG_DOCNO IS H2.
STK_AUTH_DELETE.TG_DOCNO IS O03.
STK_
AUTH_DELETE.TG_DOCNO IS O43433.
FOCERROR IS 1
TRANSACTIONS: COMMITS = 2 ROLLBACKS = 0
SEGMENTS : INCLUDED = 0 UPDATED = 0 DELETED = 0

No data is deleted. Curious. Thanks for any suggestions ..


Configuration Date: 10/31/2007
Build Date: 09/15/2007
Gen Number: 231
Release: 763
Source Date: 09/14/2007
WF jar seq number: 71
WF jar release: 7.6.3
Build Sys: Linux Kernel-2.6.5-glibc-2.3.3 zSeries 64bit
Support Sys: Linux Kernel-2.6.5-glibc-2.3.3 and up zSeries 64bit
April 14, 2008, 10:51 AM
DOJJoe
I forgot to give you the MFD snippit:

FILE=PNDAGENV ,SUFFIX=FOC , $
SEGNAME=PNDAGENV , SEGTYPE=S1,$
FIELDNAME=TG_DOCNO ,TG_DOCNO ,A9 ,A9 ,$
FIELDNAME=TG_SUBCERTID ,TG_SUBCERTID ,A8 ,A8 ,$
FIELDNAME=TG_SUBMITORG ,TG_SUBMITORG ,A8 ,A8 ,$


Configuration Date: 10/31/2007
Build Date: 09/15/2007
Gen Number: 231
Release: 763
Source Date: 09/14/2007
WF jar seq number: 71
WF jar release: 7.6.3
Build Sys: Linux Kernel-2.6.5-glibc-2.3.3 zSeries 64bit
Support Sys: Linux Kernel-2.6.5-glibc-2.3.3 and up zSeries 64bit
April 14, 2008, 12:25 PM
Maintain Wizard
Please change the SAY line to:

TYPE "Record <
This will show the rows and the values. If you do multiple rows in a DELETE and the last one fails, that would explain for FOCERROR =1. The other thing you COULD do is place the delete inside the loop:


REPEAT STK_AUTH_DELETE.FOCCOUNT ROW/I4=1;
TYPE "Record <Delete pndagenv.PNDAGENV.TG_DOCNO from STK_AUTH_DELETE(Row) ;
ENDREPEAT ROW=ROW+1;
TYPE "FOCERROR IS <
Let us know.

Mark
April 14, 2008, 12:54 PM
DOJJoe
Here is the new code:

MAINTAIN FILE PNDAGENV
$$Declarations
Case Top
For all next PNDAGENV.PNDAGENV.TG_DOCNO into STK_AUTH_EDIT WHERE TG_OBLTBLSEG EQ "FINANCE";
INFER PNDAGENV.PNDAGENV.TG_DOCNO INTO STK_AUTH_DELETE;
Stack copy from STK_AUTH_EDIT into STK_AUTH_DELETE Where (TG_SOURCE EQ "E");
REPOSITION PNDAGENV.PNDAGENV.TG_DOCNO;
REPEAT STK_AUTH_DELETE.FOCCOUNT ROW/I4=1;
TYPE "TG_DOCNO: ENDREPEAT ROW=ROW+1;
FOR ALL Delete pndagenv.PNDAGENV.TG_DOCNO from STK_AUTH_DELETE ;
SAY "FOCERROR IS " FOCERROR
COMMIT;
EndCase
END

Here are the new results:
TG_DOCNO: H2
TG_DOCNO: O03
TG_DOCNO: O43433
FOCERROR IS 1
TRANSACTIONS: COMMITS = 2 ROLLBACKS = 0
SEGMENTS : INCLUDED = 0 UPDATED = 0 DELETED = 0

Also I had tried to put the delete inside the loop yesterday and that didn't work either. I am truly puzzled. .. joe


Configuration Date: 10/31/2007
Build Date: 09/15/2007
Gen Number: 231
Release: 763
Source Date: 09/14/2007
WF jar seq number: 71
WF jar release: 7.6.3
Build Sys: Linux Kernel-2.6.5-glibc-2.3.3 zSeries 64bit
Support Sys: Linux Kernel-2.6.5-glibc-2.3.3 and up zSeries 64bit
April 14, 2008, 01:55 PM
Maintain Wizard
Alright.

That is odd. Let's try this. Read in just one record and delete it. Instead of copying the data to a second stack, just use both conditions on loading the one stack.

MAINTAIN FILE PNDAGENV
$$Declarations
Case Top
Next PNDAGENV.PNDAGENV.TG_DOCNO into STK_AUTH_EDIT
WHERE TG_OBLTBLSEG EQ "FINANCE"
AND TG_SOURCE EQ "E"
Delete pndagenv.PNDAGENV.TG_DOCNO from STK_AUTH_EDIT ;
SAY "FOCERROR IS " FOCERROR
COMMIT;
EndCase
END

Mark
April 14, 2008, 01:58 PM
Dave Ayers
joe,

You might try querying the state of 'focurrent' as well as 'focerror' after the delete attempt. if it isn't '0' you may have a SU/FDS problem.


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
April 14, 2008, 08:44 PM
DOJJoe
Mark's code produced the following:

FOCERROR IS 0
TRANSACTIONS: COMMITS = 2 ROLLBACKS = 0
SEGMENTS : INCLUDED = 0 UPDATED = 0 DELETED = 1


Configuration Date: 10/31/2007
Build Date: 09/15/2007
Gen Number: 231
Release: 763
Source Date: 09/14/2007
WF jar seq number: 71
WF jar release: 7.6.3
Build Sys: Linux Kernel-2.6.5-glibc-2.3.3 zSeries 64bit
Support Sys: Linux Kernel-2.6.5-glibc-2.3.3 and up zSeries 64bit
April 15, 2008, 03:29 AM
Alan B
Now that is weird.

Why does Mark's code produce 1 record, but the original code gave 3 records.

The code looks fine and in a repro works as expected.

This almost points to it being a data issue. Could the datafile be corrupt somehow? Have you tried a REBUILD?


Alan.
WF 7.705/8.007
April 15, 2008, 09:56 AM
Maintain Wizard
Actually my code only deleted one record because we only loaded one record. I used a NEXT instead of a FOR ALL NEXT. However, as Alan points out, that could mean that the second or third record has a problem in the database.

At this point you can REBUILD REBUILD the database or just run my code 2 more times and see if it succeeds both times. We can add back in the STACK COPY. Let us know how you want to procede.

Mark
April 17, 2008, 09:21 PM
DOJJoe
It looks like the rebuild worked!!! Thanks for the help!! The data is now being deleted from the file based on the stack values with a "for all delete" statement ... joe


Configuration Date: 10/31/2007
Build Date: 09/15/2007
Gen Number: 231
Release: 763
Source Date: 09/14/2007
WF jar seq number: 71
WF jar release: 7.6.3
Build Sys: Linux Kernel-2.6.5-glibc-2.3.3 zSeries 64bit
Support Sys: Linux Kernel-2.6.5-glibc-2.3.3 and up zSeries 64bit