/*************************************************************************/
/*                       Wall Street Blues Maintenance                   */
/*                          AREXX Programming by                         */
/*                          Charles A. Van Tuyl                          */
/*                          aka Caesar, VTCaesar                         */
/*      $VER:Wall Street Blues, v4.1 (09-01-97) by Charles Van Tuyl      */
/*                           VTCaesar@iname.com                          */
/*************************************************************************/
bufferflush
options results
signal on syntax
tr=transmit;gu=getuser
dater=date();date=left(date(M),3);mdate=date;date=left(date(E),2)
ddate=date;ydate=right(dater,4)
call random(,,time('s'))
mm=50000                      /* <-Amount of cash before sending mail*/
WI=-99;PERW=-99;PERL=10000000000000000000000000
path='Pfiles:Stocks/'
path1='Pfiles:Stocks/Users/'
path2='Pfiles:Stocks/Companies/'
path3='Pfiles:Stocks/News/'
path4='Pfiles:Stocks/Days/'
path5='Pfiles:Stocks/Chance/'
call COMLOAD;call LOADALL

ne1='';ne2='';ne3='';ne4='';ne5='';ne6='';ne7='';ne8='';ne9=''
if AA=0 then ne1='c7Hales Business Associates is under new management!'
if AA=0 then AA=100
if AB=0 then ne2='c7Logsdon Realty Inc. is under new management!'        
if AB=0 then AB=100
if AC=0 then ne3='c7Netzel Mutual Funds is under new management!'
if AC=0 then AC=100
if AD=0 then ne4='c7Van Tuyl Development Company is under new management!'
if AD=0 then AD=100
if AE=0 then ne5='c7Allison Oil Drilling is under new management!'
if AE=0 then AE=100
if AF=0 then ne6='c7Wells Trucking Company is under new management!'
if AF=0 then AF=100
if AG=0 then ne7='c7Greene Automobile is under new management!'
if AG=0 then AG=100
if AH=0 then ne8='c7Miller Mining, Inc. is under new management!'
if AH=0 then AH=100
if AI=0 then ne9='c7Trumbo Electric Company is under new management!'
if AI=0 then AI=100

