BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8

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?

4 REPLIES 4
Cynthia_sas
SAS Super FREQ

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


Howles
Quartz | Level 8

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.

SASPhile
Quartz | Level 8

I hope this works on Mainframe.

How to over write if the file exits?


Cynthia_sas
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1848 views
  • 1 like
  • 3 in conversation