In JCL you just have to write DSN=&&TEMP instead of DSN=XXXX.X.XXXX.XXX. to create a temporary dataset. To use this temporary dataset just use &TEMP wherever you want the use the temporary data. I hope this answers a part of your question.
As far as usage part is concerned. I believe the temporary datasets are generally used to save space allocation and deallocation time. I mean just take a case where a Procedure generates an ouput now you jus need to send the output via some Mailing Procedure you have, right. So just mail that temp. dataset using &TEMP. At the end of the execution the temporary dataset get removed but if i would have used a permanent dataset then i had to use IEFBR14 to delete the file at the end of JCL so as to deallocate the dataset.
One thing about temp to remember, temp files are ussually used as DSN=&&TEMP, some more are here in this links..