Here's my function that writes out the GEDCOM file. There were some crazy exceptions that I allowed for with a DO CASE statement. :(

*=====================================
FUNCTION OutputCursor( sFileName AS String )

    && SET STEP ON
    iStart = SECONDS()
    sSetExact = SET("Exact")
    SET EXACT ON
    IF FILE( sFileName )
        DELETE FILE (sFileName)
    ENDIF

    iFileHandle = FCREATE( sFileName )
    IF iFileHandle > 0
        SCAN
            IF EMPTY( sF2 )
                sOutput = ALLTRIM( sF1 )
            ELSE
                sOutput = sF1 + RTRIM( sF2 )
            ENDIF
            DO CASE
CASE INLIST( ALLTRIM(sOutput), "1 _NMR", "2 CONT", "3 CONT", "1 OBJE", "1 NOTE", "1 SSN", "1 MILT" )
                    && SET STEP ON
                    sOutput = PADR(sOutput, 7)
                CASE ALLTRIM(sOutput) == "2 _PRIM Y"
                    sOutput = sOutput + SPACE(1)
                CASE INLIST( ALLTRIM( sOutput), "1 CHR", "1 DIV" )
                    sOutput = ALLTRIM(sOutput) + SPACE(1)
                CASE INLIST( ALLTRIM( sOutput), "1 _MILT")
                    sOutput = ALLTRIM(sOutput) + SPACE(1)
            ENDCASE
            FPUTS( iFileHandle, sOutput )
        ENDSCAN
        FCLOSE( iFileHandle )
    ENDIF
    SET EXACT &sSetExact
    iEnd = SECONDS()
    iTimeSpent = iEnd - iStart
? TIME(), "Done copying out to " + sGEDCom + " which took " + ALLTRIM( STR( iTimeSpent ) ) + " seconds."

ENDFUNC


On 09/20/2014 08:59 AM, Kevin Cully wrote:
I ended up using a low level write method using FPUTS() and various ALLTRIM() to make it work. I used WinMerge ( http://winmerge.org/ ) to compare the before and after Gedcom files. WinMerge is like BeyondCompare but cheaper. I can post the code later but I don't have that VM fired up right now.



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to