For create a UDCX file for Main data connection, you may follow these steps as:
Open your InfoPath form and clik on “Manage Data Connection…” under the Fields in the InfoPath form, and then in new pop up window, select your Main Connection and click on “Convert to Connection file” as:
and then give your Data connection library’s path (on SharePoint site) in the textbox as:
for example: http://sharepoint_site/DataConnectionLibrary/ABC_Main_Connection.UDCX
and click on OK.
After this you can see your Main Connecion’s UDCX file is available in your site’s Data Connection Library.