Desktop productivity for business analysts and programmers

IBM MAINFRAME renaming a file using sas

Reply
Contributor
Posts: 59

IBM MAINFRAME renaming a file using sas

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

Super User
Posts: 5,616

Re: IBM MAINFRAME renaming a file using sas

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" ;

Contributor
Posts: 59

Re: IBM MAINFRAME renaming a file using sas

Posted in reply to Astounding

I have try your solution but nothing appends.

Regards,

 

Alain

Super User
Posts: 5,493

Re: IBM MAINFRAME renaming a file using sas

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
Contributor
Posts: 59

Re: IBM MAINFRAME renaming a file using sas

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

Super User
Super User
Posts: 7,162

Re: IBM MAINFRAME renaming a file using sas

[ Edited ]

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;

 

Ask a Question
Discussion stats
  • 5 replies
  • 187 views
  • 0 likes
  • 4 in conversation