09-29-2017 01:20 PM
I have a file name courriel on the ibm mainframe.
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?
09-29-2017 02:24 PM
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" ;
10-01-2017 09:31 AM
10-03-2017 08:08 AM
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.
10-03-2017 10:06 AM - edited 10-03-2017 10:11 AM
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;