`
Templates: Comparing two file structures 1998-10-23 -- Mike Hanson Newsgroups: topspeed.products.c4 This should do the trick: #!----- #TEMPLATE(MyTpl,'My Templates'),FAMILY('ABC') #!----- #EXTENSION(EnsureDupFiles,'Ensure Dup Files'),APPLICATION,MULTI #PROMPT('File 1:',FILE),%File1,REQ #PROMPT('File 2:',FILE),%File2,REQ #VALIDATE(%File1<>%File2,'These cannot be the same!') #!----- #ATSTART #DECLARE(%MyKeyStruct),MULTI #DECLARE(%MyFieldStruct),MULTI #PURGE(%MyKeyStruct) #PURGE(%MyFieldStruct) #FIX(%File,%File1) #FOR(%Key) #ADD(%MyKeyStruct,%KeyStruct) #ENDFOR #FOR(%Field) #ADD(%MyFieldStruct,%FieldStruct) #ENDFOR #FIX(%File,%File2) #IF(ITEMS(%Key)<>ITEMS(%MyKeyStruct)) #INSERT(%NoMatch) #ENDIF #IF(ITEMS(%Field)<>ITEMS(%MyFieldStruct)) #INSERT(%NoMatch) #ENDIF #FOR(%Key) #SELECT(%MyKeyStruct,INSTANCE(%Key)) #IF(%KeyStruct<>%MyKeyStruct) #INSERT(%NoMatch) #ENDIF #ENDFOR #FOR(%Field) #SELECT(%MyFieldStruct,INSTANCE(%Field)) #IF(%FieldStruct<>%MyFieldStruct) #INSERT(%NoMatch) #ENDIF #ENDFOR #ENDAT #!----- #GROUP(%NoMatch) #ERROR(%File1 &' and '& %File2 &' do not match!') #!----- Catch you later! -=> Mike Hanson <=- www.BoxsoftDevelopment.com Chris Moore Printed November 23, 2024, 2:22 am This article has been viewed/printed 35310 times. Google search has resulted in 31 hits on this article since January 25, 2004. |