BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

 

I have a file name courriel on the ibm mainframe.

ex:

A108.TESTING.COURRIEL

 

I can rename this file directly from the mainframe using the command r (stand for rename) on the left margin and give this file a new name.

 

As I am transfering a new courriel file (updated file) from my pc to the mainframe using a SAS code, I would like to use a sas code in order to rename my mainframe file courriel to cour2017 in order to transfert a new courriel file from my pc while keeping a copy of the original file.

 

Is there a way to acheive that?

Regards,

 

Alain

7 REPLIES 7
Astounding
PROC Star

Assuming this command would work on the mainframe:

 

r "oldname" "newname"

 

You should be able to achieve that in a SAS program using:

 

%sysexec r "oldname" "newname" ;

alepage
Barite | Level 11

I have try your solution but nothing appends.

Regards,

 

Alain

LinusH
Tourmaline | Level 20
If you are using PROC UPLOAD for the file transfer you can rename it on the fly by specifying your new file name on the OUTFILE= option.
Data never sleeps
alepage
Barite | Level 11

Hello,

 

It is a nice idea but as the original file on the mainframe is courriel, I need to rename this file first, let's say to cour2017 and thereafter, transfert the updated file on the mainframe server.

 

Regards,

Alain

Tom
Super User Tom
Super User

You didn't describe what type of Mainframe you are using. Are you running on MVS, VM/CMS? From the format of the filename it looks like MVS to me.  Not sure what you mean by R before the filename, perhaps you are using some type of screen list of file names? Are you using ISPF? Does that still exist? I doubt you are using ROSCOE or WYLBER.

 

Anyway did you try the RENAME() function in SAS?

Here is the example from the manual.  Just put in your filenames.

/*
Example 3: Renaming a Directory
The following example renames a directory in the UNIX operating environment.
*/
data _null_;
rc=rename('/local/u/testdir/', '/local/u/oldtestdir', 'file');
run;

 

bhandari9
Calcite | Level 5

Did you figure out how to rename mainframe file using SAS? Please share your solution.

 

Thanks and best regards.

 

Rajesh.

alepage
Barite | Level 11

unfortunately,

 

I have switch to another job and the working environment is different.  I can't test myself the proposed code.

I might ask a colleague to do so.

I will let your know if it works.

 

Regards,

Alain.

 

 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 7 replies
  • 1234 views
  • 0 likes
  • 5 in conversation