- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I have to read a Mainframe PDS which is having SAS Program members in it by passing the PDS using a JCL. I have to read one by one and have to get the creation date and user_id as highlighted in below snap.
Please help me with the SAS Code logic for the same.
thanks in advance
thalla
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I no longer have access to a mainframe to test my code, but something like this should work:
data _null_;
/* Assign a fileref to the PDS */
_rc=filename("myPDS","mydata.my.pdsfile");
_did=dopen("myPDS");
if _did ne 0 then do;
putlog "ERROR: Unable to open PDS to look at members";
_rc=filename("myPDS");
stop;
end;
do _i=1 to dnum(did); /* Get info for each PDS member */
MemberName=dread(did,i);
_rc=filename("thisMem",cats("myPDS(",MemberName,")","S");
_fid=fopen("thisMem");
do _j=1 to foptnum(_fid);
infoname=foptname(_fid,_j);
infovalue=finfo(_fid,infoname);
output;
end;
_rc=fclose(_fid);
_rc=filename("thisMem");
end;
_rc=dclose(_did);
_rc=filename("myPDS");
run;
Hope this at least gets you started 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am getting return code 1 instead of zero with this code. Can anyone help me to move forward on this?
thanks,
Thalla
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please post the log so that we can see what happened.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi This is the code that I have created
OPTIONS MISSING = ' ' SYMBOLGEN;
%LET PDSNAME = %ADDTICKS(testpds.jcllib);
DATA PDSCHK;
_RC = FILENAME("MYPDS",&PDSNAME);
_DID = DOPEN("MYPDS");
IF _DID NE 0 THEN DO;
PUTLOG "ERROR: UNABLE TO OPEN PDS TO LOOK MEMBERS IN IT";
_RC = FILENAME("MYPDS");
/* STOP; */
END;
ELSE DO;
PUTLOG "PDS opened successfully";
END;
DO _I = 1 TO DNUM(_DID);
MEMBERNAME = DREAD(_DID,I);
_RC = FILENAME("THISMEM",CATS("MYPDS(",MEMBERNAME,")","S"));
_FID = FOPEN("THISMEM");
DO _J = 1 TO FOPTNUM(_FID);
INFONAME = FOPTNAME(_FID,_J);
INFOVALUE = FINFO(_FID,INFONAME);
OUTPUT;
END;
_RC = FCLOSE(_FID);
_RC = FILENAME("THISMEM");
END;
_RC = DCLOSE(_DID);
_RC = FILENAME("MYPDS");
RUN;
The log is
NOTE: Variable I is uninitialized.
ERROR: UNABLE TO OPEN PDS TO LOOK MEMBERS IN IT
NOTE: Argument 2 to function DREAD(1, ) at line 41 column 19 is invalid.
NOTE: Argument 1 to function FOPTNUM(0) at line 44 column 19 is invalid.
ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing, zero, or invalid.
_RC=20002 _DID=1 _I=1 MEMBERNAME= I= _FID=0 _J=1 INFONAME= INFOVALUE= _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 44:19