Without wasting much time lets check the first JCL used to connect to db2.
//TTYYTST JOB(TEST),CLASS=I,MSGCLASS=X,MSGLEVEL=(1,1)
// NOTIFY=&SYSUID
//STEP01 EXEC PROC=SAS,OPTIONS=' '
//WORK DD SPACE=(CYL,(,500)),VOL=(,,,59)
//OUTFILE DD DSN=TEST.OUTPUT.SAS,
// DISP=(,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=122,BLKSIZE=000),
// UNIT=SYSDA,SPACE=(TRK,(500,500),RLSE)
//SYSIN DD *
OPTION NOCENTER;
OPTION SORTLIB;
PROC SQL; <== Starts here
CONNECT TO DB2 (SSID=DQAT); <== DQAT is the db2 subsystem here
CREATE TABLE test AS <== test is the sas datset here.
SELECT *
FROM CONNECTION TO DB2 (
select fname,
lastname,
dept_name,
from test01.dept
where student_id = 1 fetch first 5 rows only) ;
//STEP01 EXEC PROC=SAS,OPTIONS=' '
//WORK DD SPACE=(CYL,(,500)),VOL=(,,,59)
//OUTFILE DD DSN=TEST.OUTPUT.SAS,
// DISP=(,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=122,BLKSIZE=000),
// UNIT=SYSDA,SPACE=(TRK,(500,500),RLSE)
//SYSIN DD *
OPTION NOCENTER;
OPTION SORTLIB;
PROC SQL; <== Starts here
CONNECT TO DB2 (SSID=DQAT); <== DQAT is the db2 subsystem here
CREATE TABLE test AS <== test is the sas datset here.
SELECT *
FROM CONNECTION TO DB2 (
select fname,
lastname,
dept_name,
from test01.dept
where student_id = 1 fetch first 5 rows only) ;
%PUT SQLXRC=&SQLXRC;
%PUT SQLMSG=&SQLMSG;
QUIT;
DATA STEP1;
SET TEST;
FILE OUTFILE DLM=',' ;
IF _N_=1 THEN DO;
PUT 'FIRST NAME,'
'LAST NAME,'
'DEPT NAME,'
;
END;
PUT FNAME
LASTNAME
DEPT_NAME
;
//SYSPRINT DD SYSOUT=*
//*
JCL is self explanatory. %PUT SQLXRC and SQLMSG are the macros used to capture the DB2 return codes and error messages if any.
I Have a query related to a SAS pgm im using which is failing to extract records from few sas datasets but extracts for 1 dataset .
ReplyDeleteNOTE: 116 records were written to the file RCPO2.
NOTE: There were 116 observations read from the data set RCDATA.W01_PO2.
NOTE: There were 0 observations read from the data set RCDATA.W02_PO2.
NOTE: There were 0 observations read from the data set RCDATA.W03_PO2.
NOTE: There were 0 observations read from the data set RCDATA.W04_PO2.
NOTE: There were 0 observations read from the data set RCDATA.W05_PO2.
Hi,
DeleteI would like to know more about your issue and your program. Looking into the observations is not sufficient.
To me it looks like the criteria to extract the records is failing, and hence it is not fetching any records.
There is no error in the program.
Check the condition based on which you are pulling the data. Its not failing. Also check for any érror' in the SASLOG, if any previous step has any error.
Best Engineering Colleges in Delhi
ReplyDeleteBest Engineering Colleges in Gurgaon
Best Engineering Colleges in Noida
Best Engineering Colleges in Pune
Best Engineering Colleges in Bangalore
Best Engineering Colleges in Chennai
Best Engineering Colleges in Hyderabad