/*------------------------------------------------------------------------*/
/* Sentinel package of SAS macros to assist for spawned(parallel) process */
/*                                                                        */
/*   List of macros included in package                                   */
/*     - IF_SPAWNED_SETUP ... setup specific env for spawned/non-spawned  */
/*                                                                        */
/*------------------------------------------------------------------------*/
/* CONTACT INFO:
/* Sentinel Coordinating Center
/* info@sentinelsystem.org
/*
/*-----------------------------------------------------------------------;
*'; *"; *); /**/;

%macro IF_SPAWNED_SETUP ;
   %put ..&sysmacroname.: |&=module|  |&=SPAWNED|  ;
   %if &SPAWNED %then %do ;

     options dlcreatedir;   /* [no]dlcreatedir --> [dis]allows folder creation */
                       /* Redirect the dplocal libref */
                       /* parent dplocal library name is dplocalo */
     libname dplocal ("&dplocal.module_&module.", "&dplocal") ;
     %let dplocalo=dplocalo ;

     %include "&INFOLDER.macros/soc_setup_macros.sas" /nosource2;

     %include "&INFOLDER.macros/scdm_standard_macros.sas" /nosource2;

   %end;
   %else %do ;    /* if not spawned(non-parallel) */
     %let dplocalo=dplocal ;
   %end;

   %if %upcase(&module) in ENR %then %do ;
     %include "&INFOLDER.macros/enr_overlap.sas" ;
   %end;

   %if not %eval(%upcase(&module) in &module_nospawn) %then %do ;
     %* run module specific L1 here ;
     %include "&INFOLDER.scdm_data_qa_review-level1.sas";
   %end;

%mend ;
%IF_SPAWNED_SETUP ;