in reply to building an ldif from 2 files

Your convoluted BAT file has subroutines calling each other - very doubtful if it can be salvaged.

I suggest you do this in perl, to make it relevant to this site.

Some starter LDIF perl parsing code for munging multiple LDIF files is available at http://www.novell.com/communities/node/3369/build-your-own-scripts-manipulate-ldif-exports-part-2#perl1.

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis