home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
bagmak10.zip
/
BAGMAKE.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1995-12-03
|
7KB
|
220 lines
/* make new .bag file for pmmail from *.msg*/
/*
Rexx for OS/2
Program written by:
Jerry L. Rowe, 12/1/95
Marion, IN USA
jlrowe@holli.com, IMJerry@aol.com
[Team OS/2, IBM BESTeam]
This Rexx script is for PMMail 1.x.
The purpose is the re-create the [foldername].bag files with exist in the
x:\PMMail directory. These files can become corrupted, erased, inaccurate,
or whatever. The messages will still exist, but the list of them [the
bagfile] may be wrong. This script is my attempt at fixing them. The
script is the result of work due to lost bagfiles on my own system.
It creates the bag files, but leaves them in the x:\PMMail\folders
directory. It is up to the user to copy them to x:\PMMail since doing so
will erase the existing files. I suggest that you back up the existing files
first.
It should be executed from the
x:\PMMail
directory on your hard disk, or whatever directory your PMMail is
installed in.
You can execute the script by:
bagmake [enter] (to make all of the files)
or
bagmake [foldername] [Enter] (to make just one)
As a bonus, it also makes FOLDERS.TXT, which is an emergency replacement
for FOLDERS.INI in case that file has been lost. Long folder names [the
first occurence of the name in the file] as used in PMMail are NOT recreated
since there is no way of knowing them. You can edit this file with a text
editor to change that if you want.
Cheers,
Jerry
*/
folderini=''
outline=''
inline=''
eline=''
infile=''
mdate=''
mtime=''
mmsg=''
email=''
ename=''
mfile=filein
msep=x2c('DE')
mread=x2c('59E1')
munread=x2c('4EE1')
mmon=''
mday=''
myr=''
totalfiles=0
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
Parse arg folder
if folder='' then do
folder='folders\*.'
folderini='folders.txt'
end
call sysfiletree folder,"filedir",'DO'
if filedir.0=0 then do
say 'Directory not found, exiting...'
exit
end
else
if filedir.0 \= 0 then do
if folderini\='' then
rc=lineout(folderini,,1)/* open folders.txt */
do Q= 1 to filedir.0
if folderini\='' then do /* Add items to folder.txt[ini] */
folderitem=delstr(filedir.Q,1,lastpos('\',filedir.Q))
rc=sysfiledelete(folderini)
rc=lineout(folderini,folderitem)
rc=lineout(folderini,folderitem)
rc=lineout(folderini,n)
end
outfile=filedir.Q||'.bag'
say 'Creating bagfile: 'outfile
call processfiles
end
end
if folderini\='' then do
rc=lineout(folderini) /* close FOLDERS.TXT if open */
end
Say 'Finished, Total Msg files processsed: ' totalfiles
exit /* program */
processfiles:
call sysfiletree filedir.Q||"\*.*","file",'FO'
if file.0 \= 0 then do
totalfiles=totalfiles+file.0
rc=sysfiledelete(outfile)
rc=lineout(outfile,,1)
rc=lineout(outfile,file.0)
parse value syscurpos() with row col
say row col
if row=24 then row = 23
do I= file.0 to 1 by -1
/* trace commands */
cp=syscurpos(row,col)
say 'MsgFile #: 'Q'-'I' '
call readfile
call putbagline
rc=lineout(file.i) /* close infile */
end
rc=lineout(outfile) /* close outfile */
end
else
say "No msg files found"
return
putbagline:
rc=lineout(outfile,outline)
return
sayfile:
/* say 'File: 'file.i
say 'reading'
say 'date: 'mdate
say 'email='email
say ' ename='ename
say 'Subject: 'mmsg
say 'OutLine:'Outline
*/
say i': 'Outline
say
return
Readfile:
rc=linein(file,I,0)
/* trace off
say 'Lines ('file.I')#: 'lines(file.I) */
inline='a'
do while ((lines(file.I)>0) & (length(inline)>0))
inline=linein(file.I)
eline=inline
/* say 'Line: 'eline */
select
when pos('From: ',eline)=1 then do
eline=delstr(eline,1,6)
tn=0
do until tw=''
tn=tn+1
tw=word(eline,tn)
if pos('@',tw)>0 then do
email=tw
emailn=pos(email,eline)
ename=strip(delstr(eline,emailn,length(email)))
if pos('<',email)=1 then do
email=delstr(email,1,1)
email=left(email,length(email)-1)
end
emailn=tn
end /* if */
end /* do */
end /* do */
when pos('Subject: ',eline)=1 then do
mmsg=strip(delstr(eline,1,9))
mmsg=strip(left(mmsg,34))
end /* do */
when pos('Date: ',eline)=1 then do
parse upper var eline intro wkday mday mmonth myr mtime gmt
if datatype(wkday,N)=1 then
parse upper var eline intro mday mmonth myr mtime gmt
if length(myr)=4 then
myr=right(myr,2)
mtime=translate(mtime,'0123456789 ','0123456789:')
parse var mtime mhr mmin msec
mhr=right(mhr,2,'0')
mmin=right(mmin,2,'0')
msec=right(msec,2,'0')
mtime=mhr||':'||mmin||':'||msec
select
when mmonth='JAN' then mmon='01'
when mmonth='FEB' then mmon='02'
when mmonth='MAR' then mmon='03'
when mmonth='APR' then mmon='04'
when mmonth='MAY' then mmon='05'
when mmonth='JUN' then mmon='06'
when mmonth='JUL' then mmon='07'
when mmonth='AUG' then mmon='08'
when mmonth='SEP' then mmon='09'
when mmonth='OCT' then mmon='10'
when mmonth='NOV' then mmon='11'
when mmonth='DEC' then mmon='12'
otherwise mmon=''
end
end
otherwise
end
end
if length(mmon) = 1 then mmon='0'||mmon
if length(mday) = 1 then mday='0'||mday
if length(mtime) =5 then mtime=mtime||':00'
mdate=myr || '-' || mmon || '-' || mday
infile=right(file.i,length(file.i)-lastpos('\',file.i))
infile=translate(infile,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
outline=mdate||msep||mtime||msep||mmsg||msep||ename||msep||email||msep||infile||msep||mread
return