=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Command: DECLARE_DATAFILE logicalFileName*n Description: Include the .FD for the named file and define any related symbols, e.g., FILE.FILE_NUMBER Parameter logicalFileName Base name of the .FD file, e.g., for PERSON.FD, it would be PERSON. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #COMMAND DECLARE_DATAFILE L#GT #IF (!0>0) #IFDEF !1.RECNUM #IFDEF !1.FILE_NUMBER #ELSE #SET Q$ !1.RECNUM #REPLACE !1.FILE_NUMBER |CI!q #ENDIF #ELSE #INCLUDE !1.FD #SET Q$ !1.RECNUM #REPLACE !1.FILE_NUMBER |CI!q #ENDIF DECLARE_DATAFILE !2 !3 !4 !5 !6 !7 !8 !9 #ENDIF #ENDCOMMAND Newer files may include the file_number symbol within the fd file. The rules should be: 1. If file has a recnum, it must define recnum in the file and it must NOT define file_number (we don't define file_number so these fd files will be compatible with older DFs). In this case, file_number will be defined in this command. 2. If file is new and does not support recnum, we define File_number but not recnum. Recnum will not be defined at all. Therefore, by the end of this command, file_number is always defined and recnum is defined only if it exists
#IF (!0>0) #IFNDEF !1.RECNUM #IFNDEF !1.FILE_NUMBER // if neither file_number or recnum is defined, we must include the fd file #INCLUDE !1.FD #ENDIF #ENDIF // if file_number does not exist at this point we have an FD that does not // directly define it (i.e., pre rowID FD or table that suports recnum). Create the symbol #IFNDEF !1.FILE_NUMBER #SET Q$ !1.RECNUM #REPLACE !1.FILE_NUMBER |CI!q #ENDIF DECLARE_DATAFILE !2 !3 !4 !5 !6 !7 !8 !9 #ENDIF