BookmarkSubscribeRSS Feed
mmattison
Calcite | Level 5

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;

4 REPLIES 4
Kurt_Bremser
Super User

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.

s_lassen
Meteorite | Level 14

@mmattison:

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;

 

mmattison
Calcite | Level 5

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?

Kurt_Bremser
Super User

I corrected my previous post.

 

But look at this (from the proc upload doc):

 

INFILE=client-file-identifier

specifies the external file that you want to upload to the server from the client.

If you use the INFILE= option, you must also use the OUTFILE= option.
client-file-identifier can be one of the following:

fileref

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.

fileref(member)

is used if you have defined a fileref on the client that is associated with an aggregate storage location, such as a directory.

member

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.

You must define the fileref before specifying the PROC UPLOAD statement.
Note: The transfer of hidden files is not supported when using the (*) wildcard

 

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 4 replies
  • 1108 views
  • 0 likes
  • 3 in conversation