DATA Step, Macro, Functions and more

Mainframe SAS

Reply
Super Contributor
Posts: 673

Mainframe SAS

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?

SAS Super FREQ
Posts: 8,868

Re: Mainframe SAS

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


Regular Contributor
Posts: 184

Re: Mainframe SAS

Posted in reply to Cynthia_sas

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.

Super Contributor
Posts: 673

Re: Mainframe SAS

I hope this works on Mainframe.

How to over write if the file exits?


SAS Super FREQ
Posts: 8,868

Re: Mainframe SAS

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

Ask a Question
Discussion stats
  • 4 replies
  • 766 views
  • 1 like
  • 3 in conversation