There is a Visual Studio quick action, Extract to Copybook, available for the selected code that you can optionally apply. This quick action creates a new copybook in the project and adds the selected code to it.
To apply the action:
This creates the copybook file and adds it to the project.