procedure ExportChainToCMSFile(AFileName: TFileName; EndIndex: Integer; Sort: Boolean; IncludeRoot: Boolean);