Memo File Extension

#include "dbinfo.ch"
PROC Main()
* Test .prg for MemoFExtn() function

 SetMode( 25, 80 ) 
 CLS
 ? "Memo File extension :", MemoFExtn() // NIL
 ? REPL( "-", 80 )

 cTfName := "MFInTst1"
 aStruct := { { "FLD1", "C", 10, 0 } }

 DBCREATE( cTfName, aStruct ) 
 USE ( cTfName )

 ? "Memo File extension :", ">" + MemoFExtn() + "<" // ><
 ? REPL( "-", 80 )

 cTfName := "MFInTst2"
 aStruct := { { "FLD1", "M", 10, 0 } }
 DBCREATE( cTfName, aStruct ) 
 USE ( cTfName )
 ? "Memo File extension :", MemoFExtn() // .dbt
 ? REPL( "-", 80 )

 cTfName := "MFInTst3"
 aStruct := { { "FLD1", "M", 10, 0 } }
 DBCREATE( cTfName, aStruct, "DBFFPT" ) 
 USE ( cTfName )
 ? "Memo File extension :", MemoFExtn() // .fpt
 ? REPL( "-", 80 )

 ?
 WAIT "EOF MemoFExtn.prg"

RETURN // MemoFExtn.Main()
/*
Function MemoFExtn() -> Memo File Extension of current table

 Return : If current work area is empty : NIL 
 elseIf current table not include MEMO field : ""
 else .dbt / or .fpt depending RDD used in creation of current table.

 Required :
 #include "dbinfo.ch"
Aug 2012

*/
FUNCTION MemoFExtn() // Memo file extension
LOCAL xRetVal

 IF !EMPTY( ALIAS() )
 IF DBINFO( DBI_MEMOHANDLE ) < 0
 xRetVal := ""
 ELSE 
 xRetVal := DBINFO( DBI_MEMOEXT ) 
 ENDIF 
 ENDIF !EMPTY( ALIAS() )

RETURN xRetVal // MemoFExtn()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.