Hello everyone,
I'm trying to read all the members of a z/OS PDS to store them in SAS Datasets (or to write them in another files). I'm working on a SEG Unix session (SAS Enterprise Guide 4.1 (4.1.0.1020)) and I access to the PDS through a FILENAME FTP statement with the DIR option.
The DOPEN and DNUM functions don't work, I guess it's because a Unix session can't read z/OS file attributes...
Here is how I managed to do what I want, but not in a perfect way :
/* Filename of the z/OS PDS */
filename pds ftp "'MP01.CTXPDBPX.MTXTPRM2'" mach = "vpbe0000" lrecl = 80 recfm = F dir;
/* Reading of every file corresponding to the combination of P1XXXijk (P1XXX00A, P1XXX00B...) */
data _null_;
do i = 0 to 9;
do j = 0 to 9;
do k = 'A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z';
fic = 'P1XXX' !! strip(i) !! strip(j) !! strip(k);
call execute('data tbl_' !! strip(fic) !! ';');
call execute('infile pds(' !! strip(fic) !! ');');
call execute('input ligne $EBCDIC80.;');
call execute('run;');
end;
end;
end;
run;
Obviously, if the file does not exist (which has 90% probability to happen), an error is displayed and it takes quite a long time for the program to test every combination of file names :
NOTE: CALL EXECUTE generated line.
1 + data tbl_P1XXX00A;
2 + infile pds(P1XXX00A);
3 + input ligne $EBCDIC80.;
4 + put ligne;
5 + run;
NOTE: DATA statement used (Total process time):
real time 1.00 seconds
cpu time 0.01 seconds
NOTE: 220-FTPD1 IBM FTP CS V1R11 at VPBE0000, 08:39:19 on 2012-07-10.
ERROR: Physical file does not exist, P1XXX00A.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TBL_P1XXX00A may be incomplete. When this step was stopped there were 0 observations and 1 variables.
WARNING: Data set WORK.TBL_P1XXX00A was not replaced because this step was stopped.
If someone could help me, either telling me how to list all the members of a PDS, either telling me how to test if the PDS member exists, I would be very thankful to this person ! 😉
Sincerely yours,
Anthony
Does the Z/OS ftp server support the DIR command?
Here is the syntax I have used with FTP to a unix server to get the list of files. Similar syntax should work for z/OS. You just treat the PDS as if it as the directory name.
filename ftpdir ftp
cd="dname"
host="hostname"
user="username"
pass="xxxxxxx"
list
;
Does the Z/OS ftp server support the DIR command?
Here is the syntax I have used with FTP to a unix server to get the list of files. Similar syntax should work for z/OS. You just treat the PDS as if it as the directory name.
filename ftpdir ftp
cd="dname"
host="hostname"
user="username"
pass="xxxxxxx"
list
;
It works ! I used this filename statement associated with the data step below :
filename ftpdir ftp "'MP01.CTXPDBPX.MTXTPRM2'" mach = 'vpbe0000' dir list;
data fic;
infile ftpdir;
input;
fic = _infile_;
run;
The DIR option work on the z/OS ftp server and is useful to get informations about the PDS members. Otherwise, only information about the PDS itself is returned.
Thank you so much !
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: