DATA Step, Macro, Functions and more

Proc Upload PC Sas Program Infile statement

Reply
New Contributor
Posts: 4

Proc Upload PC Sas Program Infile statement

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;

Super User
Posts: 7,809

Re: Proc Upload PC Sas Program Infile statement

[ Edited ]
Posted in reply to mmattison

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
PROC Star
Posts: 102

Re: Proc Upload PC Sas Program Infile statement

Posted in reply to mmattison

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

 

New Contributor
Posts: 4

Re: Proc Upload PC Sas Program Infile statement

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?

Super User
Posts: 7,809

Re: Proc Upload PC Sas Program Infile statement

Posted in reply to mmattison

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 4 replies
  • 66 views
  • 0 likes
  • 3 in conversation