MAIN:
pick=random(1,36)
if pick=1 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Land rights litigation holds up progress.n2c3Allison Oil Drilling -10";AE=AE-10;call BEAR;end
if pick=2 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Businesses flourished during the last two months.n2c3Hales Business Assoc. +8n1Logsdon Realty Inc. +6n1Netzel Mutual Fund +6n1Greene Automobile +8";AA=AA+8;AB=AB+6;AC=AC+6;AG=AG+8;call BULL;end
if pick=3 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Unexpected fourth quarter earnings passed on to investors.n2c3Hales Business Assoc. +10";AA=AA+12;call BEAR;end
if pick=4 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Greene Automobile announces new model sports car.n2c3Greene Automobile +10";AG=AG+10;call BULL;end
if pick=5 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Large terminal destroyed by fire, three large trucks lost.n2c3Wells Trucking Company -26";AF=AF-26;call BEAR;end
if pick=6 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5National firm purchases Company's largest downtown office building.n2c3Logsdon Realty Inc. +6";AB=AB+6;call BULL;end
if pick=7 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Surge of profit taking drops market.n2c3Hales Business Assoc. -8n1Logsdon Realty Inc. -6n1Greene Automobile -8";AA=AA-8;AB=AB-6;AG=AG-8;call BEAR;end
if pick=8 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Major coal company announces surplus coal. Reduced coal prices affects electric companys stocks.n2c3Trumbo Electric Company +6";AI=AI+6;call BULL;end
if pick=9 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Worker strikes halt production in all Greene Automobile plants as UAW and Company officials fail to reach agreement on labor contract.n2c3Greene Automobile -16";AG=AG-16;call BEAR;end
if pick=10 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5OPEC negotiations promote mixed activity on Wall Street.n2c3Netzel Mutual Fund -8n1Allison Oil Drilling +8n1Miller Mining, Inc. +6";AC=AC-8;AE=AE+8;AH=AH+6;call BULL;end
if pick=11 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Company adds a new fleet and expands business.n2c3Wells Trucking Company +6";AF=AF+6; call BEAR;end
if pick=12 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Two for one split rumored.n2c3Greene Automobile +10";AG=AG+10; call BULL;end
if pick=13 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Fire strikes a large apartment complex causing great damage.n2c3Van Tuyl Development Company -6";AD=AD-6;call BEAR;end
if pick=14 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Company announces expansion plans into new area.n2c3Greene Automobile +16";AG=AG+16;call BULL;end
if pick=15 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Company's request for rate hikes rejected.n2c3Trumbo Electric Company -14";AI=AI-14;call BEAR;end
if pick=16 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Company faced with decreasing sales.n2c3Hales Business Assoc. -10";AA=AA-10;call BULL;end
if pick=17 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Major oil well runs dry.n2c3Allison Oil Drilling -16";AE=AE-16;call BEAR;end
if pick=18 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Company lands deal with large corporation for shipping automotive parts.n2c3Wells Trucking Company +16";AF=AF+16;call BULL;end
if pick=19 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Competitor invents a new economical car.n2c3Greene Automobile -6";AG=AG-6;call BEAR;end
if pick=20 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Surge in buying causes a general increase in stocks.n2c3Netzel Mutual Fund +4n1Trumbo Electric Company +4";AC=AC+4;AI=AI+4;call BULL;end
if pick=21 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Coal miners go on strike!n2c3Miller Mining, Inc. -26";AH=AH-26;call BEAR;end
if pick=22 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Development company announces plans for a new condiminium building.n2c3Van Tuyl Developement Company +6";AD=AD+6;call BULL;end
if pick=23 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5President hospitalized at Bellvue Mental Hospital for an indefinite period.n2c3Wells Trucking Company -6";AF=AF-6;call BEAR;end
if pick=24 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5New nuclear power plant built provides unexpected savings.n2c3Trumbo Electric Company +6";AI=AI+6;call BULL;end
if pick=25 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Home buying down during the last 6 months.n2c3Logsdon Realty Inc. -6";AB=AB-6;call BEAR;end
if pick=26 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5New holdings show large potential for profit.n2c3Hales Business Assoc. +10";AA=AA+10;call BULL;end
if pick=27 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Airport buys large property for expansion.n2c3Logsdon Realty Inc. +10";AB=AB+10;call BEAR;end
if pick=28 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Expansion of nuclear power stations likely. Electrical power companies investigating nuclear power plants.n2c3Miller Mining, Inc. +10";AH=AH+10;call BULL;end
if pick=29 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Flood! Hundreds of homes damaged.n2c3Logsdon Realty Inc. -10";AB=AB-10;call BEAR;end
if pick=30 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Advertising campaign gains Company four major, long-term contracts.n2c3Wells Trucking Company +10";AF=AF+10;call BULL;end
if pick=31 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5President, Vice-President and Chief Counsel of Hales Business Associates resign following rumors of a scandal.n2c3Hales Business Assoc. -10";AA=AA-10;call BEAR;end
if pick=32 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Company finds huge, ore deposits. New mines are being built.n2c3Miller Mining +10";AH=AH+10;call BULL;end
if pick=33 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Stockholders of the Corporation disagree on policy. One sells out his entire stockholdings.n2c3Hales Business Assoc. -8";AA=AA-8;call BEAR;end
if pick=34 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5New oil field found. Promises to be the largest in North America.n2c3Allison Oil Drilling +18";AE=AE+18;call BULL;end
if pick=35 then do ne="f1n1c1>9>9>9>4BEAR MARKET!c2n1>5Competitor advertising campaign raises sales.n2c3Greene Automobile -6";AG=AG-6;call BEAR;end
if pick=36 then do ne="f1n1c3>9>9>9>4BULL MARKET!c2n1>5Company earnings up during 3rd quarter.n2c3Hales Business Assoc. +8";AA=AA+8;call BULL;end
call MAIN

BULL:
tr 'c3Choosing Bull market stats'
die1=random(1,6);die2=random(1,6);di=die1+die2
IF DI=2 then do AA=AA-2;AB=AB-10;AC=AC-8;AD=AD-10;AE=AE-2;AF=AF-10;AG=AG-8;AH=AH-16;AI=AI-4;call COMSAVE;end
IF DI=3 THEN do AA=AA+26;AB=AB+16;AC=AC+26;AD=AD+8;AE=AE-14;AF=AF+22;AG=AG+14;AH=AH-4;AI=AI+18;call COMSAVE;end
IF DI=4 THEN do AA=AA+18;AB=AB+24;AC=AC+12;AD=AD+12;AE=AE+46;AF=AF+18;AG=AG-6;AH=AH+34;AI=AI+16;call COMSAVE;end
IF DI=5 THEN do AA=AA+24;AB=AB+28;AC=AC-2;AD=AD+12;AE=AE+56;AF=AF+20;AG=AG+30;AH=AH+30;AI=AI+14;call COMSAVE;end
IF DI=6 THEN do AA=AA+20;AB=AB+16;AC=AC+16;AD=AD+8;AE=AE-20;AF=AF+16;AG=AG+14;AH=AH-10;AI=AI+12;call COMSAVE;end
IF DI=7 THEN do AA=AA+18;AB=AB+22;AC=AC+14;AD=AD-2;AE=AE+38;AF=AF+24;AG=AG+24;AH=AH+20;AI=AI+14;call COMSAVE;end
IF DI=8 THEN do AA=AA+20;AB=AB+24;AC=AC+18;AD=AD+10;AE=AE-6;AF=AF+26;AG=AG+14;AH=AH-8;AI=AI+16;call COMSAVE;end
IF DI=9 THEN do AA=AA+12;AB=AB+18;AC=AC+14;AD=AD+12;AE=AE+68;AF=AF+16;AG=AG+22;AH=AH+18;AI=AI+14;call COMSAVE;end
IF DI=10 THEN do AA=AA+14;AB=AB+32;AC=AC+2;AD=AD+14;AE=AE-12;AF=AF+18;AG=AG+18;AH=AH-14;AI=AI+10;call COMSAVE;end
IF DI=11 THEN do AA=AA+14;AB=AB-8;AC=AC+20;AD=AD-2;AE=AE-10;AF=AF+26;AG=AG-10;AH=AH+14;AI=AI+20;call COMSAVE;end
IF DI=12 THEN do AA=AA+24;AB=AB+24;AC=AC+24;AD=AD+20;AE=AE+52;AF=AF+28;AG=AG+38;AH=AH+34;AI=AI+18;call COMSAVE;end

BEAR:
tr 'c1Choosing Bear market stats'
die1=random(1,6);die2=random(1,6);di=die1+die2
IF DI=2 then do AA=AA+12;AB=AB+14;AC=AC+14;AD=AD+10;AE=AE+10;AF=AF+20;AG=AG+22;AH=AH+26;AI=AI+8;call COMSAVE;end
IF DI=3 THEN do AA=AA+8;AB=AB-6;AC=AC+10;AD=AD-10;AE=AE+30;AF=AF+6;AG=AG-20;AH=AH+22;AI=AI-2;call COMSAVE;end
IF DI=4 THEN do AA=AA+10;AB=AB+10;AC=AC+8;AD=AD-6;AE=AE-20;AF=AF+12;AG=AG+22;AH=AH+18;AI=AI+8;call COMSAVE;end
IF DI=5 THEN do AA=AA+8;AB=AB+8;AC=AC+6;AD=AD-6;AE=AE-40;AF=AF+4;AG=AG+16;AH=AH-14;AI=AI+4;call COMSAVE;end
IF DI=6 THEN do AA=AA+8;AB=AB+6;AC=AC+4;AD=AD-4;AE=AE+40;AF=AF+8;AG=AG+4;AH=AH-12;AI=AI+4;call COMSAVE;end
IF DI=7 THEN do AA=AA+6;AB=AB+4;AC=AC+4;AD=AD+4;AE=AE-16;AF=AF+6;AG=AG+8;AH=AH-8;AI=AI+6;call COMSAVE;end
IF DI=8 THEN do AA=AA+6;AB=AB+8;AC=AC-2;AD=AD-4;AE=AE+46;AF=AF+6;AG=AG-10;AH=AH+10;AI=AI+4;call COMSAVE;end
IF DI=9 THEN do AA=AA-2;AB=AB+6;AC=AC-4;AD=AD-8;AE=AE-20;AF=AF+8;AG=AG+10;AH=AH+14;AI=AI+6;call COMSAVE;end
IF DI=10 THEN do AA=AA+12;AB=AB+12;AC=AC-6;AD=AD-8;AE=AE+30;AF=AF+10;AG=AG-12;AH=AH-18;AI=AI-4;call COMSAVE;end
IF DI=11 THEN do AA=AA-6;AB=AB+14;AC=AC-8;AD=AD+6;AE=AE+26;AF=AF+4;AG=AG+18;AH=AH-22;AI=AI-4;call COMSAVE;end
IF DI=12 THEN do AA=AA-8;AB=AB-10;AC=AC-10;AD=AD-16;AE=AE-20;AF=AF-20;AG=AG-24;AH=AH-25;AI=AI-8;call COMSAVE;end

COMLOAD:
tr 'c5Loading company stats'
signal off error;open(file,path2||Prices,'R')
AA=readln(file);AB=readln(file);AC=readln(file);AD=readln(file);AE=readln(file);AF=readln(file);AG=readln(file);AH=readln(file);AI=readln(file)
close(file); signal on error
return

COMSAVE:
if AA<=0 then AA=0
if AB<=0 then AB=0
if AC<=0 then AC=0
if AD<=0 then AD=0
if AE<=0 then AE=0
if AF<=0 then AF=0
if AG<=0 then AG=0
if AH<=0 then AH=0
if AI<=0 then AI=0
tr 'c5Checking for Bankrupts';call BANKRUPT
tr 'c5Doing player accounting';tr'c7********************************c3';call PLAYER
tr 'c5Checking for stock splits';call SPLIT
tr 'c5Getting updated news';call NEWS
tr 'c5Saving company prices'
signal off error;open(file,path2||'Prices','W')
writeln(file,AA);writeln(file,AB);writeln(file,AC);writeln(file,AD);writeln(file,AE);writeln(file,AF);writeln(file,AG);writeln(file,AH);writeln(file,AI)
close(file);signal on error
call SAVEPERW;call SAVEPERL;call SAVEWW;call DAYSAVE
exit

NEWS:
signal off error;call open(file,path3||'ne1.data','W')
writeln(file,ne1);call close file; signal on error
signal off error;call open(file,path3||'ne2.data','W')
writeln(file,ne2);call close file; signal on error
signal off error;call open(file,path3||'ne3.data','W')
writeln(file,ne3);call close file; signal on error
signal off error;call open(file,path3||'ne4.data','W')
writeln(file,ne4);call close file; signal on error
signal off error;call open(file,path3||'ne5.data','W')
writeln(file,ne5);call close file; signal on error
signal off error;call open(file,path3||'ne6.data','W')
writeln(file,ne6);call close file; signal on error
signal off error;call open(file,path3||'ne7.data','W')
writeln(file,ne7);call close file; signal on error
signal off error;call open(file,path3||'ne8.data','W')
writeln(file,ne8);call close file; signal on error
signal off error;call open(file,path3||'ne9.data','W')
writeln(file,ne9);call close file; signal on error
signal off error;call open(file,path3||'ne.data','W')
writeln(file,ne);call close file; signal on error
return
end

BANKRUPT:
if AA=0 then ne1='c1Hales Business Assoc. has gone bankrupt!'
if AB=0 then ne2='c1Logsdon Realty Inc. has gone bankrupt!'
if AC=0 then ne3='c1Netzel Mutual has gone bankrupt!'
if AD=0 then ne4='c1Van Tuyl Development Company has gone bankrupt!'
if AE=0 then ne5='c1Allison Oil Drilling has gone bankrupt!'
if AF=0 then ne6='c1Wells Trucking has gone bankrupt!'
if AG=0 then ne7='c1Greene Automobile has gone bankrupt!'
if AH=0 then ne8='c1Miller Mining has gone bankrupt!'
if AI=0 then ne9='c1Trumbo Electric Co. has gone bankrupt!'
return
end

SPLIT:
if AA>=200 then ne1='c2Hales Business Assoc. stock has split 2 for 1!'
if AB>=200 then ne2='c2Logsdon Realty Inc. stock has split 2 for 1!'
if AC>=200 then ne3='c2Netzel Mutual stock has split 2 for 1!'
if AD>=200 then ne4='c2Van Tuyl Development Company stock has split 2 for 1!'
if AE>=200 then ne5='c2Allison Oil Drilling stock has split 2 for 1!'
if AF>=200 then ne6='c2Wells Trucking stock has split 2 for 1!'
if AG>=200 then ne7='c2Greene Automobile stock has split 2 for 1!'
if AH>=200 then ne8='c2Miller Mining stock has split 2 for 1!'
if AI>=200 then ne9='c2Trumbo Electric Co. stock has split 2 for 1!'
if AA>=200 then do;x=AA/2;call CUTIT;AA=x;end
if AB>=200 then do;x=AB/2;call CUTIT;AB=x;end
if AC>=200 then do;x=AC/2;call CUTIT;AC=x;end
if AD>=200 then do;x=AD/2;call CUTIT;AD=x;end
if AE>=200 then do;x=AE/2;call CUTIT;AE=x;end
if AF>=200 then do;x=AF/2;call CUTIT;AF=x;end
if AG>=200 then do;x=AG/2;call CUTIT;AG=x;end
if AH>=200 then do;x=AH/2;call CUTIT;AH=x;end
if AI>=200 then do;x=AI/2;call CUTIT;AI=x;end
return
end

