FoxPro7
Note: The word "record set" is probably not correct but I really don't understand how they work. I'm a SQL guy so I'm trying to translate. Is it a view? Is it a copy of the data? I have no idea.
Questions:
Thank you!
Select 1
Use tblincls
Select 2
Use tblincls Again
Set Filter To CLASS_CODE = '5156'
Goto Top
Do While Not Eof()
nagency_code = agency_code
nindex_no = index_no
nclass_code = CLASS_CODE
npys_exp = pys_exp
namt_exp = amt_exp
Select 1
Seek nagency_code + nindex_no + nclass_code
If Found()
Replace pys_exp With (pys_exp + npys_exp)
Select 2
Else
Select 2
Replace CLASS_CODE With '5157'
Endif
Select 2
Skip
Enddo
Close Tables All
Use tblincls Excl
Delete All For CLASS_CODE = '5156'
Pack
Close Tables All
Note: The word "record set" is probably not correct but I really don't understand how they work. I'm a SQL guy so I'm trying to translate. Is it a view? Is it a copy of the data? I have no idea.
Based on the code sample, the "record set" is most likely a VFP table (but could be a view) that is part of a VFP database container (dbc). The reason I know this is there is one fieldname that exceeds 10 characters: a free table can only have 10 characters; exceeding 10 characters would require the table/view to be in a dbc. I will answer your questions using "table".
Answers:
Having explained all that, it looks as though all the updates made to the table are completely wiped out at the end by deleting all the records (CLASS_CODE='5156') and packing them. CLASS_CODE will never be set to '5157' based on this snippet. It doesn't make sense. This is poorly written. All it seems to do is delete records where CLASS_CODE='5156'.