If you are using SAS for Windows, UNIX or whatever platform you can use
"FILENAME ddname FTP" statement to check if a dataset exists, and to write
directly to datasets on the mainframe without using the typical FTP line
commands.
I've used edited copies of working code. The second example could be
something as simple as:
Data _null_;
Infile jclgen;
File jclftp;
Input @;
Put _infile_;
Return;
Run;
Sample code follows:
*******************************************************************;
*** Get a listing of all the PAIO logs datasets and store in a ***;
*** SAS file,
***;
*******************************************************************;
filename dir ftp '' ls user='userid' debug
host='111.222.333.444' PASS='password'
cd="'&HLQ..IODRIVER.&TESTID..'"
;
data paio_logfiles;
infile dir length=ll stopover;
input llq $varying8. ll
@;
if llq=:'LOG';
dsname ="&HLQ..IODRIVER."||"&TESTID.."||llq;
output;
run;
***************************************************************;
*** Allocate the dataset that will contain the modified ***;
*** JCL to be executed on the mainframe. ***;
*** ***;
*** NB the ENCODING=EBCDIC037 is required so that EBCDIC ***;
*** characters are written to the file ***;
***************************************************************;
FILENAME JCLFTP CLEAR;
FILENAME jclftp FTP "'HLQ.iodriver.&prof..jclgen'"
HOST='111.222.333.444' USER='userid'
PASS=password LRECL=80 RCMD='SITE RDW' recfm=f
ENCODING=EBCDIC037;
***************************************************************;
*** Post process JCLGEN.JCL ***;
*** ======================= ***;
***************************************************************;
data jcl;
infile jclgen length=l stopover;
file jclftp;
input @;
if l<10 then do;
put _infile_;
return;
end;
input @3 jcl $8.
@;
if jcl=:'VSP' then do;
input @6 num 2.
@;
end;
if jcl=:"NJOBS08" then do;
put @1 "//NJOBS04 DD DUMMY";
return;
end;
if 0<=num<=3 then do;
put _infile_;
put @1 "/*XEQ N1";
return;
end;
else if 4<=num<=7 then do;
put _infile_;
put @1 "/*XEQ N2";
return;
end;
put _infile_;
return;
run;
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of
> Roberto Halais
> Sent: Thursday, March 31, 2011 5:49 AM
> To: [email protected]
> Subject: Re: [IBM-MAIN] FTP question
>
> There exists REXX for PC (Reginald, OOREXX, etc) in the windows
environment.
> I would
> code a REXX script which would issue an FTP and DIR then check for the
files
> existence.
> If not exist then FTP put. That is if the Windows initiates FTP.
>
> If z/OS initiates FTP the do reverse with REXX script.
>
>
> On Thu, Mar 31, 2011 at 8:34 AM, McKown, John
<[email protected]
> > wrote:
>
> > > -----Original Message-----
> > > From: IBM Mainframe Discussion List
> > > [mailto:[email protected]] On Behalf Of Bernard Coeytaux
> > > Sent: Thursday, March 31, 2011 6:57 AM
> > > To: [email protected]
> > > Subject: Re: FTP question
> > >
> > > We use the followings steps
> > >
> > > Del targetfilename.$TMP$
> > >
> > > Put sourcefilename targetfiname.$TMP$
> > >
> > > If the put is RC 0 then the dataset is complete
> > >
> > > Ren targetfilename.$TMP$ realtargetname
> > >
> > > The rename is atomic, and will fails if the real target
> > > dataset exist on evry
> > > platform
> >
> > This works and I think it is the only way to do the "noreplace" in a
> > generic, general, manner. Unfortunately it does not avoid the file
upload
> > entirely and so still takes as long as replacing. Another possible
problem
> > is that the z/OS step will exit with a non-zero RC if the file exists
when
> > using the '(EXIT' parameter, because the "ren" fails. Of course, the
"del"
> > could also fail and, with (EXIT, that would terminate your ftp step
> > prematurely.
> >
> > z/OS really needs a better ftp client. I wish we had one that is
scriptable
> > much like IDCAMS is scriptable. No, don't ask me to write it. If I did,
it
> > would likely be in REXX. And I'd likely get in trouble from my
management
> > for wasting MSUs. We are sensitive to MSU usage. My boss monitors it
because
> > it directly impacts his software budget. And, from what I can tell,
upper
> > management has a visceral desire to eliminate IT spending altogether. Of
> > course, at their level, they want to eliminate all spending other than
their
> > salaries. Yes, I'm very cynical.
> >
> > --
> > John McKown
> > Systems Engineer IV
> > IT
> >
> > Administrative Services Group
> >
> > HealthMarkets(r)
> >
> > 9151 Boulevard 26 * N. Richland Hills * TX 76010
> > (817) 255-3225 phone *
> > [email protected] * www.HealthMarkets.com
> >
> > Confidentiality Notice: This e-mail message may contain confidential or
> > proprietary information. If you are not the intended recipient, please
> > contact the sender by reply e-mail and destroy all copies of the
original
> > message. HealthMarkets(r) is the brand name for products underwritten
and
> > issued by the insurance subsidiaries of HealthMarkets, Inc. -The
Chesapeake
> > Life Insurance Company(r), Mid-West National Life Insurance Company of
> > TennesseeSM and The MEGA Life and Health Insurance Company.SM
> >
> >
> >
> > ----------------------------------------------------------------------
> > For IBM-MAIN subscribe / signoff / archive access instructions,
> > send email to [email protected] with the message: GET IBM-MAIN INFO
> > Search the archives at http://bama.ua.edu/archives/ibm-main.html
> >
>
>
>
> --
> "Those who can make you believe religious absurdities, can make you commit
> atrocities." Voltaire
>
> The philosopher has never killed any priests, whereas the priest has
> killed a great many philosophers. Denis Diderot
>
> "Men will never be free until the last king is strangled with the entrails
> of the last priest." Denis Diderot
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: GET IBM-MAIN INFO
> Search the archives at http://bama.ua.edu/archives/ibm-main.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html