PLAYER:
GCA=0;MPA=0;PMA=0;SBA=0;SDA=0;GTA=0;UAA=0;UEA=0;GPA=0;GBA=0
signal off error;call open(file,Path||'ST.data','R');ST=readln(file);call close file;signal on error
signal off error;call open(sfile,Path||'U3','R')
do ox=1 to st
null=seek(sfile,(st-ox)*33,'B');inn=readln(sfile)
name=trim(substr(inn,13,20));call load
tr 'c5Loading and processingc2 'name'c3'
AJ=1000;LBO=BL
BA=AA*GC;CA=CA+GC
if BA<=0 then GC=0
if AA>=200 then GC=GC*2
BB=MP*AB
if BB<=0 then MP=0
if AB>=200 then MP=MP*2
BC=PM*AC
if BC<=0 then PM=0
CA=CA+PM*4
if AC>=200 then PM=PM*2
BD=SB*AD
if BD<=0 then SB=0
CA=CA+SB*7
if AD>=200 then SB=SB*2
BE=SD*AE
if BE<=0 then SD=0
if AE>=200 then SD=SD*2
BF=GT*AF
if BF<=0 then GT=0
if AF>=200 then GT=GT*2
BG=UA*AG
if BG<=0 then UA=0
CA=CA+UA*2
if AG>=200 then UA=UA*2
BH=UE*AH
if BH<=0 then UE=0
CA=CA+UE*6
if AH>=200 then UE=UE*2
BI=GP*AI
if BI<=0 then GP=0
CA=CA+GP*3
if AI>=200 then GP=GP*2
GCA=GCA+GC;MPA=MPA+MP;PMA=PMA+PM;SBA=SBA+SB;SDA=SDA+SD;GTA=GTA+GT;UAA=UAA+UA;UEA=UEA+UE;GPA=GPA+GP;GBA=GBA+GB
BJ=GB*AJ;CA=CA+GB*50;BL=BA+BB+BC+BD+BE+BF+BG+BH+BI+BJ;BL=BL+CA;CA=CA+5000;BL=BL+5000
tr 'Yestedray''s Net Worth : 'LBO
tr 'Today''s Net Worth     : 'BL
LBP=BL*100/LBO
if LBP~=0 then LBP=LBP-100
LBP=trim(substr(LBP,1,4))
tr 'Percent Change        : 'LBP'%'
tr 'c7********************************c3'
call FINDPERW;call FINDPERL;call FINDW;call FINDALL
if CA>=mm then do
FINDACCOUNT name;id=Result
CLEAREDITOR;SETMAILSUBJ "c3News from Wall Street.c1 Invest!c7 You currently have c3$"CA
WRITEMAIL id;CLEAREDITOR;Transmit 'c7MAIL SENT TO 'name
end
signal off error;open(file,Path1||name,'W')
writeln(file,GC);writeln(file,MP);writeln(file,PM);writeln(file,SB);writeln(file,SD);writeln(file,GT);writeln(file,UA);writeln(file,UE);writeln(file,GP);writeln(file,GB);writeln(file,CA);writeln(file,BL);writeln(file,LBP)
close(file);signal on error
end
call SOLDS
return

FINDPERW:
if LBP>PERW then do;PERW=LBP;WPW=name;end
return

FINDPERL:
if LBP<PERL then do;PERL=LBP;WPL=name;end
return

FINDW:
if BL>WI then do;WI=BL;WW=name;end
return

FINDALL:
if BL>AL then do;AL=BL;WT=name;call SAVEALL;end
return

DAYSAVE:
if ~exists(path4||ddate) then do
signal off error;open(file,path4||ddate,'W')
writeln(file,WW);writeln(file,WI)
close(file);signal on error
end

