IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Tuning SAS Program


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vidhya Kalyanasundaram

New User


Joined: 19 Jul 2007
Posts: 30
Location: chennai

PostPosted: Wed Apr 08, 2009 11:49 am
Reply with quote

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
View user's profile Send private message
Vidhya Kalyanasundaram

New User


Joined: 19 Jul 2007
Posts: 30
Location: chennai

PostPosted: Wed Apr 08, 2009 11:58 am
Reply with quote

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
View user's profile Send private message
Vidhya Kalyanasundaram

New User


Joined: 19 Jul 2007
Posts: 30
Location: chennai

PostPosted: Wed Apr 08, 2009 2:58 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 08, 2009 4:55 pm
Reply with quote

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
View user's profile Send private message
Vidhya Kalyanasundaram

New User


Joined: 19 Jul 2007
Posts: 30
Location: chennai

PostPosted: Wed Apr 08, 2009 8:59 pm
Reply with quote

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
View user's profile Send private message
sbxjld

New User


Joined: 15 Apr 2009
Posts: 3
Location: tervuren

PostPosted: Thu Apr 16, 2009 6:50 pm
Reply with quote

Could you please tell me what errro you get in the log ?
Jean-Louis
Back to top
View user's profile Send private message
ABaluchamy

New User


Joined: 29 Dec 2006
Posts: 34
Location: INDIA

PostPosted: Tue Apr 21, 2009 1:01 pm
Reply with quote

I have attached the log file with this
SASLOG
Back to top
View user's profile Send private message
Vidhya Kalyanasundaram

New User


Joined: 19 Jul 2007
Posts: 30
Location: chennai

PostPosted: Tue Apr 21, 2009 9:02 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Apr 21, 2009 9:16 pm
Reply with quote

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
View user's profile Send private message
Vidhya Kalyanasundaram

New User


Joined: 19 Jul 2007
Posts: 30
Location: chennai

PostPosted: Sat May 23, 2009 4:37 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat May 23, 2009 5:09 pm
Reply with quote

Glad to hear you got the time down.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top