How to combine the log and .lst file into a single file and save it to a PDS on Mainframe.
Typically how it is handled now is,
After the successful run there are two files created.one is the log and the other is an lst file.
giving the command ST at the command input line both the files will be combined to a single file.
then using xdc command the above file is saved to the PDS and I manually give the name of the file to be saved as.
How can this be done in the program?
Hi:
My mainframe days are a ways behind me, but if you really need to combine the two separate files, look for system utilities, like IEBGENER or IEBCOPY -- but it almost sounds to me like you are dealing directly with the "spool" files that capture output and that you are issuing viewing commands when viewing the output. If you captured both the LOG and the LST to mainframe datasets (sequential files), then you could use system utilities to combine them. Otherwise, I don't think you could use SAS to read them directly off the spool, I think you have to save them as files and then would have to read them and combine them with a program -- probably way more trouble than it's worth.
You might want to open a track with Tech Support, depending on what you're using as your interface to the mainframe for submitting jobs, (ROSCOE, WYLBUR, TSO, ISPF, JCL, etc), there may be other ways to do what you want without issuing line commands. But from the SAS end, I do not believe it is possible to route both the log and the listing to the same PDS member at the same time. I believe that SAS will "want" to create 2 separate files and you will have to join them together, somehow after your job runs.
cynthia
You can use PROC PRINTTO to redirect both the log and the listing to one file.
proc printto log="&path\&target.txt"
print="&path\&target.txt" ;
Output and log content will be interleaved.
I hope this works on Mainframe.
How to over write if the file exits?
If you're using JCL, the DISP= parm will control whether you SHR or can write (OLD) or create new (NEW). In SAS on the mainframe, that equates to using the DISP option on the FILENAME statement if you are using a FILENAME statement.
cynthia
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.