Page 1 of 2

MACROS in JCL.

PostPosted: Wed Apr 21, 2010 10:44 pm
by Bad Man
I am calling for a macro in my JCL but I feel it is not working the way it should.

Is there some thing special we need to do with macros after writing them.....

Re: MACROS in JCL.

PostPosted: Wed Apr 21, 2010 11:13 pm
by Robert Sample
I am calling for a macro in my JCL but I feel it is not working the way it should.

Is there some thing special we need to do with macros after writing them.....
<rant on>
JCL does not use macros. JCL runs programs. It does not slice, it does not dice, it does not do anything except run programs. It cannot use macros because macros are source code and JCL does not do source code -- it runs programs. Period. The programs can be user programs or utilities but they are nothing but programs executed by JCL.
<rant off>

Perhaps we can help if you fill in a few gaps -- what language did you write the macro in? Assembler? Clist? Rexx? SAS? ... ? How do you expect to invoke this macro? What do you expect the macro to do?

Re: MACROS in JCL.

PostPosted: Wed Apr 21, 2010 11:37 pm
by dick scherrer
Hello,

Posting the JCL you submitted and the informatonal/diagnostic output generated will help. . .

Re: MACROS in JCL.

PostPosted: Wed Apr 21, 2010 11:49 pm
by Bad Man
Data Storgrp;                                                     
  Set VOLSUM;                                                     
  File ALRTLOG;                                                   
  %VOLSLAI;  /* SLA_Util for storage group set in macro  */       
  If MeanPct < SLA_Util Then Delete;                             
                                                                 
  Put @01 Date      date9.0                                       
      @11 Time      time5.0                                       
      @18 Storgrp      $8.0                                       
      @27 SLA_Util      3.0                                       
      @32 MeanPct       3.0                                       
      @38 '/'                                                     
      @41 Num_Vols      3.0                                       
      @48 Sum_Capa      4.0                                       
      @54 Sum_Aloc      4.0                                       
      @60 MeanFree      4.0                                       
      @67 Larg_Ext      4.0 ;                                     




Here is what I call it as macro sorry this is new to me::




%macro volslai;                                       
   Select;                                             
     When (Storgrp eq 'DB') SLA_Util = 92;       
     When (Storgrp eq 'DB2S') SLA_Util = 98;       
     When (Storgrp eq 'OPSN') SLA_Util = 60;       
     When (Storgrp eq 'OPSPRI') SLA_Util = 90;       
     When (Storgrp eq 'SASPRIME') SLA_Util = 85;       
     When (Storgrp eq 'SCRTCHSD') SLA_Util = 90;       
     When (Storgrp eq 'TINBATCH') SLA_Util = 85;       
     When (Storgrp eq 'TINPRIME') SLA_Util = 90;       
     When (Storgrp eq 'TSOPRIME') SLA_Util = 90;       
     When (Storgrp eq 'TSOSMALL') SLA_Util = 90;       
     When (Storgrp eq 'TSTPRIME') SLA_Util = 95;       
     When (Storgrp eq 'USRPRIME') SLA_Util = 85;       
     Otherwise                    SLA_Util = 80;       
   End;                                               
   Label SLA_Util = 'SLA*Util%';

Re: MACROS in JCL.

PostPosted: Thu Apr 22, 2010 12:03 am
by Bad Man
There is a code which:

//STEP020  EXEC SAS,SASAUTO='RSM.SAS.MACLIB'             
//SASLIST  DD SYSOUT=(,),OUTPUT=(*.RPT1)                 
//ALRTLOG  DD DSN=RSM.POOLALRT.LOG,DISP=MOD             
//EMAIL    DD DSN=&&EMAIL,DISP=(,PASS),STORCLAS=DATA,   
//            SPACE=(TRK,(1,1)),RECFM=FB,LRECL=80       
//TSOSE    DD DSN=&&TSOE,DISP=(,PASS),STORCLAS=DATA,     
//            SPACE=(TRK,(1,1)),RECFM=FB,LRECL=80       
//DCOLLECT DD DSN=&&DCOLLECT,DISP=(OLD,DELETE)           
//SYSIN    DD DSN=ACSRXG.STORAGE.CNTL(POOLIMS),DISP=SHR 

