From: Mark Jilson [jilly@clarityconnect.com] Sent: Tuesday, December 03, 2002 11:02 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: Broken SYS$SEARCH? The documentation doesn't make it clear but NAM$B_RSL should not be zero'd within your $SEARCH loop. There was a change in the 7.3-1 XQP where this field ended up being used which leads to your experience. This 7.3-1 behaviour is correct but it may get changed to the prior behaviour. Bottom line fix is to not modify NAM$B_RSL within a $SEARCH loop. Patrick Young wrote: > OpenVMS Alpha 7.3-1... > > The following works on 7.3 and 7.3-1. Uncomment the line that > is commented out and it no longer works on 7.3-1 (simply keeps > returning the 1st file found)... > > #include > #include > #include > #include > #include > #include > > #define DEFAULT_NAME "*.*;" > #define MAXPATH 255 > #define STRING "%" > > main() { > > char buff[MAXPATH], searchname[MAXPATH]; > > struct FAB fblock; > struct NAM nblock; > > fblock = cc$rms_fab; > fblock.fab$b_acmodes = 0; > fblock.fab$l_dna = DEFAULT_NAME; > fblock.fab$b_dns = strlen(DEFAULT_NAME); > fblock.fab$l_fna = STRING; > fblock.fab$b_fns = strlen(STRING); > fblock.fab$l_fop = 0; > fblock.fab$w_ifi = 0; > fblock.fab$l_nam = &nblock; > > nblock = cc$rms_nam; > nblock.nam$l_esa = searchname; > nblock.nam$b_ess = sizeof(searchname); > nblock.nam$l_fnb = 0; > nblock.nam$b_nop = 0; > nblock.nam$l_rlf = 0; > nblock.nam$l_rsa = buff; > nblock.nam$b_rss = MAXPATH; > nblock.nam$b_rsl = 0; > > printf("parse=%x\n", sys$parse(&fblock)); > > while (sys$search(&fblock) == RMS$_NORMAL) { > > printf("%s %d\n", buff, nblock.nam$b_rsl); > // nblock.nam$b_rsl = 0; > > } > } -- Jilly - Working from Home in the Chemung River Valley - Waverly, NY - jilly@clarityconnect.com - Brett Bodine fan - Mark.Jilson@hp.com - since 1975 or so - http://www.jilly.baka.com - http://www.brettbodine.com