/* rexx by e.duemig */ /* +----------------------------------------------------------------+ */ /* ! diese REXX loescht die Variablentabellen ! */ /* ! ohne loeschzeitraumangabe: den vorletzten monat ! */ /* ! mit loeschzeitraumangabe: den angegebenen monat oder den ! */ /* ! angegebenen zeitraum von bis ! */ /* ! Grundlage sind die im DDName KALNAME angegebenen Kalender ! */ /* ! Anpassung TME OPC 05.05.98 (Dmig) ! */ /* ! Anpassung auf 4-stellige Jahreszahlen ! */ /* +----------------------------------------------------------------+ */ /* */ trace off /* trace on/off */ arg subs vdat bdat /* get the date values */ out="RESOURCE=JV SUBSYS="subs /* set the first */ queue out /* pif-statement into */ "execio 1 diskw odd1" /* the output-dataset */ if rc>0 then exit rc /* error exit */ /* */ "execio * diskr kalname (stem tec. finis" /* read the kalendar */ "execio * diskr indd (stem in. finis" /* read the kalendar */ if rc>0 then exit rc /* printout */ drop kalok. /* clear var stem */ do v=1 to tec.0 /* set definded */ kt=word(tec.v,1) /* calendar names */ kalok.kt=1 /* to value 1 */ end /* */ "NEWSTACK" /* clear the stack */ o=0 /* set counter to zero */ do x=1 to in.0 /* do while data */ kalid=substr(in.x,2,11) /* find the kalendar-id */ if kalid="KALENDER-ID"then /* if right string */ do /* count the */ kna=strip(substr(in.x,28,16)) /* kalendar name */ if kalok.kna=1 then /* logic to compare with */ do /* ddname kalname */ o=o+1 /* new stem var for */ kn.o=kna /* kalendar name */ if kn.o="DEFAULT" then kn.o="" /* if .. set blank */ end end /* */ end /* from sysdate */ am=substr(date('s'),5,2) /* get the actual month */ ay=substr(date('s'),1,4) /* and the actual year */ if am<03 then /* if actual month */ do /* january or february */ ay=ay-1 /* set oldyear and set */ am=am+12 /* oldmonth + 12 month */ end /* */ om=right(am-2,2,"0") /* 2 month back */ oy = Right(ay,2) /* */ if vdat="" then call state /* no time parameter */ if vdat^="" & bdat="" then /* 1 time paramter for */ do /* one month to delete */ oy=substr(vdat,3,2) /* delete year */ om=substr(vdat,5,2) /* delete month */ call state /* call subprocedure */ end /* */ if bdat^="" then /* second time parameter */ do /* to delete from-to */ vyx=substr(vdat,1,4)*12 /* calc. fromdate to */ vmx=substr(vdat,5,2)+vyx /* months */ byx=substr(bdat,1,4)*12 /* calculate todate */ bmx=substr(bdat,5,2)+byx /* to months */ mte=bmx-vmx+1 /* find out del period */ do v=1 to mte /* ervery month of period*/ om=right(((vmx+v-1)//12),2,"0") /* calculate del month */ oy=abs((vmx+v-1)%12) /* calculate del year */ if om=00 then /* if no modulo rest */ do /* (example: 9500) */ om=12 /* set month to 12 */ oy=oy-1 /* and year is oldyear */ end /* */ oy = Right(oy,2) /* */ call state /* call subprocedure */ end /* */ end /* */ /* */ /* -------------------------------------------------------------------*/ do queued() /* */ "execio * diskw odd1 (finis" /* output dataset */ if rc>0 then exit rc /* */ end /* */ exit (rc) /* goodbye */ /* */ /* -------------------------------------------------------------------*/ state: /* */ do q=1 to o /* ervery kalendar */ do x=1 to 31 /* and 31 days */ od=right(x,2,"0") /* set the */ out="DELTABLE=T"oy""om""od""kn.q /* pif-statement */ queue out /* and queue it */ say out /* .. for joblob */ end /* */ end /* */ return /* */