For many, many years I have wished to write this tip. As it has happened before it was my good friend Johnny Mossin, who made me aware of the ability to execute SDSF in batch. During my research for this tip I discovered that execution of SDSF in batch has been available for a lot of years, even before z/OS was invented. Maybe I was able to write this tip already when I started my site...
No more talk. Here is an example:
This step will print the contents of the DD name ISFIN in the job named MYUSERJB, provided there is a job in the ST queue in SDSF with this name. And this job must of course contain a DD name called ISFIN, which must be either some kind of SYSOUT or SYSIN. The contents of ISFIN is concatenated to the contents of the dataset MYUSER.SDSF.OUT.
If you have just a litte experience in using SDSF I believe you can easily figure out what is going on. Actually the contents of ISFIN is just a bunch of SDSF commands as you know them from using SDSF in TSO. The only new thing is the FIND command, which you must use in order to select the correct line in the result of a SDSF display command. And the other new thing is the command ++, which is used for execution of a line command.
On the EXEC card you can choose between using PGM=SDSF or PGM=ISFAFD. There is a subtle difference, which is described in the chapter about SDSF in batch in the SDSF manual. PARM='++32,100' sets the "screen-size" in this example to 32 lines each 100 characters wide. You can study the result in the output in ISFOUT. The result of every single SDSF command specified in ISFIN is printed here. If your command stream does not work as intended you can use ISFOUT for debugging.
After Johnny introduced me to SDSF in batch my head is exploding with ideas of how to exploit this "new" feature. I hope you feel the same way. Let me hear about it if you make something clever.