49 lines
1.2 KiB
Plaintext
49 lines
1.2 KiB
Plaintext
#50 = Buf_Num // Current edit buffer (source data)
|
|
File_Open("|(PATH_ONLY)\output.txt")
|
|
#51 = Buf_Num // Edit buffer for output file
|
|
Buf_Switch(#50)
|
|
|
|
#11 = #12 = #13 = #14 = #15 = 0
|
|
Reg_Set(15, "xxx")
|
|
|
|
While(!At_EOF) {
|
|
#10 = 0
|
|
#12++
|
|
|
|
// Check for repeated date field
|
|
if (Match(@15) == 0) {
|
|
#20 = Cur_Line
|
|
Buf_Switch(#51) // Output file
|
|
Reg_ins(15) IT(": duplicate record at ") Num_Ins(#20)
|
|
Buf_Switch(#50) // Input file
|
|
#13++
|
|
}
|
|
|
|
// Check format of date field
|
|
if (Match("|d|d|d|d-|d|d-|d|d|w", ADVANCE) != 0) {
|
|
#10 = 1
|
|
#14++
|
|
}
|
|
Reg_Copy_Block(15, BOL_pos, Cur_Pos-1)
|
|
|
|
// Check data fields and flags:
|
|
Repeat(24) {
|
|
if ( Match("|d|*.|d|d|d|w", ADVANCE) != 0 || Num_Eval(ADVANCE) < 1) {
|
|
#10 = 1
|
|
#15++
|
|
Break
|
|
}
|
|
Match("|W", ADVANCE)
|
|
}
|
|
if (#10 == 0) { #11++ } // record was OK
|
|
Line(1, ERRBREAK)
|
|
}
|
|
|
|
Buf_Switch(#51) // buffer for output data
|
|
IN
|
|
IT("Valid records: ") Num_Ins(#11)
|
|
IT("Duplicates: ") Num_Ins(#13)
|
|
IT("Date format errors: ") Num_Ins(#14)
|
|
IT("Invalid data records:") Num_Ins(#15)
|
|
IT("Total records: ") Num_Ins(#12)
|