// // ADD-DATE.VDM // // Increment specified date fields in data records. // Fields are delimited by '|'. // The first '|' indicates the beginning of the second field. // // Edit this macro as follows: // // Set numeric register #99 to the signed increment. // Set numeric registers #11...#n to the ordinal of the date fields to increment. // Set numeric register #n+1 to 0. // // // To run from DOS: vpw -x sumday datafile // // From VEDIT: Select {MISC, WILDFILE macro}. // /////////////////////////////////////////////////////////////////////////////////////// // // // Edit these values // #99 = 1 // The increment #11 = 1 // Set to ordinal of 1st date field (from 1) #12 = 5 // Set to ordinal of 2nd date field #13 = 8 // . #14 = 10 // . #15 = 0 // . #16 = 0 // Ensure numeric register succeeding that specifying #17 = 0 // the last date field to be incremented is set to 0. #18 = 0 #19 = 0 #20 = 0 #49 = 0 //////////////////// End of section containing values to be edited. //////// // // Ensure at start of line. Can start anywhere in the data file. // BOL #10 = 0 // Zero-th field (constant) repeat(ALL) { // Practically forever if (At_EOF){break} // Exit loop when EOF reached #50 = 10 // Previous field #51 = 11 // Current field repeat(all) { if (#@51 == 0){break} // Quit when end of list reached if ((#52=#@51-#@50-1)>0) { // Find start of current field #53 = cur_line #54 = cur_pos if (s('||',advance+count+noerr,#52)!=#52){break} if (#53 != cur_line){goto_pos(#54); break} } if (match('|[|w]|d|d|s|d|d|s|d|d|d|d')==0) { #53 = NumEvalDate(BEGIN) // Get numeric date value r("|d|d|s|d|d|s|d|d|d|d","") // Erase the date (dd/mm/yyyy) NumInsDate(#53+#99,BEGIN+NOCR+COUNT,'/') // Insert adjusted date } s("|{||,|>}",advance+errbreak) //Advance to start of next field #51++ #50++ } line(1,errbreak) }