2016-08-13 11 views
1

J'écris et j'utilise fréquemment des macros d'édition ISPF. Cependant, les invoquer au premier plan prend du temps. Puis-je utiliser un programme Rexx pour exécuter les macros d'édition sur tous les membres d'un PDS, ou une sélection de ceux-ci, par lot?Comment puis-je exécuter des macros d'édition ISPF dans le lot

+0

Répondez-vous à vos propres questions Mike? ;) –

+1

David, oui. Apparemment, c'est bien de le faire, car il est prévenant d'aider les autres et dans l'esprit de SO. – MikeT

Répondre

0

est ici une macro d'édition qui se déroulera une autre macro contre tous les membres d'un PDS:

/*REXX - Edit macro to invoke the same macro against all members */ 
/*  in the data set being edited.        */ 
/*  Syntax:             */ 
/*   ALLMEM macro prefix          */ 
/*    macro is the name of a macro to execute. If it  */ 
/*     is a program macro, remember to specify the */ 
/*     exclamation point before the name.    */ 
/*                 */ 
/*    prefix is an optional prefix to use when selecting */ 
/*     members to process. for example, ISR will */ 
/*     process all members starting with ISR.  */ 
/*                 */ 
/*  Note that the macro which this calls can have an   */ 
/*  ISREDIT END or ISREDIT CANCEL in it to avoid the display */ 
/*------------------------------------------------------------------*/ 
Address 'ISPEXEC' 
'ISREDIT MACRO (WORKMAC,PREFIX)' 
'ISREDIT (DATA1) = DATAID' 
'ISREDIT (THISONE) = MEMBER ' 
Address 'ISPEXEC' 'LMOPEN DATAID('data1') OPTION(INPUT)' 
parse upper var prefix prefix . 
member1='' 
Do Until lmrc\=0 
    Address 'ISPEXEC' 'LMMLIST DATAID('data1') OPTION(LIST)', 
        'MEMBER(MEMBER1) STATS(YES)' 
    lmrc = rc 
    If lmrc = 0   ,/* if member name returned     */ 
    & member1\=thisone ,/* and it isn't this member    */ 
    & (    ,/* and prefix check is ok...    */ 
     prefix=''  ,/* No prefix specified     */ 
     | substr(member1,1,length(prefix))=prefix,/* or prefix match*/ 
    ) Then 
    Do     /* invoke edit with specified initial macro*/ 
     Address 'ISPEXEC' 'CONTROL ERRORS CANCEL' 
     Address 'ISPEXEC' 'EDIT DATAID('data1')', 
       'MEMBER('member1') MACRO('workmac')' 
     Address 'ISPEXEC' 'CONTROL ERRORS CANCEL' 
    End 
End 
Address 'ISPEXEC' 'LMMLIST DATAID('data1') OPTION(FREE)' 
Address 'ISPEXEC' 'LMCLOSE DATAID('data1')' 
'ISREDIT DEFINE 'workmac' MACRO CMD' 
If prefix=''        ,/* No prefix specified */ 
    | substr(thisone,1,length(prefix))=prefix, /* or prefix match*/ 
    then 
    'ISREDIT 'workmac   /* perform macro for this member */ 

Il est pour une utilisation sous ISPF Afficher ou modifier, mais il pourrait être fait de travailler en lots, mais vous pouvez aussi le feu Il se détend et s'asseoit pendant qu'il exécute votre macro contre tous les PDS, vous évitant de devoir l'exécuter manuellement sur chaque membre.