kingesk
09-15-2000, 11:30 AM
'Deleting unwanted Records?
'I am reading in a file and wanting to output a file with
'only the records that do not have zero in the salary field.
'The logic I am using below works in the sense that
'it doesn't output a zero salary record but it then
'outputs the previous record twice. I also need to get rid
'of records with a duplicate SSN. Any ideas would be appreciated.
'Eric
intNumRecords = LOF(1) / Len(udtInputRecord)
For intIndex = 1 To intNumRecords
Get #1, intIndex, udtInputRecord
If udtInputRecord.strSalary <> 0 Then
udtoutputrecord.strFirst = udtInputRecord.strFirst
udtOutputRecord.strLast = udtInputRecord.strLast
udtoutputrecord.strSSN = udtInputRecord.strSSN
udtoutputrecord.strBirthDate = udtInputRecord.strBirthDate
udtoutputrecord.strMarriageDate = udtInputRecord.strMarriageDate
udtoutputrecord.strPad1 = udtInputRecord.strPad1
udtoutputrecord.strSalary = udtInputRecord.strSalary
udtoutputrecord.strDef = udtInputRecord.strDef
udtoutputrecord.strMatch = udtInputRecord.strMatch
udtoutputrecord.strLoan1 = udtInputRecord.strLoan1
udtoutputrecord.strLoan2 = udtInputRecord.strLoan2
udtoutputrecord.strPad2 = udtInputRecord.strPad2
udtoutputrecord.strStreet1 = udtInputRecord.strStreet1
udtoutputrecord.strStreet2 = udtInputRecord.strStreet2
udtoutputrecord.strCity = udtInputRecord.strCity
udtOutputRecord.strState = udtInputRecord.strState
udtoutputrecord.strZip = udtInputRecord.strZip
udtoutputrecord.strTermDate = udtInputRecord.strTermDate
udtoutputrecord.strBuffer = udtInputRecord.strBuffer
End If
'write output record to file
Put #2, intIndex, udtoutputrecord
'I am reading in a file and wanting to output a file with
'only the records that do not have zero in the salary field.
'The logic I am using below works in the sense that
'it doesn't output a zero salary record but it then
'outputs the previous record twice. I also need to get rid
'of records with a duplicate SSN. Any ideas would be appreciated.
'Eric
intNumRecords = LOF(1) / Len(udtInputRecord)
For intIndex = 1 To intNumRecords
Get #1, intIndex, udtInputRecord
If udtInputRecord.strSalary <> 0 Then
udtoutputrecord.strFirst = udtInputRecord.strFirst
udtOutputRecord.strLast = udtInputRecord.strLast
udtoutputrecord.strSSN = udtInputRecord.strSSN
udtoutputrecord.strBirthDate = udtInputRecord.strBirthDate
udtoutputrecord.strMarriageDate = udtInputRecord.strMarriageDate
udtoutputrecord.strPad1 = udtInputRecord.strPad1
udtoutputrecord.strSalary = udtInputRecord.strSalary
udtoutputrecord.strDef = udtInputRecord.strDef
udtoutputrecord.strMatch = udtInputRecord.strMatch
udtoutputrecord.strLoan1 = udtInputRecord.strLoan1
udtoutputrecord.strLoan2 = udtInputRecord.strLoan2
udtoutputrecord.strPad2 = udtInputRecord.strPad2
udtoutputrecord.strStreet1 = udtInputRecord.strStreet1
udtoutputrecord.strStreet2 = udtInputRecord.strStreet2
udtoutputrecord.strCity = udtInputRecord.strCity
udtOutputRecord.strState = udtInputRecord.strState
udtoutputrecord.strZip = udtInputRecord.strZip
udtoutputrecord.strTermDate = udtInputRecord.strTermDate
udtoutputrecord.strBuffer = udtInputRecord.strBuffer
End If
'write output record to file
Put #2, intIndex, udtoutputrecord