On Thu, 01 Jul 2004 15:28:00 -0400, Shane Presley wrote:
>What I would need the macro to do is verify that each record has
>the same number of delimiters.
Shane:
here a quick-shot macro to do what you described.
It needs some more comfort for the input of course but should show one
possible way.
Reg_Set(103, ",") // set delimiter character
#103=5 // number of delimiters per line
#104=0 // error flag
Begin_Of_File
while (! At_EoF) {
// check for at least #103 occurrences
Search_Block("|@(103)", BoL_Pos, EoL_Pos, NOERR+ADVANCE+COUNT, #103)
if (Error_Match) { // if too few delimiters
#104=1
break
}
// check for additional occurrence
Search_Block("|@(103)", Cur_Pos, EoL_Pos, NOERR)
if (! Error_Match) { // if too many delimiters
#104=1
break
}
Line(1, NOERR+ERRBREAK)
}
if (#104) {
Dialog_Input_1(105,"`Error!`,
`There is at least one line with wrong number of delimiters!`",
WORKAREA+CENTER,0,0)
} else {
Dialog_Input_1(105,"`Success`,
`All lines are having the same number of delimiters!`",
WORKAREA+CENTER,0,0)
}
Christian