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.

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2695 views
  • 0 likes
  • 5 in conversation