<!---
This file is Copyright © 1998-2009 by Home Care Business Services. This work may not be reproduced, in whole or in part, 
using any medium, including, but not limited to, electronic transmission, CD-ROM or published in print, without the express 
permission of Home Care Business Services.

$Revision: 1.1 $
$Id: convert_oasisfiles.cfm,v 1.1 2009/10/21 21:39:30 arlen Exp $
$Date: 2009/10/21 21:39:30 $
--->

<cfset f_dir = "e:\wwwroot\exportdata\">
<cfset f_dir = "D:\inetpub\vhosts\rainbowsoftware.com\httpdocs\MHCB\">

<cfset stringlist1="Active on RFA:,Picture:,OASIS B Identifier:">
<cfset stringlist2="(* Indicates FATAL Error) ,-Revised list of RFAs to make field inactive on RFA 04 and 05. ,-Added new field. ,RFA 04 and 05. ,longer necessary. , accordingly. ,Version 1.60. ,discontinued.,on RFA 06. ,THERAPY_NEED). ,new fields. ,must be blank.,(zero).,blank.,assessment.,equal to 14.,follow-up assessment. ,Type:,use only.,HMO=1.,blanked out.,of 00.,blank.,out.,equal to 0.,03.,(blank).,equal 0.,to 0.,date.,Unknown ">

<cfloop index=ind list="oasisb.txt,oasisc.txt">
	<cffile action = "read"  file = "#f_dir##ind#" variable="data">
	<cfoutput>
	<h1>#f_dir##ind#</h1><br>
	<cfset data=mid(data,Find('REC_ID', data),len(data))>
	<table>
	<tr><th align=left>Start</th><th align=left>End</th><th align=left>Size</th><th align=left>Name</th><th align=left>Details</th></tr>
	<cfset loopexit=1>
	<cfloop condition = "loopexit not equal 0">
		<cfset loopexit=Find('Version Notes:',data)>
		<cfif ind eq "oasiscxxx.txt"><cfset loopexit=Find('OASIS B Identifier:',data)></cfif>
		
		<cfif loopexit>
			<cfset therecord=mid(data,1,loopexit-1)>

			<cfloop index=matchstring list="#stringlist1#" delimiters=','>
				<cfset i= find(matchstring,therecord)>
				<cfif i neq 0>
					<cfset therecord=mid(therecord,1,i-1)>
				</cfif>		
			</cfloop>

			<cfloop index=matchstring list="#stringlist2#" delimiters=','>
				<cfset i= find(matchstring,therecord)>
				<cfif i neq 0>
					<cfset therecord=mid(therecord,i+len(matchstring),len(therecord))>
				</cfif>		
				<cfset i= find(matchstring,therecord)>
				<cfif i neq 0>
					<cfset therecord=mid(therecord,i+len(matchstring),len(therecord))>
				</cfif>		
			</cfloop>
			<cfif len(trim(therecord)) neq 0>
				<cfset therecord = trim(therecord)>
				<cfif len(trim(therecord)) lte 10>
					<cfset therecord="* #therecord#">
					<cfset thename="*">
				<cfelse>
					<cfset thename=gettoken(therecord,1,' ')>
				</cfif>
				<cfset thetoken=gettoken(therecord,1,' ')>
				<cfset j=1>
				<cfloop condition="len(thetoken) not equal 0">
					<cfset j=j+1>
					<cfset thetoken=gettoken(therecord,j,' ')>
				</cfloop>
				<cfif j gte 4>
					<cfset thesize=gettoken(therecord,j-3,' ')>
					<cfset thestart=gettoken(therecord,j-2,' ')>
					<cfset theend=gettoken(therecord,j-1,' ')>
				<cfelse>
					<cfset thesize=0>
					<cfset thestart=0>
					<cfset theend=0>
				</cfif>
				<tr><td>#thestart#</td><td>#theend#</td><td>#thesize#</td><td>#thename#</td><td>#therecord#</td></tr>
			</cfif>

			<cfset data=mid(data,loopexit+len('Version Notes:'),len(data))>
		</cfif>
	</cfloop>
	</table>

	</cfoutput>
</cfloop>