if exists(path4||ddate) then do
call DAYLOAD
if WIP>WI then break
signal off error;open(file,path4||ddate,'W')
writeln(file,WW);writeln(file,WI)
close(file);signal on error
end
return

DAYLOAD:
signal off error;open(file,path4||ddate,'R')
WWP=readln(file);WIP=readln(file)
close(file);signal on error
if ddate=1 then WWP='no one'
if ddate=1 then WIP=0
return

SOLDS:
signal off error;open(file,Path||'SOLD','W')
writeln(file,GCA);writeln(file,MPA);writeln(file,PMA);writeln(file,SBA);writeln(file,SDA);writeln(file,GTA);writeln(file,UAA);writeln(file,UEA);writeln(file,GPA);writeln(file,GBA)
close(file);signal on error
return

SAVEWW:
signal off error;open(file,Path||'Winning','W')
writeln(file,WW);writeln(file,WI)
close(file);signal on error
signal off error;open(file,Path||'WinningAW','W')
writeln(file,WW);writeln(file,WI)
close(file);signal on error
return

SAVEPERW:
signal off error;open(file,Path||'PERCENTW','W')
STRG1=''WPW' with 'PERW'%';writeln(file,STRG1)
close(file);signal on error
return

SAVEPERL:
signal off error;open(file,Path||'PERCENTL','W')
STRG2=''WPL' with 'PERL'%';writeln(file,STRG2)
close(file);signal on error
return

SAVEALL:
dddate=ddate;rdate=mdate;rydate=ydate
if date=1 then do
rydate=ydate
if mdate='Jan' then do;rdate='Dec';dddate=31;rydate=rydate-1;end
if mdate='Feb' then do;rdate='Jan';dddate=31;end
if mdate='Mar' then do;rdate='Feb';dddate=28;end
if mdate='Apr' then do;rdate='Mar';dddate=31;end
if mdate='May' then do;rdate='Apr';dddate=30;end
if mdate='Jun' then do;rdate='May';dddate=31;end
if mdate='Jul' then do;rdate='Jun';dddate=30;end
if mdate='Aug' then do;rdate='Jul';dddate=31;end
if mdate='Sep' then do;rdate='Aug';dddate=31;end
if mdate='Oct' then do;rdate='Sep';dddate=30;end
if mdate='Nov' then do;rdate='Oct';dddate=31;end
if mdate='Dec' then do;rdate='Nov';dddate=30;end
end
signal off error;open(file,Path||ALL,'W')
sdate=dddate' 'rdate' 'rydate
writeln(file,WT);writeln(file,AL);writeln(file,sdate)
close(file);signal on error
return

LOADALL:
if ~exists(path||'ALL') then do
signal off error;open(file,Path||ALL,'W')
sdate=dddate' 'rdate' 'rydate;WT='Caesar';AL=1000
writeln(file,WT);writeln(file,AL);writeln(file,sdate)
close(file);signal on error
end
if exists(path||'ALL') then do
signal off error;open(file,Path||ALL,'R')
LOP=readln(file);AL=readln(file);sdate=readln(file)
close(file);signal on error
end
return

LOAD:
signal off error;open(file,Path1||name,'R')
GC=readln(file);MP=readln(file);PM=readln(file);SB=readln(file);SD=readln(file);GT=readln(file);UA=readln(file);UE=readln(file);GP=readln(file);GB=readln(file);CA=readln(file);BL=readln(file);writeln(file,LBP)
close(file);signal on error
return

CUTIT:
IF x<10 THEN x=LEFT(x,1)
IF x>9 THEN DO
IF x<100 then x=LEFT(x,2) 
END
IF x>99 then DO
IF x<1000 THEN x=LEFT(x,3)
END
IF x>999 then DO
IF x<10000 THEN x=LEFT(x,4)
END
IF x>9999 then DO
IF x<100000 THEN x=LEFT(x,5)
END
IF x>99999 then DO
IF x<1000000 THEN x=LEFT(x,6)
END
IF x>999999 then DO
IF x<10000000 THEN x=LEFT(x,7)
END
IF x>9999999 then DO
IF x<100000000 THEN x=LEFT(x,8)
END
RETURN

SYNTAX:
Tr 'c1Error:' errortext(rc) 'in line 'SIGL'.';shutdown;end;exit
