Problem Running a Subcircuit in LTSpice
Sounds to me like you're expecting the software to assume a symbol named &quot;LM317&quot; automatically knows it needs to look into a file called LM317.sub and to use a .subckt defined as LM317.  It doesn't work like that.  The symbol needs metadata to know what subcircuit/model to use and the file it needs to reference.
Instead of learning LTspice symbol design and its nuances, I instead suggest right-clicking on the .subckt line of that text file within LTspice and auto-generating the symbol as described in this article.  The auto-generation will handle all the file/model linking nonsense for you, so you just need to edit the visual representation of your symbol afterwards to suit your liking.  Keep in mind that the location of the .sub file on your computer the moment the symbol is auto-generated is very important.  If it's ever moved, the symbol won't know where to find it anymore.  On Windows, it's customary to put (and leave) these files in \Documents\LTspiceXVII\lib\sub prior to doing any symbol auto-generation.