In your example, the line: > CASE X=1 F.FILETOUSE = F.FILE1 should be > CASE X=1; F.FILETOUSE = F.FILE1 Without the semicolon, the CASE test is something like (FMT(1,F.FILETOUSE)=F.FILE1) and possibly being considered true.
On Dec 15, 2009, at 2:23 PM, George Gallen wrote: > Here is an interesting tidbit I happened to run across. > > PROGRAM A: > > OPEN "","FILE1" TO F.FILE1 ELSE STOP "NO FILE1" > OPEN "","FILE2" TO F.FILE2 ELSE STOP "NO FILE2" > * F.FILETOUSE = F.FILE1 (Adding this here will get rid of the compile > warning) > BEGIN CASE > CASE X=1 F.FILETOUSE = F.FILE1 > CASE X=2 F.FILETOUSE = F.FILE2 > CASE -1 F.FILETOUSE = F.FILE1 > END CASE > READ XDATA FROM F.FILETOUSE,"TEST" ELSE XDATA="" > > The above program when compiled says F.FILETOUSE never assigned a value > and when it executes, gives an improper file type error > > HOWEVER: > > PROGRAM B: > > OPEN "","FILE1" TO F.FILE1 ELSE STOP "NO FILE1" > OPEN "","FILE2" TO F.FILE2 ELSE STOP "NO FILE2" > F.FILETOUSE=F.FILE1 > IF X=1 THEN F.FILETOUSE = F.FILE1 > IF X=2 THEN F.FILETOUSE = F.FILE2 > READ XDATA FROM F.FILETOUSE,"TEST" ELSE XDATA="" > > Compiles and run just fine, no errors. > > This is using UV 10.0.2 under the Prime Information flavor > > George Gallen > Senior Programmer/Analyst > Accounting/Data Division, EDI Administrator > ggal...@wyanokegroup.com > ph:856.848.9005 Ext 220 > The Wyanoke Group > http://www.wyanokegroup.com > > > > _______________________________________________ > U2-Users mailing list > U2-Users@listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users