home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power CD-ROM!! 7
/
POWERCD7.ISO
/
os2
/
etelr212
/
cnvtdatf.vrm
next >
Wrap
Text File
|
1994-08-12
|
4KB
|
116 lines
/**********************************************/
/* VX-Rexx macro to convert old .dat files */
/* Please do not modify */
/**********************************************/
/* Custom mainline for macro */
call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
call VRLoadFuncs
_VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
if( _VREVersion < 2.02 )then do
call VRMessage "", "This program requires VX-REXX version 2.0b to run.", "Error!"
return 32000
end
signal on SYNTAX name _VRESyntax
signal _VREMain
_VRESyntax:
parse source . . _VRESourceSpec
call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
exit 32000
_VREMain:
/*:VRX Main
*/
Main:
parse arg DatFile .
/***********************************************************\
This routine converts the [Credit]...[Charge] sections in
the info.dat and number.dat files so that a CCard transaction
bears the prefix 'C' and a Bank transaction, the prefix 'B'
\***********************************************************/
call stream DatFile, 'c', 'open'
call stream DatFile, 'c', 'seek =1'
B.0 = 0 /* Bank Account */
BCount = 1
C.0 = 0 /* CCard Account */
CCount = 1
do forever
if( lines( DatFile ) = 0 )then
leave
line = linein( DatFile )
if line = '[Credit]' then do
do forever
line = linein( DatFile )
if( lines( DatFile ) = 0 )then
leave
if( line = '' | line = '[Debit]' | line = '[Payment]' | line = '[Charge]' )then
leave
b.bcount = 'B'line
b.0 = bcount
bcount = bcount + 1
end
end
if line = '[Debit]' then do
do forever
line = linein( DatFile )
if( lines( DatFile ) = 0 )then
leave
if( line = '' | line = '[Credit]' | line = '[Payment]' | line = '[Charge]' )then
leave
if( POS( 'INFO.DAT', Translate( DatFile ) ) <> 0 )then do
parse var line info '$' amount '~' memo '^' cat
amount = '-'||amount
line = info'$'amount'~'memo'^'cat
drop info amount memo cat
end
b.bcount = 'B'line
b.0 = bcount
bcount = bcount + 1
end
end
if line = '[Payment]' then do
do forever
line = linein( DatFile )
if( lines( DatFile ) = 0 )then
leave
if( line = '' | line = '[Debit]' | line = '[Credit]' | line = '[Charge]' )then
leave
c.ccount = 'C'line
c.0 = ccount
ccount = ccount + 1
end
end
if line = '[Charge]' then do
do forever
line = linein( DatFile )
if( lines( DatFile ) = 0 )then
leave
if( line = '' | line = '[Credit]' | line = '[Payment]' | line = '[Debit]' )then
leave
if( POS( 'INFO.DAT', Translate( DatFile ) ) <> 0 )then do
parse var line info '$' amount '~' memo '^' cat
amount = '-'||amount
line = info'$'amount'~'memo'^'cat
drop info amount memo cat
end
c.ccount = 'C'line
c.0 = ccount
ccount = ccount + 1
end
end
end
call stream DatFile, 'c', 'close'
call VRDeleteFile DatFile
do i = 1 to b.0
call lineout DatFile, b.i
end
do i = 1 to c.0
call lineout DatFile, c.i
end
call stream DatFile, 'c', 'close'
exit