Any number of polylines or polygons can reside in the same file. Each one begins with a single line header that is used as the "ID" of the polyline or polygon. Next comes the data in either 2D or 3D format, the importing automatically handles either. Finally, the polyline or polygon is finished (not necessarily "closed") by an "*" in column 1. There is no difference between polyline and polygon in a P2D file, only how the data are treated by the application reading the file.
Example 1 (Polyline)
------------------------
Polyline Test
...
601522.11337106 3626642.21854415 0
*
Example 2 2 (Polygon)
------------------------
Zone1 Test
609115.69390674 3643612.72035394 072035394
608828.057738002 3642922.39387814 039387814
608569.186338242 3642232.06904821 006904821
608396.604307826 3640908.94563456 094563456
*
Zone2
601493.350247946 3628713.19503985 19503985 0
Zone2
601464.586301899 3627763.99747289 099747289
601522.11337106 3627016.14485373 14485373 0
601522.11337106 3626642.21854415 021854415
*