My objective is to upload from local drive multiple .txt files to an already allocated mainframe file. My problem is finding correct syntax to point at more than one .txt file in the infile statement.
My txt files are identified as:
FILENAME exp1 "C:\&filenm.\201601_201601_US0001_us01.txt" LRECL=375;
FILENAME exp2 "C:\&filenm.\201602_201602_US0001_us01.txt" LRECL=375;
FILENAME exp3 "C:\&filenm.\201603_201603_US0001_us01.txt" LRECL=375;
My infile statement (after signon) is below:
%let mvsnode=ASYS.FFIC.COM;
options comamid=TCP remote=mvsnode.SPAWNER autosignon=YES;
rsubmit user=_prompt_;
FILENAME IMP1 "PIR5.GGDATA.PREMIUM.recon6.US01.Q116";
Proc Upload infile=EXP1, exp2, exp3 /*THIS IS NOT WORKING*/
outfile=IMP1;
run;
endrsubmit;
signoff mvsprod.spawner;
Erroneus post deleted. While the overview of the proc upload procedure specifically mentions only "SAS Files", the proc upload statement documentation has the parts for external files.
Do you want to concatenate the three files into one file on the mainframe, or do you want to upload the three files as members in a partitioned dataset?
In the first case you will have to concatenate the three files first:
filename temp temp; data _null_; file temp; infile exp1 eof=file2; if 0 then do; file2: infile exp2 eof=file3; end; if 0 then do; file3: infile exp3 eof=file3; end; input; put _infile_; run; rsubmit; filename imp1 "pir5.etc...."; proc upload infile=temp outfile=imp1;run; endrsubmit;
In the other case you will have to run a separate proc upload for each file, as the filenames are too long to be used as member names in a partitioned dataset:
rsubmit;
proc upload infile=exp1 outfile=imp1(EXP1);run;
proc upload infile=exp2 outfile=imp1(EXP2);run;
proc upload infile=exp3 outfile=imp1(EXP3);run;
I want upload multiple text files into one mainframe dataset (not partitioned into members). In a previous response, someone said I cannot upload text files. They must be sas files but I know someone in my group who has used proc upload to upload a text file to the mainframe.
Do you know if proc upload can support multiple text files in the infile statement?
I corrected my previous post.
But look at this (from the proc upload doc):
specifies the external file that you want to upload to the server from the client.
is used if you have defined a fileref on the client that is associated with a single file. You must define the fileref before specifying the PROC UPLOAD statement.
is used if you have defined a fileref on the client that is associated with an aggregate storage location, such as a directory.
specifies one or more files in that aggregate storage location. You can use the asterisk character (*) as a wildcard in the member specification to upload multiple files via a single PROC UPLOAD statement. The * matches zero or more characters.
So you should be able to use wildcards for files in a directory accessed through a filename reference. If that is not possible, you need to do the transfer one file at a time. Aggregate file references are not allowed.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.