Here POOLIMS is

Options NOSource;                                                   
Data VRECS;                                                         
  Infile DCOLLECT;                                                 
  %VRECS;                                                           
  If use eq 'SMS';   /* only keep sms volumes  */                   
Proc Sort;  By Storgrp;                                             
Proc Summary;                                                       
  Class Storgrp;                                                   
  Var Aloc_GB Capa_Gb Pct_Util Free_Cyl LExt_Cyl;                   
  Id date time;                                                     
  Output Out=VOLSUM                                                 
           N=Num_Vols                                               
           Max(LExt_Cyl)          = Larg_Ext                       
           Mean(Pct_Util Free_Cyl)= MeanPct  MeanFree               
           Sum(Capa_GB Aloc_Gb)   = Sum_Capa Sum_Aloc;             
                                                                   
/*---------------------------------------------------------------*/
Data Storgrp;                                                       
  Set VOLSUM;                                                       
  File ALRTLOG;                                                     
  %VOLSLAI;  /* SLA_Util for storage group set in macro  */         
  If MeanPct < SLA_Util Then Delete;                               
                                                                   
  Put @01 Date      date9.0                                         
      @11 Time      time5.0                                         
      @18 Storgrp      $8.0                                         
      @27 SLA_Util      3.0                                         
      @32 MeanPct       3.0                                         
      @38 '/'                                                       
      @41 Num_Vols      3.0                                         
      @48 Sum_Capa      4.0                                         
      @54 Sum_Aloc      4.0                                         
      @60 MeanFree      4.0                                         
      @67 Larg_Ext      4.0 ;                                       
                                                                   

.....................


and you can see VOLSLAI in the previous post where I made the change in SLA_UTIL but the code i think is not taking it because I am not getting an alert

If MeanPct < SLA_Util Then Delete;

The remaning part of POOLIMS is to shoot an email but the input is not there so it doesnt shoot...i.e. I think it doesn'ttake the SLA_UTIL properly...

Re: MACROS in JCL.

PostPosted: Thu Apr 22, 2010 12:24 am
by Robert Sample
This is a macro in SAS, not JCL. The JCL executes SAS which then invokes the macro.

Are you sure you have any values that would trigger?

Try adding this to your code:
Data Storgrp;
Set VOLSUM;
File ALRTLOG;
%VOLSLAI; /* SLA_Util for storage group set in macro */

FILE PRINT; PUT STORGRP= SLA_UTIL= MeanPct= ;

If MeanPct < SLA_Util Then Delete;
which will list the value of interest.

Re: MACROS in JCL.

PostPosted: Thu Apr 22, 2010 12:38 am
by Bad Man
numrecs=0 edate=. etime=. eof=1 Storgrp= Date=. Time=. _TYPE_=. _FREQ_=. Num_Vos=. Larg_Ext=. MeanPct=. MeanFree=. Sum_Capa=.
Sum_Aloc=. SLA_Util=. _ERROR_=1 _N_=1

I took this out of the code which I have been running...

A code which runs fine for me has these same values....The only change which I made in the code from the one that is running fine is change the value for SLA_UTIL and the macro name was changed and the same to reflect in the JCL/SAS.

Re: MACROS in JCL.

PostPosted: Thu Apr 22, 2010 1:22 am
by Robert Sample
Except the data you posted has no value for STORGRP, missing values for MeanPct and SLA_Util -- so that's pretty much guaranteed you're not going to trigger your condition.

Re: MACROS in JCL.

PostPosted: Thu Apr 22, 2010 1:33 am
by Bad Man
It is showing no values because it doesnt trigger... but it should trigger because the SLA_UTIL is lesser than meanpct.....

meanpct is 82% and SLA_UTIL is 60....

Re: MACROS in JCL.

PostPosted: Thu Apr 22, 2010 1:40 am
by Robert Sample
If meanpct is 82% then that is 0.82. You have SLA_Util set to 60. The last time I looked, 0.82 is less than 60.00 so why would it trigger?