divout: PROCEDURE EXPOSE (dict$.exposestems)
PARSE ARG mode
CALL varserverini()
IF mode \= 'ZIP' THEN DO k= 1 TO dict$.variable_name.0
varname=dict$.variable_name.k
vardir=dict$.variable_dir.k
vartext=dict$.variable_text.k
IF testgetvar(varname'.UPDATE',0)\=1 THEN ITERATE
SAY ptime()' Save VARIABLE Table 'vartext' started'
INTERPRET 'DIVDUMP("'vardir'","'varname'",'varname'.,"'vartext'")'
SAY ptime()' Save VARIABLE Table 'vartext' completed'
END
ELSE DO
SAY ptime()' Save Dictionary Tables started'
CALL divzip(dict$.dirr,'divr$',divr$.,'Reference Table')
CALL divzip(dict$.diru,'divu$',divu$.,'Usage Table')
CALL divzip(dict$.dire,'dive$',dive$.,'Encode Table')
SAY ptime()' Save Dictionary Tables completed'
END
RETURN
divdump:
USE ARG dirs,pref,pool.,tabmsg
i=0
suffix=0
file=dirs||pref'.'suffix'.rex'
DO varn OVER pool.
i=i+1
IF i=1 THEN DO
DELETEFILE(file)
LINEOUT(file,'use arg 'pref'.')
END
line=VALUE(pref'.'varn)
IF POS("'",line)>0 THEN LINEOUT(file,pref'.'varn'="'VALUE(pref"."varn)'"')
ELSE LINEOUT(file,pref'.'varn"='"VALUE(pref'.'varn)"'")
IF i>=dict$.partsize THEN DO
i=0
LINEOUT(file,pref'.next_extension=1')
SAY ptime() tabmsg' Partition 'suffix' Saved'
LINEOUT(file)
suffix=suffix+1
file=dirs||pref'.'suffix'.rex'
END
END
LINEOUT(file,pref'.next_extension=0')
LINEOUT(file)
INTERPRET pref'.UPDATE=0'
SAY ptime() tabmsg' Partition 'suffix' Saved'
RETURN
divzip:
USE ARG dirs,pref,pool.,tabmsg
lino=0
suffix=1
DO varn OVER pool.
IF lino=0 THEN DO
writel('use arg 'pref'.')
END
line=VALUE(pref'.'varn)
IF POS("'",line)>0 THEN writel(pref'.'varn'="'VALUE(pref"."varn)'"')
ELSE writel(pref'.'varn"='"VALUE(pref'.'varn)"'")
IF lino>=dict$.partsize THEN DO
writel(pref'.next_extension=1')
zip.suffix=zipline
SAY ptime() tabmsg' Partition 'suffix' Saved'
lino=0
suffix=suffix+1
END
END
writel(pref'.next_extension=0')
zip.suffix=zipline
zip.0=suffix
DO i=1 TO suffix
file=dirs||pref'.'i'.Rex'
SAY file
CHAROUT(file,zip.i)
LINEOUT(file)
END
DROP zip.
SAY ptime() tabmsg' Partition 'suffix' Saved'
RETURN
writel:
USE ARG zipl
IF lino=0 THEN zipline=zipl
ELSE zipline=zipline||"0D0A"x||zipl
lino=lino+1
RETURN
ptime: PROCEDURE
ptime=TIME('l')
len=LENGTH(ptime)-3
RETURN SUBSTR(ptime,1,len)
testgetvar:
USE ARG tvar,default
default=ARG(2)
IF EXISTS(tvar)=0 THEN DO
tvar=TRANSLATE(tvar)
IF EXISTS(tvar)=0 THEN RETURN default
END
IF STRIP(VALUE(tvar))='' THEN RETURN default
RETURN VALUE(tvar)
|