<%@ LANGUAGE="VBScript" %> <% start_time = Time %> Fastbus Map Text <% Dim fso, DataFile ndate=CStr(Request("ndate")) If Not IsEmpty(Request("sort_type")) Then sort_type=CStr(Request("sort_type")) Else sort_type="F" End If Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd SQLStmtx = "select count(fm.reqdate) nchannels,to_char(max(fml.reqdate),'mm/dd/yyyy hh24:mi:ss') reqdate, " SQLStmtx = SQLStmtx & " to_char(max(fml.crdate),'mm/dd/yyyy hh24:mi:ss') crdate " SQLStmtx = SQLStmtx & " from ASSEMBLY.FB_MAP fm ,ASSEMBLY.FB_MAP_LOG fml " SQLStmtx = SQLStmtx & " where fm.reqdate=fml.reqdate and fml.reqdate=to_date('" & ndate & "','YYYYMMDDHH24MISS') " ' response.write(SQLStmtx & "
" & vbCrLf) Set RSx = Connection.Execute(SQLStmtx) ' ' check how many channels are in the map, do not allow file larger than 10,000 channels ' channels=CDbl(RSx("nchannels")) nchannels=CStr(RSx("NCHANNELS")) If channels<10000 Then SQLStmty = "select to_char(SYSDATE,'mm/dd/yyyy hh24:mi:ss') ssdd from dual " ' response.write(SQLStmty & "
" & vbCrLf) Set RSy = Connection.Execute(SQLStmty) SQLStmt = "select fm.FB_CRATE,fm.FB_SLOT,fm.FB_CHANNEL,fm.ADC_TDC,fm.SENSOR,fm.POSITION, " SQLStmt = SQLStmt & " to_char(fml.REQDATE,'mm/dd/yyyy hh24:mi:ss') reqdate," SQLStmt = SQLStmt & " to_char(SYSDATE,'mm/dd/yyyy hh24:mi:ss') ssdd " SQLStmt = SQLStmt & " from ASSEMBLY.FB_MAP fm, ASSEMBLY.FB_MAP_LOG fml " SQLStmt = SQLStmt & " where fm.reqdate=fml.reqdate and fml.reqdate=to_date('" & ndate & "','YYYYMMDDHH24MISS') " If sort_type="S" Then SQLStmt = SQLStmt & " ORDER BY SENSOR,POSITION,ADC_TDC " Else SQLStmt = SQLStmt & " ORDER BY FB_CRATE,FB_SLOT,FB_CHANNEL " End If ' response.write(SQLStmt & "
" & vbCrLf) Set RS = Connection.Execute(SQLStmt) reqdate=CStr(RSx("REQDATE")) crdate=CStr(RSx("CRDATE")) sysdate=CStr(RSy("SSDD")) Set fso = CreateObject("Scripting.FileSystemObject") ' response.write(ph_image_directory & "
") Set DataFile = fso.CreateTextFile(ph_image_directory+"fb_map_phdb.txt", True) header = "#Full map valid at " & reqdate & " created at " & crdate & " written at " & sysdate & " with " & CStr(nchannels) & " channels " DataFile.WriteLine(header) header="#Crate" & vbTab & "Slot" & vbTab & "Channel" & vbTab & "ADC/TDC" & vbTab & "Sensor" & vbTab & "Position" DataFile.WriteLine(header) Do While Not RS.EOF sensor_entry= CStr(RS("FB_CRATE")) & vbTab sensor_entry=sensor_entry & CStr(RS("FB_SLOT")) & vbTab sensor_entry=sensor_entry & CStr(RS("FB_CHANNEL")) & vbTab sensor_entry=sensor_entry & CStr(RS("ADC_TDC")) & vbTab sensor_entry=sensor_entry & CStr(RS("SENSOR")) & vbTab sensor_entry=sensor_entry & CStr(RS("POSITION")) DataFile.WriteLine(sensor_entry) RS.Movenext Loop DataFile.Close Set Datafile=nothing set fso=nothing %>

Full FB map with <%=nchannels%> channels has been written to file fb_map_phdb.txt. The map is valid as of <%=reqdate %>. You must reload the map after you click on the link !

<% Else %>

Full connection map with <%=nchannels%> channels has NOT been written. The file would have been to large. The largest map that can be printed using this web page must have less than 10000 channels. Use Phat to access this map.

<% End If Set RS=nothing Set RSx=nothing Set RSy=nothing Connection.Close Set Connection=nothing %>