View previous topic :: View next topic
|
Author |
Message |
Vidhya Kalyanasundaram
New User
Joined: 19 Jul 2007 Posts: 30 Location: chennai
|
|
|
|
Hi Friends,
I have a query regarding a SAS code. I have attached below the SAS macro that is used to extract DB2 accounting information from SAS dataset - P.SMFDB2.DATA. This step consumes around 20mins of CPU and 30 mins of Elapsed time. Is there any way to tune this program?
Code: |
//R010 EXEC MXGSAS,SORT=300
//SASLOG DD SYSOUT=*
//SASLIST DD SYSOUT=*
//SOURCLIB DD DSN=SYS2.MXG.SOURCLIB,
// DISP=SHR
//WORK DD DSN=&&TEMPWORK,
// DISP=(,PASS),
// UNIT=(SYSDA,5),
// SPACE=(CYL,(800,250),RLSE)
//PDB DD DSN=&&TEMPPDB,
// DISP=(,PASS),
// UNIT=SYSDA,
// SPACE=(CYL,(600,50),RLSE)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SMF DD DSN=P.SMFDB2.DATA,
// DISP=SHR
//SYSIN DD *
OPTIONS NOCENTER NODATE NONUMBER;
*;
%LET MACKEEP=
%QUOTE(
_NDB2
MACRO _SDB2 %
MACRO _WDB2ACC PDB.DB2ACCT %
MACRO _VDB2ACC KEEP=JOB SYSTEM DB2SRBTM DB2TCBTM
QB1CGET QB2CGET QB3CGET QB4CGET
QB1CRIO QB2CRIO QB3CRIO QB4CRIO %
MACRO _EDB2ACC
IF QMDACNAM='BATCH' OR QMDACTYP='BATCH' THEN DO;
%%%INCLUDE SOURCLIB(EXDB2ACC);
END;
%%
)
;
%INCLUDE SOURCLIB(TYPEDB2);
*;
|
|
|
Back to top |
|
|
Vidhya Kalyanasundaram
New User
Joined: 19 Jul 2007 Posts: 30 Location: chennai
|
|
|
|
Or is there any way to extract this information with any other utility which consumes less time rather than using this SAS macro? |
|
Back to top |
|
|
Vidhya Kalyanasundaram
New User
Joined: 19 Jul 2007 Posts: 30 Location: chennai
|
|
|
|
Sorry, missed to include the SOURCLIB statements.
%%%INCLUDE SOURCLIB(EXDB2ACC);
- OUTPUT _WDB2ACC;
%INCLUDE SOURCLIB(TYPEDB2);
-
%INCLUDE SOURCLIB(VMACSMF,VMACDB2,IMACKEEP);
DATA
_VARDB2
_SMF
_CDEDB2
%INCLUDE SOURCLIB(DIFFDB2);
Could anyone please help regarding this? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Use WHERE instead of IF statements to select your records.
Use KEEP to restrict the number of variables you're retrieving.
Contact support@mxg.com to get help -- I've found Barry Merrill to be very good at providing MXG help when needed.
Recognize, however, that DB2 can generate a large number of records in SMF and sometimes you have to bite the bullet and accept that the job is going to run for awhile. |
|
Back to top |
|
|
Vidhya Kalyanasundaram
New User
Joined: 19 Jul 2007 Posts: 30 Location: chennai
|
|
|
|
I replaced the IF statement with WHERE clause as given below.
WHERE QMDACNAM='BATCH' OR QMDACTYP='BATCH' ;
But i am getting error. Could you please tell me whether my syntax is wrong?
As you said, i have sent a mail to support@mxg.com. Will post the updates in the forum.
Thanks,
Vidhya |
|
Back to top |
|
|
sbxjld
New User
Joined: 15 Apr 2009 Posts: 3 Location: tervuren
|
|
|
|
Could you please tell me what errro you get in the log ?
Jean-Louis |
|
Back to top |
|
|
ABaluchamy
New User
Joined: 29 Dec 2006 Posts: 34 Location: INDIA
|
|
|
|
I have attached the log file with this
SASLOG |
|
Back to top |
|
|
Vidhya Kalyanasundaram
New User
Joined: 19 Jul 2007 Posts: 30 Location: chennai
|
|
|
|
Unfortunately, the _NDB2 token only prevents the OUTPUT of the
other DB2 datasets, but they are all being read and decoded.
1. You can use the IMACFILE exit to read only the SMF 101 Subtype 0 (IFCID=0003) record since you only want to create DB2ACCT.
2. You can use the IHDRDB2H "DB2 Header" exit to further select only the account records you want for batch.
You could put your code in those members of your "USERID.SOURCLIB" tailoring library, but then they would always apply if that DSNAME is used in the
//SOURCLIB concatenation, so, instead, use their "instream" equivalent macro variables:
//SYSIN DD *
%LET MACFILE=
%QUOTE (
IF ID=101 AND SUBTYPE=0;
) ;
%LET IHDRDB2H=
%QUOTE (
IF OFFQMDA GT 0 AND NRQMDA GT 0;
OFFTEST=OFFQMDA-3+OFFSMF;
INPUT @OFFTEST+41 TESTCNAM $EBCDIC8.
TESTCTYP $EBCDIC8.
@;
IF TESTCNAM='BATCH' OR TESTCTYP='BATCH';
);
the rest of your code.
But still the code is taking 25mins to process the records.
Will update further if i get reply from Barry.
Thanks !!! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
25 minutes is pretty good -- our MXG daily process takes 4.5 to 5.5 hours per day to go through all the SMF records. But then we're not looking only at one type but handling them all. |
|
Back to top |
|
|
Vidhya Kalyanasundaram
New User
Joined: 19 Jul 2007 Posts: 30 Location: chennai
|
|
|
|
Hi All,
With the help from SAS library and tips from Barry, i tuned the SAS macro. The CPU time got reduced from 20 mins to 5 mins !!!
Note : I have attached below the tuned code
Thanks a lot for all your help !!!!
:-)
Code: |
%LET MACFILE=
%QUOTE(
IF ID=101 ;
INPUT @19+OFFSMF SUBTYPE &PIB.2. @;
IF SUBTYPE=0;
);
*;
%LET MACDB2H=
%QUOTE(
IF OFFQMDA GT 0 AND NRQMDA GT 0;
OFFTEST=OFFQMDA-3+OFFSMF;
INPUT @OFFTEST+41 TESTCNAM $EBCDIC8.
TESTCTYP $EBCDIC8.
@;
IF TESTCNAM='BATCH' OR TESTCTYP='BATCH';
);
*;
%LET MACKEEP=
%QUOTE(
_NDB2
MACRO _SDB2 %
MACRO _WDB2ACC PDB.DB2ACCT %
MACRO _VDB2ACC KEEP=JOB SYSTEM DB2SRBTM DB2TCBTM
QB1CGET QB2CGET QB3CGET QB4CGET
QB1CRIO QB2CRIO QB3CRIO QB4CRIO %
);
*;
%INCLUDE SOURCLIB(TYPEDB2); |
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Glad to hear you got the time down. |
|
Back to top |
|
|
|