home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-17 | 58.1 KB | 2,401 lines |
- /* RXDbase front end 2.4 */
-
-
- /*
- HUGE DISCLAIMER: this source is here only for the purpose
- of giving you the possibility to enhance MaxBase.
- PLEASE, don't complain about how it is programmed,
- it was never intended to be shown to anyone and,
- as it's in beta, it has some points which have not
- been cleaned up. And, comments are very rare.
- I will include more comments along the way.
-
- - - - - N O T E - - - -
-
- The only thing I ask you is that if you do enhance this
- program or correct bugs, you should send me a copy
- of the modfications so I will include the additions
- in the next versions of the RXDbase package.
- */
-
- import ScrollPanel
- import RXDbase
- import RXFile
-
- Class MaxBase extends Frame
-
- properties private
-
- dbMine = RXDbase()
-
- iOldPage = int 0
- iDeleted = int
-
- /* Current Index */
- iIdx = int 0
-
- /* For the deletion operations */
- iDelArc = int[]
- iDelVis = int[]
-
- /* Used to store LOADREC data */
- rRecArr = Rexx[,]
- rRecArr2 = Rexx[,]
- rShowed = Rexx
- rDbStats = Rexx[]
- rFilter = Rexx ""
-
- /* strings used in the DB */
-
- rTXTFileNotPresent = Rexx "File does not exist. Returning."
- rTXTEnd = Rexx "Conversion: finished."
- rTXTChoose = Rexx "Choose a database (.dat)"
- rTXTChooseDBF = Rexx "Choose a database (.dbf)"
- rTXTNoDb = Rexx "One-line view - no database loaded"
- rTXTOneLine = Rexx "One-line view for database "
- rTXTActRec = Rexx " active records; "
- rTXTShowHere = Rexx " showed here"
- rTXTMissInfo = Rexx "Field not added. Missing informations."
- rTXTName = Rexx "Field not added. Field length must be non-negative, name must be valid."
- rTXTWrkFld = Rexx "Currently working on Field "
- rTXTPickName = Rexx "Pick a name for the db (no extension)"
- rTXTMInfo = Rexx "Can't save. Missing informations for this field."
- rTXTMName = Rexx "Can't save. Field length must be non-negative, name must be valid."
- rTXTNoIndex = Rexx "Can't save. At least a field must have an index."
- rTXTBigger = Rexx "Can't save. File name is bigger than 4 characters."
- rTXTFileExists = Rexx "Can't save. File exists."
- rTXTSaved = Rexx "Succesfully saved. Hit 'Cancel' to return to db browsing."
- rTXTFindInfo = Rexx "Separate filter conditions with the .&. token"
- rTXTFindTitle = Rexx "You are defining the filter conditions. (Empty = resets them)"
- rTXTOrderTitle = Rexx "Select a field to order the database by."
- rTXTFldDelTitle = Rexx "Select a field to be deleted."
- rTXTModIdxTitle = Rexx "Select the field whose indexing strategy has to be modified."
- rTXTIdxStratTitle = Rexx "Select the new indexing strategy for the chosen field."
- rTXTDelDb = Rexx "You are going to delete the current database."
- rTXTDelDbInfo = Rexx "Press 'yes' to continue, 'Tools..' to return to the Tools panel."
- rTXTRDel1 = Rexx "You are going to delete the selected record."
- rTXTRDel2 = Rexx "You are going to delete the "
- rTXTRDel3 = Rexx " selected records."
- rTXTRDel4 = Rexx "Press 'yes' to continue, 'cancel' to cancel the operation."
- rTXTWarning = Rexx "Warning!"
- rTXTCurWork = Rexx "Currently working on Field 1/99"
- rTXTCreateDb = Rexx "You are creating a new database."
- rTXTAddFld = Rexx "Adding a field to the current DB"
- rTXTAddFldTitle = Rexx "You are adding a field to the current DB."
- rTXTRecAdd = Rexx "Form View (adding a record)"
- rTXTRecMod = Rexx "Form View (modifying this record)"
- rTXTRecBrowse = Rexx "Form View (just browsing)"
- rTXTSelPage = Rexx "Select another page to see the remaining fields."
- rTXTStore = Rexx "Select 'Store' to save data (if not browsing), 'Cancel' to abort."
- rTXTCantAdd1 = Rexx "Can't add. Missing informations for this field."
- rTXTCantAdd2 = Rexx "Can't add. Field length must be non-negative, name must be valid."
- rTXTIdxNONE0 = Rexx "NONE (NULL values to be accepted)"
- rTXTIdxNONE1 = Rexx "NONE (NULL values to be discarded)"
- rTXTIdxISAM00 = Rexx "ISAM (NULL and duplicate values to be accepted)"
- rTXTIdxISAM01 = Rexx "ISAM (duplicate values to be accepted, but no NULLs)"
- rTXTIdxISAM10 = Rexx "ISAM (NULL values to be accepted, but no duplicates)"
- rTXTIdxISAM11 = Rexx "ISAM (no NULLs and no duplicates)"
-
-
- /* db structure */
- rRecordStr = Rexx[1000,3]
-
- /* Deleting of records */
- rToDele = Rexx[]
-
- /* Name (WITHOUT extensions) of the in use DB */
- rCurrentDb = Rexx ""
-
- /* For the creation of a db */
- rTempArr = Rexx[100,3]
-
- /* Current field when entering data and/or creating a db */
- iCurrFld = int
-
- scrolpan = ScrollPanel
- fm = FontMetrics
-
- f = Font("Courier", Font.PLAIN, 12)
- f2 = Font("Courier", Font.BOLD, 24)
-
- DbList = List(0, 1)
- FieldList = List(0, 0)
-
- laCrName = Label("Field name: ")
- laCrLength = Label("Field Length: ")
- laCrIndex = Label("Field Indexing: ")
- laCrInfo = Label("No errors.")
- laFilter = Label("Search filter: ")
- laPage = Label("Current page:")
- laOne = Label()
- laTwo = Label()
- laThree = Label()
- laFour = Label()
- laFive = Label()
-
- chCrIndex = Choice()
- chPage = Choice()
- chMPage = Choice()
- chFPage = Choice()
-
- tfCrName = TextField()
- tfCrLength = TextField()
- tfOne = TextField()
- tfTwo = TextField()
- tfThree = TextField()
- tfFour = TextField()
- tfFive = TextField()
-
- bnDbTools = Button("Tools..")
- bnRecords = Button("Records..")
- bnSelectAll = Button("Sel All")
- bnDeselectAll = Button("Des All")
- bnMainPanel = Button("Main panel..")
- bnCreate = Button("New DB")
- bnDestroy = Button("Del DB")
- bnAddField = Button("Add Fld")
- bnDelField = Button("Del Fld")
- bnModFieldIdx = Button("Mod Index")
- bnModThisField = Button("Modify This Field's Indexing")
- bnSetThisIdx = Button("Select This Indexing Method")
- bnYes = Button("Yes")
- bnFilter = Button("Set a filter")
- bnFilterOk = Button("Set this filter")
- bnNo = Button("Cancel")
- bnGotOrder = Button("Order By the selected field")
- bnDelYes = Button("Yes")
- bnCrPrev = Button("Previous field")
- bnFirst50 = Button("Show only the first 50 records")
- bnAll = Button("Show all the records")
- bnCrNext = Button("Next field")
- bnCrDone = Button("Save database")
- bnStoreNewField = Button("Add this field")
- bnDeleteThisField = Button("Delete this field")
- bnCrCancel = Button("Cancel")
- bnConnect = Button("Login")
- bnDisconnect = Button("Logout")
- bnRefresh = Button("Refresh Now")
- bnProperties = Button("Properties")
- bnFormView = Button("Form View")
- bnPack = Button("Pack DB")
- bnAdd = Button("Add")
- bnModify = Button("Modify")
- bnDelete = Button("Delete")
- bnOrder = Button("Order By..")
- bnAStore = Button("Store")
- bnMStore = Button("Store")
- bnDBFtoDAT = Button(".dbf->.dat")
- bnDATtoDBF = Button(".dat->.dbf")
-
- bnPuno = Button()
- bnPdue = Button()
- bnPtre = Button()
- bnPquattro = Button()
- bnPcinque = Button()
- rPluginClass = Rexx[6]
- p = Panel()
- dbToolsp = Panel()
-
-
-
- method main(CommandLine=String[]) static
- MaxBase(CommandLine)
-
-
- method doInitStuff() private
- rxTemp = RXFile()
- iCnter = int 1
- rPlugin = Rexx ""
-
- rPlugin = rxTemp.stream("plugin.ini","c","query exists")
- if rPlugin \= "" then
- do
- /* Yessir, we have plugins! */
- rxTemp.stream(rPlugin, "c", "open read")
- loop while ((iCnter < 6) & (rxTemp.lines() \= 0))
- select
- when iCnter=1 then
- do
- bnPuno.setLabel(rxTemp.linein())
- end
- when iCnter=2 then
- bnPdue.setLabel(rxTemp.linein())
- when iCnter=3 then
- bnPtre.setLabel(rxTemp.linein())
- when iCnter=4 then
- bnPquattro.setLabel(rxTemp.linein())
- when iCnter=5 then
- bnPcinque.setLabel(rxTemp.linein())
- otherwise
- nop
- end
- rPluginClass[iCnter] = rxTemp.linein()
- iCnter = iCnter + 1
- end
- rxTemp.stream(rPlugin, "c", "close")
- end
- rPluginClass[0] = (iCnter - 1)
-
- rPlugin = rxTemp.stream("maxbase.mnu","c","query exists")
- if rPlugin \= "" then
- do
- rxTemp.stream(rPlugin, "c", "open read")
-
- rxTemp.linein() -- Gets the line with "Buttons" in it.
-
- bnDbTools.setLabel(rxTemp.linein())
- bnRecords.setLabel(rxTemp.linein())
- bnSelectAll.setLabel(rxTemp.linein())
- bnDeselectAll.setLabel(rxTemp.linein())
- bnMainPanel.setLabel(rxTemp.linein())
- bnCreate.setLabel(rxTemp.linein())
- bnDestroy.setLabel(rxTemp.linein())
- bnAddField.setLabel(rxTemp.linein())
- bnDelField.setLabel(rxTemp.linein())
- bnModFieldIdx.setLabel(rxTemp.linein())
- bnModThisField.setLabel(rxTemp.linein())
- bnSetThisIdx.setLabel(rxTemp.linein())
- bnYes.setLabel(rxTemp.linein())
- bnFilter.setLabel(rxTemp.linein())
- bnFilterOk.setLabel(rxTemp.linein())
- bnNo.setLabel(rxTemp.linein())
- bnGotOrder.setLabel(rxTemp.linein())
- bnDelYes.setLabel(rxTemp.linein())
- bnCrPrev.setLabel(rxTemp.linein())
- bnFirst50.setLabel(rxTemp.linein())
- bnAll.setLabel(rxTemp.linein())
- bnCrNext.setLabel(rxTemp.linein())
- bnCrDone.setLabel(rxTemp.linein())
- bnStoreNewField.setLabel(rxTemp.linein())
- bnDeleteThisField.setLabel(rxTemp.linein())
- bnCrCancel.setLabel(rxTemp.linein())
- bnConnect.setLabel(rxTemp.linein())
- bnDisconnect.setLabel(rxTemp.linein())
- bnRefresh.setLabel(rxTemp.linein())
- bnProperties.setLabel(rxTemp.linein())
- bnFormView.setLabel(rxTemp.linein())
- bnPack.setLabel(rxTemp.linein())
- bnAdd.setLabel(rxTemp.linein())
- bnModify.setLabel(rxTemp.linein())
- bnDelete.setLabel(rxTemp.linein())
- bnOrder.setLabel(rxTemp.linein())
- bnAStore.setLabel(rxTemp.linein())
- bnMStore.setLabel(rxTemp.linein())
- bnDBFtoDAT.setLabel(rxTemp.linein())
- bnDATtoDBF.setLabel(rxTemp.linein())
-
- rxTemp.linein() -- Gets the line with "Labels" in it.
-
- laCrName.setText(rxTemp.linein())
- laCrLength.setText(rxTemp.linein())
- laCrIndex.setText(rxTemp.linein())
- laCrInfo.setText(rxTemp.linein())
- laFilter.setText(rxTemp.linein())
- laPage.setText(rxTemp.linein())
-
- rxTemp.linein() -- Gets the line with "User infos" in it.
-
- rTXTFileNotPresent = rxTemp.linein()
- rTXTEnd = rxTemp.linein()
- rTXTChoose = rxTemp.linein()
- rTXTChooseDBF = rxTemp.linein()
- rTXTNoDb = rxTemp.linein()
- rTXTOneLine = rxTemp.linein()
- rTXTActRec = rxTemp.linein()
- rTXTShowHere = rxTemp.linein()
- rTXTMissInfo = rxTemp.linein()
- rTXTName = rxTemp.linein()
- rTXTWrkFld = rxTemp.linein()
- rTXTPickName = rxTemp.linein()
- rTXTMInfo = rxTemp.linein()
- rTXTMName = rxTemp.linein()
- rTXTNoIndex = rxTemp.linein()
- rTXTBigger = rxTemp.linein()
- rTXTFileExists = rxTemp.linein()
- rTXTSaved = rxTemp.linein()
- rTXTFindInfo = rxTemp.linein()
- rTXTFindTitle = rxTemp.linein()
- rTXTOrderTitle = rxTemp.linein()
- rTXTFldDelTitle = rxTemp.linein()
- rTXTModIdxTitle = rxTemp.linein()
- rTXTIdxStratTitle = rxTemp.linein()
- rTXTDelDb = rxTemp.linein()
- rTXTDelDbInfo = rxTemp.linein()
- rTXTRDel1 = rxTemp.linein()
- rTXTRDel2 = rxTemp.linein()
- rTXTRDel3 = rxTemp.linein()
- rTXTRDel4 = rxTemp.linein()
- rTXTWarning = rxTemp.linein()
- rTXTCurWork = rxTemp.linein()
- rTXTCreateDb = rxTemp.linein()
- rTXTAddFld = rxTemp.linein()
- rTXTAddFldTitle = rxTemp.linein()
- rTXTRecAdd = rxTemp.linein()
- rTXTRecMod = rxTemp.linein()
- rTXTRecBrowse = rxTemp.linein()
- rTXTSelPage = rxTemp.linein()
- rTXTStore = rxTemp.linein()
- rTXTCantAdd1 = rxTemp.linein()
- rTXTCantAdd2 = rxTemp.linein()
- rTXTIdxNONE0 = rxTemp.linein()
- rTXTIdxNONE1 = rxTemp.linein()
- rTXTIdxISAM00 = rxTemp.linein()
- rTXTIdxISAM01 = rxTemp.linein()
- rTXTIdxISAM10 = rxTemp.linein()
- rTXTIdxISAM11 = rxTemp.linein()
-
- rxTemp.stream(rPlugin, "c", "close")
- end
-
- rShowed = '50'
-
- chCrIndex.addItem(rTXTIdxNONE0)
- chCrIndex.addItem(rTXTIdxNONE1)
- chCrIndex.addItem(rTXTIdxISAM00)
- chCrIndex.addItem(rTXTIdxISAM01)
- chCrIndex.addItem(rTXTIdxISAM10)
- chCrIndex.addItem(rTXTIdxISAM11)
-
- screen=Toolkit.getDefaultToolkit.getScreenSize
- resize(screen.width, screen.height*0.5)
- move(0, screen.height*0.25)
- setBackGround(Color.lightgray)
- setForeGround(Color.black)
-
- fm = DbList.getFontMetrics(f)
- scrolpan = ScrollPanel()
- DbList.reshape(0, 0, 10, 10);
- scrolpan.setClient(DbList)
-
- DbLayout()
-
-
-
- method MaxBase(sCmdLine = String[])
- rCmdName = Rexx
- rxTemp = RXFile()
-
- doInitStuff()
-
- do
- rCmdName = rxTemp.stream(sCmdLine[0], "c", "query exists")
- catch ArrayIndexOutOfBoundsException
- rCmdName = ""
- end
-
- if rCmdName \= "" then
- CmdConnect(sCmdLine[0])
-
-
-
- method handleEvent(e=Event) returns boolean
- if e.id=Event.ACTION_EVENT then
- do
- select label components
- when e.target <= Button then
- select label buttons
- when e.target = bnFilter then CreateFilterLayout()
- when e.target = bnFilterOk then SetFilter()
- when e.target = bnSelectAll then SelectAll()
- when e.target = bnDeselectAll then DeselectAll()
- when e.target = bnConnect then Connect()
- when e.target = bnDbTools then DbToolsLayout()
- when e.target = bnRecords then RecordsLayout()
- when e.target = bnMainPanel then DbLayout()
- when e.target = bnAddField then AddField()
- when e.target = bnModFieldIdx then ModIdx()
- when e.target = bnSetThisIdx then SetThisIdx()
- when e.target = bnModThisField then SelectIdx()
- when e.target = bnDelField then DelField()
- when e.target = bnStoreNewField then StoreNewField()
- when e.target = bnDeleteThisField then DeleteThisField()
- when e.target = bnFirst50 then SetFirst50()
- when e.target = bnAll then SetAllRecords()
- when e.target = bnRefresh then RefreshView()
- when e.target = bnProperties then PropertiesLayout()
- when e.target = bnFormView then FormView()
- when e.target = bnCreate then Create()
- when e.target = bnDestroy then DbDestroy()
- when e.target = bnDisconnect then Disconnect()
- when e.target = bnAdd then AddRecord()
- when e.target = bnModify then ModiRecord()
- when e.target = bnDelete then DeleRec()
- when e.target = bnOrder then OrderBy()
- when e.target = bnPack then PackIt()
- when e.target = bnGotOrder then GotOrder()
- when e.target = bnYes then DbDel
- when e.target = bnDelYes then RecDel
- when e.target = bnNo then CancelWithoutReload
- when e.target = bnCrCancel then CancelWithoutReload
- when e.target = bnCrNext then DbCrNext
- when e.target = bnCrPrev then DbCrPrev
- when e.target = bnCrDone then DbCrDone
- when e.target = bnAStore then AStore()
- when e.target = bnMStore then MStore()
- when e.target = bnPuno then Lancia(1)
- when e.target = bnPdue then Lancia(2)
- when e.target = bnPtre then Lancia(3)
- when e.target = bnPquattro then Lancia(4)
- when e.target = bnPcinque then Lancia(5)
- when e.target = bnDBFtoDAT then DBFtoDAT
- when e.target = bnDATtoDBF then DATtoDBF
- otherwise
- nop
- end buttons
- when e.target <= Choice then
- select label choices
- when e.target = chPage then AddRecordLayout(chPage.getSelectedItem(), 1)
- when e.target = chMPage then AddRecordLayout(chMPage.getSelectedItem(), 0)
- when e.target = chFPage then AddRecordLayout(chFPage.getSelectedItem(), 2)
- otherwise
- nop
- end choices
- otherwise
- nop
- end components
- end
- else
- if e.id=Event.WINDOW_DESTROY then
- do
- if rCurrentDb \= "" then
- dbMine.disconnect()
- exit
- end
- return super.handleEvent(e)
-
-
- -- Lancia means 'launch'
- method Lancia(iPlugin = int) private
- rx = RXFile()
- rtime = Runtime
- pr2 = Process
- iLines = int[]
- iFoo = int
- iCnter = int 1
- iCnter2 = int 0
- bExit = boolean 0
-
- iLines = DBList.getSelectedIndexes()
- do
- iFoo = iLines[0]
- catch ArrayIndexOutOfBoundsException
- return
- end
-
- loop while bExit = 0
- iFoo = iLines[iCnter - 1]
- iCnter = iCnter + 1
- catch ArrayIndexOutOfBoundsException
- bExit = 1
- end
-
- loop iFoo = 1 to (iCnter-1) /* Records */
- if iLines[iFoo-1] = 0 then
- return
- end
-
- rtime = Runtime.getRuntime()
- do
- pr2 = rtime.exec(rPluginClass[iPlugin])
- catch IOException
- catch NullPointerException
- say 'problem with plugin!:'pr2' 'rtime
- end
- rx.attachtooutputstream(pr2.getOutputStream())
- rx.attachtoinputstream(pr2.getInputStream())
-
- rx.lineout(rRecordStr[0, 0]) /* How many fields? */
-
- loop iFoo = 1 to rRecordStr[0, 0]
- rx.lineout(rRecordStr[iFoo, 1]) /* Send field names */
- end
-
- rx.lineout(iCnter-1) /* How many records? */
-
- loop iFoo = 1 to (iCnter-1) /* Records */
- loop iCnter2 = 1 to rRecordStr[0, 0]
- rx.lineout(rRecArr[iCnter2, iLines[iFoo-1] ])
- end
- end
-
-
-
- method Connect() private
- OpenFileDialog = FileDialog(this, rTXTChoose)
- iCnter = int
- CurFile = Rexx
- File1 = RXFile()
-
- OpenFileDialog.show()
- if OpenFileDialog.getFile = null then return
- CurFile = OpenFileDialog.getFile
-
- if (CurFile.right(4, ' ')).upper() \= '.DAT' then return
- if (File1.stream(CurFile, "c", "query exists")).length() = 0 then return
-
- /* Now load the records */
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
- rCurrentDb = CurFile.left(CurFile.length() - 4)
- dbMine.connect(rCurrentDb)
- rRecordStr = dbMine.getdbinfo()
- iIdx=0
- loop iCnter = 1 to rRecordStr[0,0]
- if (rRecordStr[iCnter, 2]).left(4)="ISAM" then iIdx = iCnter
- end
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- DbLayout()
-
-
-
- method CmdConnect(rDbName = Rexx) private
- iCnter = int
-
- /* Now load the records */
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
- rCurrentDb = rDbName.left(rDbName.length() - 4)
- dbMine.connect(rCurrentDb)
- rRecordStr = dbMine.getdbinfo()
- iIdx=0
- loop iCnter = 1 to rRecordStr[0,0]
- if (rRecordStr[iCnter, 2]).left(4)="ISAM" then iIdx = iCnter
- end
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- DbLayout()
-
-
-
- method RefreshView() private
-
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- RecordsLayout()
-
-
-
- method Disconnect() private
- dbMine.disconnect()
- iIdx=0
-
- this.hide()
- DbList.clear()
- dbMine = null
- dbMine = RXDbase()
- rCurrentDb = ""
- this.setTitle(rTXTNoDb)
- DbLayout()
-
-
-
- method DbDestroy() private
-
- if rCurrentDb = "" then return
- ConfirmLayout()
-
-
-
- method DbDel() private
- dbMine.disconnect()
- dbMine.deletedb(rCurrentDb)
- dbMine = null
- dbMine = RXDbase()
- rCurrentDb=""
- DbLayout()
- this.hide()
- DbList.clear()
- this.show()
-
-
- method DBHeader() private
- rTemp = Rexx ""
- iCnter = int
-
- if rCurrentDb = "" then return
- loop iCnter = 1 to rRecordStr[0,0]
- rTemp = rTemp || (rRecordStr[iCnter, 1]).right(rRecordStr[iCnter, 0]) || "."
- end
- DbList.addItem(rTemp)
-
-
-
- method DBFill() private
- rTemp = Rexx ""
- iCnter = int
- iCnter2 = int
-
- if rCurrentDb = "" then return
- loop iCnter = 1 to rRecArr[0, 1]
- rTemp = ""
- loop iCnter2 = 1 to rRecordStr[0,0]
- rTemp = rTemp || rRecArr[iCnter2, iCnter] || "."
- end
- DbList.addItem(rTemp)
- end
- this.setTitle(rTXTOneLine || rCurrentDb || "; " || rDbStats[3] || rTXTActRec || rRecArr[0,1] || rTXTShowHere)
- DbList.reshape(0, 0, (fm.stringWidth(DbList.getItem(DbList.countItems() - 1)) * 1.2) % 1, fm.getHeight() * (DbList.countItems() + 1));
-
-
-
- method CreateFilterLayout() private
- p2 = Panel()
- p3 = Panel()
-
- p2.setLayout(FlowLayout())
- if bnFilterOk.getLabel() \= '-' then p2.add(bnFilterOk)
- if bnRecords.getLabel() \= '-' then p2.add(bnRecords)
-
- p3.add(laFilter)
- p3.add(tfCrName)
- tfCrName.setText(rFilter)
- p3.setLayout(GridLayout(1, 2))
-
- laCrInfo.setText(rTXTFindInfo)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", laCrInfo)
- add("Center", p2)
- add("North", p3)
- this.setTitle(rTXTFindTitle)
- this.show()
-
-
-
- method DbLayout() private
- iCnter = int
-
- this.removeAll()
- setLayout(BorderLayout())
- DbList.setFont(f)
- p = panel()
- p.setLayout(FlowLayout());
- if bnDbTools.getLabel() \= '-' then p.add(bnDbTools);
- if rCurrentDB \= "" then
- do
- if bnRecords.getLabel() \= '-' then p.add(bnRecords);
- if bnDisconnect.getLabel() \= '-' then p.add(bnDisconnect);
- if bnSelectAll.getLabel() \= '-' then p.add(bnSelectAll);
- if bnDeselectAll.getLabel() \= '-' then p.add(bnDeselectAll);
- if rPluginClass[0] > 0 then
- loop iCnter = 1 to rPluginClass[0]
- select
- when iCnter=1 then
- p.add(bnPuno)
- when iCnter=2 then
- p.add(bnPdue)
- when iCnter=3 then
- p.add(bnPtre)
- when iCnter=4 then
- p.add(bnPquattro)
- when iCnter=5 then
- p.add(bnPcinque)
- otherwise
- nop
- end
- end
- end
- else
- if bnConnect.getLabel() \= '-' then p.add(bnConnect);
-
- add("South", p);
- add("Center", scrolpan)
- if rCurrentDB = "" then
- this.setTitle(rTXTNoDb)
- else
- this.setTitle(rTXTOneLine || rCurrentDb || "; " || rDbStats[3] || rTXTActRec || rRecArr[0,1] || rTXTShowHere)
- this.show()
-
-
-
- method RecordsLayout() private
-
- this.removeAll()
- setLayout(BorderLayout())
- DbList.setFont(f)
- pRecs = panel()
- pRecs.setLayout(FlowLayout());
- if bnAdd.getLabel() \= '-' then pRecs.add(bnAdd);
- if bnModify.getLabel() \= '-' then pRecs.add(bnModify);
- if bnDelete.getLabel() \= '-' then pRecs.add(bnDelete);
- if bnOrder.getLabel() \= '-' then pRecs.add(bnOrder);
- if bnFilter.getLabel() \= '-' then pRecs.add(bnFilter);
- if bnFormView.getLabel() \= '-' then pRecs.add(bnFormView);
- if bnRefresh.getLabel() \= '-' then pRecs.add(bnRefresh);
- if bnMainPanel.getLabel() \= '-' then pRecs.add(bnMainPanel);
- add("South", pRecs);
- add("Center", scrolpan)
- this.show()
-
-
-
- method DbToolsLayout() private
-
- this.removeAll()
- setLayout(BorderLayout())
- DbList.setFont(f)
- dbtoolsp = Panel()
- dbToolsp.setLayout(FlowLayout());
- if bnCreate.getLabel() \= '-' then dbToolsp.add(bnCreate);
- if rCurrentDB \= "" then
- do
- if bnDestroy.getLabel() \= '-' then dbToolsp.add(bnDestroy);
- if bnPack.getLabel() \= '-' then dbToolsp.add(bnPack);
- if bnAddField.getLabel() \= '-' then dbToolsp.add(bnAddField);
- if bnDelField.getLabel() \= '-' then dbToolsp.add(bnDelField);
- if bnModFieldIdx.getLabel() \= '-' then dbToolsp.add(bnModFieldIdx);
- end
- if bnDBFtoDAT.getLabel() \= '-' then dbToolsp.add(bnDBFtoDAT)
- if bnDATtoDBF.getLabel() \= '-' then dbToolsp.add(bnDATtoDBF)
-
- if bnProperties.getLabel() \= '-' then dbToolsp.add(bnProperties);
- if bnMainPanel.getLabel() \= '-' then dbToolsp.add(bnMainPanel);
-
- add("South", dbToolsp);
- add("Center", scrolpan)
- if rCurrentDB = "" then
- this.setTitle(rTXTNoDb)
- else
- this.setTitle(rTXTOneLine || rCurrentDb || "; " || rDbStats[3] || rTXTActRec || rRecArr[0,1] || rTXTShowHere)
- this.show()
-
-
-
- method PropertiesLayout() private
-
- this.removeAll()
- setLayout(BorderLayout())
- DbList.setFont(f)
- dbprop = Panel()
- dbprop.setLayout(FlowLayout());
- if bnFirst50.getLabel() \= '-' then dbprop.add(bnFirst50);
- if bnAll.getLabel() \= '-' then dbprop.add(bnAll);
- if bnDbTools.getLabel() \= '-' then dbprop.add(bnDbTools);
- add("South", dbprop);
- add("Center", scrolpan)
- if rCurrentDB = "" then
- this.setTitle(rTXTNoDb)
- else
- this.setTitle(rTXTOneLine || rCurrentDb || "; " || rDbStats[3] || rTXTActRec || rRecArr[0,1] || rTXTShowHere)
- this.show()
-
-
-
- method OrderLayout(iIndexes = int[]) private
- p2 = Panel()
- iCnter = int
-
- FieldList.clear()
- loop iCnter = 1 to iIndexes[0]
- FieldList.addItem( rRecordStr[iIndexes[iCnter], 1] )
- end
- FieldList.setFont(f2)
-
- p2.setLayout(FlowLayout())
- if bnGotOrder.getLabel() \= '-' then p2.add(bnGotOrder)
- if bnRecords.getLabel() \= '-' then p2.add(bnRecords)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", p2)
- add("Center", FieldList)
- this.setTitle(rTXTOrderTitle)
- this.show()
-
-
-
- method DelFieldLayout() private
- p2 = Panel()
- iCnter = int
-
- FieldList.clear()
- loop iCnter = 1 to rRecordStr[0,0]
- FieldList.addItem( rRecordStr[iCnter, 1] )
- end
- FieldList.setFont(f2)
-
- p2.setLayout(FlowLayout())
- if bnDeleteThisField.getLabel() \= '-' then p2.add(bnDeleteThisField)
- if bnDbTools.getLabel() \= '-' then p2.add(bnDbTools)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", p2)
- add("Center", FieldList)
- this.setTitle(rTXTFldDelTitle)
- this.show()
-
-
-
- method ModIdxLayout(iIndexes = int[]) private
- p2 = Panel()
- iCnter = int
-
- FieldList.clear()
- loop iCnter = 1 to iIndexes[0]
- FieldList.addItem( rRecordStr[iIndexes[iCnter], 1] )
- end
- FieldList.setFont(f2)
-
- p2.setLayout(FlowLayout())
- if bnModThisField.getLabel() \= '-' then p2.add(bnModThisField)
- if bnDbTools.getLabel() \= '-' then p2.add(bnDbTools)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", p2)
- add("Center", FieldList)
- this.setTitle(rTXTModIdxTitle)
- this.show()
-
-
-
- method SelectIdxLayout(rIndexes = Rexx[]) private
- p2 = Panel()
- iCnter = int
-
- FieldList.clear()
- loop iCnter = 1 to rIndexes[0]
- FieldList.addItem( rIndexes[iCnter] )
- end
- FieldList.setFont(f2)
-
- p2.setLayout(FlowLayout())
- if bnSetThisIdx.getLabel() \= '-' then p2.add(bnSetThisIdx)
- if bnDbTools.getLabel() \= '-' then p2.add(bnDbTools)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", p2)
- add("Center", FieldList)
- this.setTitle(rTXTIdxStratTitle)
- this.show()
-
-
-
- method ConfirmLayout() private
- p2 = Panel()
- DeleteList = List(2,0)
-
- DeleteList.addItem(rTXTDelDb)
- DeleteList.addItem(rTXTDelDbInfo)
- DeleteList.setFont(f2)
-
- p2.setLayout(FlowLayout())
- if bnYes.getLabel() \= '-' then p2.add(bnYes)
- if bnDbTools.getLabel() \= '-' then p2.add(bnDbTools)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", p2)
- add("Center", DeleteList)
- this.setTitle(rTXTWarning)
- this.show()
-
-
-
- method DeleteConfirmLayout() private
- p2 = Panel()
- DeleteList = List(2,0)
-
- if iOldPage = 0 then
- DeleteList.addItem(rTXTRDel1)
- else
- DeleteList.addItem(rTXTRDel2 || (iOldPage+1) || rTXTRDel3)
- DeleteList.addItem(rTXTRDel4)
- DeleteList.setFont(f2)
-
- p2.setLayout(FlowLayout())
- if bnDelYes.getLabel() \= '-' then p2.add(bnDelYes)
- if bnNo.getLabel() \= '-' then p2.add(bnNo)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", p2)
- add("Center", DeleteList)
- this.setTitle(rTXTWarning)
- this.show()
-
-
-
- method CreateDbLayout() private
- p2 = Panel()
- p3 = Panel()
-
- p2.setLayout(FlowLayout())
- if bnCrPrev.getLabel() \= '-' then p2.add(bnCrPrev)
- if bnCrNext.getLabel() \= '-' then p2.add(bnCrNext)
- if bnCrDone.getLabel() \= '-' then p2.add(bnCrDone)
- if bnDbTools.getLabel() \= '-' then p2.add(bnDbTools)
-
- p3.add(laCrName)
- p3.add(tfCrName)
- tfCrName.setText( rTempArr[1, 1])
- p3.add(laCrLength)
- tfCrLength.setText( rTempArr[1, 0])
- p3.add(tfCrLength)
- p3.add(laCrIndex)
- p3.add(chCrIndex)
- ChCrIndex.select(rTXTIdxNONE0)
-
- p3.setLayout(GridLayout(3, 2))
-
- laCrInfo.setText(rTXTCurWork)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", laCrInfo)
- add("Center", p2)
- add("North", p3)
- this.setTitle(rTXTCreateDb)
- this.show()
-
-
-
- method AddFieldLayout() private
- p2 = Panel()
- p3 = Panel()
-
- p2.setLayout(FlowLayout())
- if bnStoreNewField.getLabel() \= '-' then p2.add(bnStoreNewField)
- if bnDbTools.getLabel() \= '-' then p2.add(bnDbTools)
-
- p3.add(laCrName)
- p3.add(tfCrName)
- tfCrName.setText( rTempArr[1, 1])
- p3.add(laCrLength)
- tfCrLength.setText( rTempArr[1, 0])
- p3.add(tfCrLength)
- p3.add(laCrIndex)
- p3.add(chCrIndex)
- ChCrIndex.select(rTXTIdxNONE0)
- p3.setLayout(GridLayout(3, 2))
-
- laCrInfo.setText(rTXTAddFld)
-
- this.removeAll()
- setLayout(BorderLayout())
- add("South", laCrInfo)
- add("Center", p2)
- add("North", p3)
- this.setTitle(rTXTAddFldTitle)
- this.show()
-
-
-
- method AddRecordLayout(rPage = Rexx, iAdd = int) private
- p2 = Panel()
- p3 = Panel()
- iCnter = int
- iCnter2 = int
-
- this.removeAll()
- setLayout(BorderLayout())
-
- p2.setLayout(FlowLayout())
- if iAdd=1 then
- do
- this.setTitle(rTXTRecAdd)
- if bnAStore.getLabel() \= '-' then p2.add(bnAStore)
- end
- else if iAdd=0 then
- do
- this.setTitle(rTXTRecMod)
- if bnMStore.getLabel() \= '-' then p2.add(bnMStore)
- end
- else
- this.setTitle(rTXTRecBrowse)
-
- if bnNo.getLabel() \= '-' then p2.add(bnNo)
-
- if iOldPage \= 0 then
- do
- rRecArr2[1 + (iOldpage-1)*5, 1] = tfOne.getText()
- if rRecordStr[0,0] > 1 + (iOldPage-1)*5 then
- rRecArr2[2 + (iOldpage-1)*5, 1] = tfTwo.getText()
- if rRecordStr[0,0] > 2 + (iOldPage-1)*5 then
- rRecArr2[3 + (iOldpage-1)*5, 1] = tfThree.getText()
- if rRecordStr[0,0] > 3 + (iOldPage-1)*5 then
- rRecArr2[4 + (iOldpage-1)*5, 1] = tfFour.getText()
- if rRecordStr[0,0] > 4 + (iOldPage-1)*5 then
- rRecArr2[5 + (iOldpage-1)*5, 1] = tfFive.getText()
- end
-
- iOldPage = rPage
-
- laOne.setText(rRecordStr[1 + (rPage-1)*5, 1])
- p3.add(laOne)
- tfOne.setText( (rRecArr2[1+(rPage-1)*5, 1]).strip() )
- p3.add(tfOne)
- iCnter=1
- if rRecordStr[0,0] > 1 + (rPage-1)*5 then
- do
- p3.add(laTwo)
- tfTwo.setText( (rRecArr2[2+(rPage-1)*5, 1]).strip() )
- p3.add(tfTwo)
- laTwo.setText(rRecordStr[2 + (rPage-1)*5, 1])
- iCnter=2
- end
- if rRecordStr[0,0] > 2 + (rPage-1)*5 then
- do
- p3.add(laThree)
- tfThree.setText( (rRecArr2[3+(rPage-1)*5, 1]).strip() )
- p3.add(tfThree)
- laThree.setText(rRecordStr[3 + (rPage-1)*5, 1])
- iCnter=3
- end
- if rRecordStr[0,0] > 3 + (rPage-1)*5 then
- do
- p3.add(laFour)
- tfFour.setText( (rRecArr2[4+(rPage-1)*5, 1]).strip() )
- p3.add(tfFour)
- laFour.setText(rRecordStr[4 + (rPage-1)*5, 1])
- iCnter=4
- end
- if rRecordStr[0,0] > 4 + (rPage-1)*5 then
- do
- p3.add(laFive)
- tfFive.setText( (rRecArr2[5+(rPage-1)*5, 1]).strip() )
- p3.add(tfFive)
- laFive.setText(rRecordStr[5 + (rPage-1)*5, 1])
- iCnter=5
- end
- if rRecordStr[0,0] > 5 then
- do
- p3.add(laPage)
- if iAdd = 1 then
- do
- chPage = Choice()
- loop iCnter2 = 1 to (rRecordStr[0,0] % 5) + 1
- chPage.addItem(iCnter2)
- end
- p3.add(chPage)
- chPage.select(rPage)
- end
- else if iAdd = 0 then
- do
- chMPage = Choice()
- loop iCnter2 = 1 to (rRecordStr[0,0] % 5) + 1
- chMPage.addItem(iCnter2)
- end
- p3.add(chMPage)
- chMPage.select(rPage)
- end
- else
- do
- chFPage = Choice()
- loop iCnter2 = 1 to (rRecordStr[0,0] % 5) + 1
- chFPage.addItem(iCnter2)
- end
- p3.add(chFPage)
- chFPage.select(rPage)
- end
- laCrInfo.setText(rTXTSelPage)
- iCnter=iCnter+1
- end
- else
- laCrInfo.setText(rTXTStore)
- p3.setLayout(GridLayout(iCnter, 2))
-
- add("South", laCrInfo)
- add("Center", p2)
- add("North", p3)
- this.show()
-
-
- method Create() private
- iCnter = int
-
- Disconnect()
- loop iCnter = 1 to 99
- rTempArr[iCnter, 0] = 20
- rTempArr[iCnter, 1] = ""
- rTempArr[iCnter, 2] = rTXTIdxNONE0
- end
-
- CreateDbLayout()
- iCurrFld = 1
- rTempArr[0,0] = 1
-
-
-
- method AddField() private
-
- rTempArr[1, 0] = 20
- rTempArr[1, 1] = ""
- rTempArr[1, 2] = rTXTIdxNONE0
-
- iCurrFld = 1
- rTempArr[0,0] = 1
- AddFieldLayout()
-
-
-
- method StoreNewField private
- rTName = Rexx
- rTLen = Rexx
- rTIdx = Rexx
- rTSel = Rexx
-
- rTName = tfCrName.getText()
- rTLen = tfCrLength.getText()
-
- if rTName = null | rTLen = null then
- do
- laCrInfo.setText(rTXTCantAdd1)
- return
- end
-
- if rTName.length()=0 | rTLen.datatype("N")\=1 | rTLen < 1 then
- do
- laCrInfo.setText(rTXTCantAdd2)
- return
- end
-
- rTSel = ChCrIndex.getSelectedItem()
- select
- when rTSel = rTXTIdxNONE0 then
- rTIdx = "NONE0"
- when rTSel = rTXTIdxNONE1 then
- rTIdx = "NONE1"
- when rTSel = rTXTIdxISAM00 then
- rTIdx = "ISAM00"
- when rTSel = rTXTIdxISAM01 then
- rTIdx = "ISAM01"
- when rTSel = rTXTIdxISAM10 then
- rTIdx = "ISAM10"
- when rTSel = rTXTIdxISAM11 then
- rTIdx = "ISAM11"
- otherwise
- nop
- end
-
- dbMine.addfield(rTName, rTLen, rTIdx)
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
- dbMine.connect(rCurrentDb)
- rRecordStr = dbMine.getdbinfo()
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- DbLayout()
-
-
-
- method DeleteThisField() private
- iCnter = int
-
- iCnter = FieldList.getSelectedIndex() + 1
- if iCnter < 1 then return
-
- dbMine.delfield(iCnter)
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
- dbMine.connect(rCurrentDb)
- rRecordStr = dbMine.getdbinfo()
- iIdx=0
- loop iCnter = 1 to rRecordStr[0,0]
- if (rRecordStr[iCnter, 2]).left(4)="ISAM" then iIdx = iCnter
- end
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- DbLayout()
-
-
-
-
- method CancelWithoutReload private
- /* Now reset the current visualization */
-
- RecordsLayout()
- iOldPage = 0
- if rCurrentDB = "" then
- this.setTitle(rTXTNoDb)
- else
- this.setTitle(rTXTOneLine || rCurrentDb || "; " || rDbStats[3] || rTXTActRec || rRecArr[0,1] || rTXTShowHere)
- this.show()
-
-
-
- method DbCrNext() private
- rTName = Rexx
- rTLen = Rexx
- rTIdx = Rexx
- rTSel = Rexx
-
- rTName = tfCrName.getText()
- rTLen = tfCrLength.getText()
-
- if rTName = null | rTLen = null then
- do
- laCrInfo.setText(rTXTMissInfo)
- return
- end
-
- if rTName.length()=0 | rTLen.datatype("N")\=1 | rTLen < 1 then
- do
- laCrInfo.setText(rTXTName)
- return
- end
-
- rTempArr[iCurrFld, 0] = rTLen
- rTempArr[iCurrFld, 1] = rTName
-
- rTSel = ChCrIndex.getSelectedItem()
- select
- when rTSel = rTXTIdxNONE0 then
- rTIdx = "NONE0"
- when rTSel = rTXTIdxNONE1 then
- rTIdx = "NONE1"
- when rTSel = rTXTIdxISAM00 then
- rTIdx = "ISAM00"
- when rTSel = rTXTIdxISAM01 then
- rTIdx = "ISAM01"
- when rTSel = rTXTIdxISAM10 then
- rTIdx = "ISAM10"
- when rTSel = rTXTIdxISAM11 then
- rTIdx = "ISAM11"
- otherwise
- nop
- end
-
- rTempArr[iCurrFld, 2] = rTIdx
-
- if iCurrFld < 99 then
- do
- iCurrFld = iCurrFld + 1
- if iCurrFld > rTempArr[0,0] then
- rTempArr[0,0] = iCurrFld
- end
-
- tfCrLength.setText(rTempArr[iCurrFld, 0])
- tfCrName.setText(rTempArr[iCurrFld, 1])
-
- rTSel = rTempArr[iCurrFld, 2]
- select
- when rTSel = "NONE0" then
- rTIdx = rTXTIdxNONE0
- when rTSel = "NONE1" then
- rTIdx = rTXTIdxNONE1
- when rTSel = "ISAM00" then
- rTIdx = rTXTIdxISAM00
- when rTSel = "ISAM01" then
- rTIdx = rTXTIdxISAM01
- when rTSel = "ISAM10" then
- rTIdx = rTXTIdxISAM10
- when rTSel = "ISAM11" then
- rTIdx = rTXTIdxISAM11
- otherwise
- nop
- end
-
- ChCrIndex.select(rTIdx)
- laCrInfo.setText(rTXTWrkFld|| iCurrFld ||"/99")
-
-
-
- method DbCrPrev() private
- rTName = Rexx
- rTLen = Rexx
- rTSel = Rexx
- rTIdx = Rexx
-
- rTName = tfCrName.getText()
- rTLen = tfCrLength.getText()
-
- if rTName = null | rTLen = null then
- do
- laCrInfo.setText(rTXTMissInfo)
- return
- end
-
- if rTName.length()=0 | rTLen.datatype("N")\=1 | rTLen < 1 then
- do
- laCrInfo.setText(rTXTName)
- return
- end
-
- rTempArr[iCurrFld, 0] = rTLen
- rTempArr[iCurrFld, 1] = rTName
-
- rTSel = ChCrIndex.getSelectedItem()
- select
- when rTSel = rTXTIdxNONE0 then
- rTIdx = "NONE0"
- when rTSel = rTXTIdxNONE1 then
- rTIdx = "NONE1"
- when rTSel = rTXTIdxISAM00 then
- rTIdx = "ISAM00"
- when rTSel = rTXTIdxISAM01 then
- rTIdx = "ISAM01"
- when rTSel = rTXTIdxISAM10 then
- rTIdx = "ISAM10"
- when rTSel = rTXTIdxISAM11 then
- rTIdx = "ISAM11"
- otherwise
- nop
- end
-
- rTempArr[iCurrFld, 2] = rTIdx
-
- if iCurrFld > 1 then
- iCurrFld = iCurrFld - 1
-
- tfCrLength.setText(rTempArr[iCurrFld, 0])
- tfCrName.setText(rTempArr[iCurrFld, 1])
-
- rTSel = rTempArr[iCurrFld, 2]
- select
- when rTSel = "NONE0" then
- rTIdx = rTXTIdxNONE0
- when rTSel = "NONE1" then
- rTIdx = rTXTIdxNONE1
- when rTSel = "ISAM00" then
- rTIdx = rTXTIdxISAM00
- when rTSel = "ISAM01" then
- rTIdx = rTXTIdxISAM01
- when rTSel = "ISAM10" then
- rTIdx = rTXTIdxISAM10
- when rTSel = "ISAM11" then
- rTIdx = rTXTIdxISAM11
- otherwise
- nop
- end
-
- ChCrIndex.select(rTIdx)
- laCrInfo.setText(rTXTWrkFld|| iCurrFld ||"/99")
-
-
-
- method DbCrDone private
- OpenFileDialog = FileDialog(this, rTXTPickName)
- rTName = Rexx
- rTLen = Rexx
- File1 = RXFile()
- rTIdx = Rexx
-
- rTName = tfCrName.getText()
- rTLen = tfCrLength.getText()
-
- if rTName = null | rTLen = null then
- do
- laCrInfo.setText(rTXTMInfo)
- return
- end
-
- if rTName.length()=0 | rTLen.datatype("N")\=1 | rTLen < 1 then
- do
- laCrInfo.setText(rTXTMName)
- return
- end
-
- rTempArr[iCurrFld, 0] = rTLen
- rTempArr[iCurrFld, 1] = rTName
- rTSel = ChCrIndex.getSelectedItem()
- select
- when rTSel = rTXTIdxNONE0 then
- rTIdx = "NONE0"
- when rTSel = rTXTIdxNONE1 then
- rTIdx = "NONE1"
- when rTSel = rTXTIdxISAM00 then
- rTIdx = "ISAM00"
- when rTSel = rTXTIdxISAM01 then
- rTIdx = "ISAM01"
- when rTSel = rTXTIdxISAM10 then
- rTIdx = "ISAM10"
- when rTSel = rTXTIdxISAM11 then
- rTIdx = "ISAM11"
- otherwise
- nop
- end
-
- rTempArr[iCurrFld, 2] = rTIdx
-
- iIdx=0
- loop iCnter = 1 to rTempArr[0,0]
- if (rTempArr[iCnter, 2]).left(4)="ISAM" then iIdx = iCnter
- end
-
- if iIdx = 0 then
- do
- laCrInfo.setText(rTXTNoIndex)
- return
- end
-
- OpenFileDialog.show()
- if OpenFileDialog.getFile = null then return
- CurFile = OpenFileDialog.getFile
-
- if CurFile.length()>4 then
- do
- laCrInfo.setText(rTXTBigger)
- return
- end
-
- if (File1.stream(CurFile, "c", "query exists")).length() \= 0 then
- do
- laCrInfo.setText(rTXTFileExists)
- return
- end
-
- dbMine.connect(CurFile, rTempArr)
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
- laCrInfo.setText(rTXTSaved)
-
-
-
- method AddRecord() private
- iCnter = int
-
- if rCurrentDb = "" then return
-
- rRecArr2 = Rexx[rRecordStr[0,0] + 1, 2]
- rRecArr2[0,0] = 1
- loop iCnter = 1 to rRecordStr[0,0]
- rRecArr2[iCnter, 1] = ""
- end
- AddRecordLayout(1, 1)
-
-
-
- method AStore() private
-
- rRecArr2[1 + (iOldpage-1)*5, 1] = tfOne.getText()
- if rRecordStr[0,0] > 1 + (iOldPage-1)*5 then
- rRecArr2[2 + (iOldpage-1)*5, 1] = tfTwo.getText()
- if rRecordStr[0,0] > 2 + (iOldPage-1)*5 then
- rRecArr2[3 + (iOldpage-1)*5, 1] = tfThree.getText()
- if rRecordStr[0,0] > 3 + (iOldPage-1)*5 then
- rRecArr2[4 + (iOldpage-1)*5, 1] = tfFour.getText()
- if rRecordStr[0,0] > 4 + (iOldPage-1)*5 then
- rRecArr2[5 + (iOldpage-1)*5, 1] = tfFive.getText()
-
- dbMine.saverec(rRecArr2, "APPEND")
- rDbStats[3] = rDbStats[3] + 1
-
- CancelWithoutReload()
-
-
-
- method ModiRecord() private
- iCnter = int
-
- iDeleted = DBList.getSelectedIndex()
- if ( iDeleted < 1 | rCurrentDb = "") then return
-
- rRecArr2 = Rexx[rRecordStr[0,0] + 4, 2]
- rRecArr2[0,0] = 1
- rRecArr2[0,1] = rRecArr[rRecordStr[0,0] + 2, iDeleted]
- loop iCnter = 1 to rRecordStr[0,0]
- rRecArr2[iCnter, 1] = rRecArr[iCnter, iDeleted]
- end
- AddRecordLayout(1, 0)
-
-
-
- method FormView() private
- iCnter = int
- iPosList = int
-
- iPosList = DBList.getSelectedIndex()
- if ( iPosList < 1 | rCurrentDb = "") then return
-
- rRecArr2 = Rexx[rRecordStr[0,0] + 4, 2]
- rRecArr2[0,0] = 1
- rRecArr2[0,1] = rRecArr[rRecordStr[0,0] + 2, iPosList]
- loop iCnter = 1 to rRecordStr[0,0]
- rRecArr2[iCnter, 1] = rRecArr[iCnter, iPosList]
- end
- AddRecordLayout(1, 2)
-
-
-
- method spaces(rLen = Rexx) private returns Rexx
- rSpazi = Rexx ''
-
- if rLen>0 then
- do
- loop for rLen
- rSpazi=rSpazi||' '
- end
- end
- return rSpazi
-
-
-
- method MStore() private
- iCnter = int
- rRet = Rexx
-
- rRecArr2[1 + (iOldpage-1)*5, 1] = tfOne.getText()
- if rRecordStr[0,0] > 1 + (iOldPage-1)*5 then
- rRecArr2[2 + (iOldpage-1)*5, 1] = tfTwo.getText()
- if rRecordStr[0,0] > 2 + (iOldPage-1)*5 then
- rRecArr2[3 + (iOldpage-1)*5, 1] = tfThree.getText()
- if rRecordStr[0,0] > 3 + (iOldPage-1)*5 then
- rRecArr2[4 + (iOldpage-1)*5, 1] = tfFour.getText()
- if rRecordStr[0,0] > 4 + (iOldPage-1)*5 then
- rRecArr2[5 + (iOldpage-1)*5, 1] = tfFive.getText()
-
- rRet = dbMine.modirec(rRecArr2)
-
- /* Maybe it wasn't valid.. */
- if rRet.left(1) = "1" then
- loop iCnter = 1 to rRecordStr[0,0]
- rRecArr[iCnter, iDeleted] = spaces(rRecordStr[iCnter, 0] - (rRecArr2[iCnter, 1]).length()) || rRecArr2[iCnter, 1]
- end
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
-
- CancelWithoutReload()
-
-
-
- method DeleRec() private
- bExit = boolean 0
- iCount = int
-
- if rCurrentDb = "" then return
-
- iDelVis = DBList.getSelectedIndexes() /* Per cancellarlo nella visualizzazione */
- if iDelVis[0] = 0 then
- do
- DBList.deselect(0)
- return
- end
-
- iOldPage = 0
- loop until bExit = 1
- do
- iCount = iDelVis[iOldPage]
- iOldPage = iOldPage + 1
- catch ArrayIndexOutOfBoundsException
- bExit = 1
- end
- end
- iOldPage = iOldPage - 1
-
- if iOldPage < 0 then return
-
- iDelArc = int[iOldPage + 1]
-
- loop iCount = 0 to iOldPage
- iDelArc[iCount] = rRecArr[rRecordStr[0, 0]+2, iDelVis[iCount]] /* nell'archivio */
- end
-
- DeleteConfirmLayout()
-
-
-
- method RecDel() private
- iCnter = int
-
- rToDele = Rexx[iOldPage + 2]
- rToDele[0] = iOldPage + 1
- loop iCnter = 1 to iOldPage + 1
- rToDele[iCnter] = iDelArc[iCnter - 1]
- end
- dbmine.delerec(rToDele, 1)
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- RecordsLayout()
-
-
-
- method OrderBy() private
- iIndexes = int[]
- iCnter = int
- iCnter2 = int 1
-
- if rCurrentDb = "" then return
- iIndexes = int[rRecordStr[0,0] + 2]
- loop iCnter = 1 to rRecordStr[0,0]
- if (rRecordStr[iCnter, 2]).left(4)="ISAM" then
- do
- iIndexes[iCnter2] = iCnter
- iCnter2 = iCnter2 + 1
- end
- end
- iIndexes[0] = iCnter2 - 1
- OrderLayout(iIndexes)
-
-
-
- method DelField() private
-
- if rCurrentDb = "" then return
- DelFieldLayout()
-
-
-
- method ModIdx() private
- iIndexes = int[]
- iCnter = int
- iCnter2 = int 1
-
- if rCurrentDb = "" then return
- iIndexes = int[rRecordStr[0,0] + 2]
- loop iCnter = 1 to rRecordStr[0,0]
- iIndexes[iCnter2] = iCnter
- iCnter2 = iCnter2 + 1
- end
- iIndexes[0] = iCnter2 - 1
- ModIdxLayout(iIndexes)
-
-
-
- method SelectIdx() private
- rIndexes = Rexx[7]
-
- if rCurrentDb = "" then return
- iOldPage = FieldList.getSelectedIndex() + 1
- if iOldPage < 1 then return
- rIndexes[1] = rTXTIdxNONE0
- rIndexes[2] = rTXTIdxNONE1
- rIndexes[3] = rTXTIdxISAM00
- rIndexes[4] = rTXTIdxISAM01
- rIndexes[5] = rTXTIdxISAM10
- rIndexes[6] = rTXTIdxISAM11
- rIndexes[0] = 6
- SelectIdxLayout(rIndexes)
-
-
-
- method SetThisIdx() private
- iNotNONE = int 0
- iCnter = int
- rSelected = Rexx
- rTSel = Rexx
-
- if rCurrentDb = "" then return
- iDeleted = FieldList.getSelectedIndex()
- if iDeleted < 0 then return
-
- rTSel = FieldList.getSelectedItem()
- select
- when rTSel = rTXTIdxNONE0 then
- rSelected = "NONE0"
- when rTSel = rTXTIdxNONE1 then
- rSelected = "NONE1"
- when rTSel = rTXTIdxISAM00 then
- rSelected = "ISAM00"
- when rTSel = rTXTIdxISAM01 then
- rSelected = "ISAM01"
- when rTSel = rTXTIdxISAM10 then
- rSelected = "ISAM10"
- when rTSel = rTXTIdxISAM11 then
- rSelected = "ISAM11"
- otherwise
- nop
- end
-
-
- if rSelected.left(4) = 'NONE' then
- do
- loop iCnter = 1 to rRecordStr[0,0]
- if (rRecordStr[iCnter, 2]).left(4) \= 'NONE' then
- iNotNone = iNotNone + 1
- end
- if iNotNONE < 2 then
- do
- return
- end
- end
- dbMine.modfieldidx(iOldPage, rSelected)
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
- dbMine.connect(rCurrentDb)
- rRecordStr = dbMine.getdbinfo()
- iIdx=0
- loop iCnter = 1 to rRecordStr[0,0]
- if (rRecordStr[iCnter, 2]).left(4)="ISAM" then iIdx = iCnter
- end
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- DbLayout()
-
-
-
- method GotOrder() private
- iCnter = int
-
- iCnter = FieldList.getSelectedIndex()
- if iCnter < 0 then return
-
- /* Now reset the current visualization */
- iIdx = FieldList.getSelectedIndex() + 1
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- this.hide()
- DbList.clear()
- RecordsLayout()
- DBHeader()
- DbFill()
-
-
-
- method SetFirst50() private
-
- rShowed = '50'
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
- rDbStats = dbMine.getdbstats()
-
- this.hide()
- DbList.clear()
- DbLayout()
- DBHeader()
- DbFill()
-
-
-
- method SetAllRecords() private
-
- rShowed = 'all'
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
- rDbStats = dbMine.getdbstats()
-
- this.hide()
- DbList.clear()
- DbLayout()
- DBHeader()
- DbFill()
-
-
-
- method DeselectAll() private
- iLines = int[]
- iFoo = int
- iCnter = int 1
- bExit = boolean 0
-
- iLines = DBList.getSelectedIndexes()
- do
- iFoo = iLines[0]
- catch ArrayIndexOutOfBoundsException
- return
- end
-
- loop while bExit = 0
- iFoo = iLines[iCnter - 1]
- iCnter = iCnter + 1
- catch ArrayIndexOutOfBoundsException
- bExit = 1
- end
-
- this.hide()
- loop iFoo = 1 to (iCnter-1) /* Records */
- DBList.deselect(iLines[iFoo-1])
- end
- this.show()
-
-
-
- method SelectAll() private
- iCnter = int
- iRows = int
-
- iRows = DBList.countItems()
- if iRows > 0 then
- do
- this.hide()
- loop iCnter = 1 to (iRows-1)
- DBList.select(iCnter)
- end
- this.show()
- end
-
-
-
- method PackIt() private
- iCnter = int
-
- if rCurrentDb = "" then return
-
- dbmine.pack()
-
- /* Now reset the current visualization */
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
- dbMine.connect(rCurrentDb)
- rRecordStr = dbMine.getdbinfo()
- iIdx=0
- loop iCnter = 1 to rRecordStr[0,0]
- if (rRecordStr[iCnter, 2]).left(4)="ISAM" then iIdx = iCnter
- end
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
-
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- DbToolsLayout()
-
-
-
- method SetFilter() private
- rFArr = Rexx[100]
- rFilter2 = Rexx
- rNext = Rexx
- iCount = int 0
-
- rFilter = tfCrName.getText()
- rFilter2 = rFilter
-
- if rFilter \= "" then
- do
- loop until rFilter2 = ""
- iCount = iCount + 1
- parse rFilter2 rNext '.&.' rFilter2
- rFarr[iCount] = rNext
- end
- rFarr[0] = iCount
- end
- else
- rFarr[0] = ""
-
- dbMine.definefilter(rFarr)
-
- rRecArr = dbMine.loadrec(iIdx, rShowed, "1", 1)
- rDbStats = dbMine.getdbstats()
- this.hide()
- DbList.clear()
- DBHeader()
- DbFill()
- RecordsLayout()
-
-
-
- -- The next three routines were coded by Giuseppe Aprile, a RXDbase user.
- -- They convert a .dat file into .dbf and viceversa.
-
- method ConvertDbfToDat( FilesIn = Rexx, FilesOut = Rexx) private
- FilesDbt = Rexx
- IsDbt = 0
- astruct = Rexx[7]
- File1 = RXFile()
- File2 = RXFile()
- File3 = RXDbase()
- File4 = RXFile()
- File1.stream(FilesIn, "c","open read")
- bytes = File1.charin(0,32)
-
- -- Check the first byte:
- -- if = '3'.x2c() then it's a .dbf file
- -- if = '83'.x2c() then it's a .dbf with associated .dbt
-
- If bytes.Substr(1,1) <> '3'.d2c() & bytes.Substr(1,1) <> '83'.x2c() then
- do
- exit
- end
-
- If bytes.Substr(1,1) = '83'.x2c() then
- do
- FilesDbt = FilesIn.substr(1,FilesIn.length - 4) || '.dbt'
- If (File2.stream(FilesDbt, "c","query exists")).length() = 0 Then
- do
- -- The associated .DBT file does not exist
- IsDbt = 0
- end
- Else
- do
-
- -- Open the associated .dbt file
-
- IsDbt = 1
- File2.stream(FilesDbt, "c","open read")
-
- File4.Delete('_$$$.dbt')
- File4 = null
- File4 = RXFile()
- File4.stream('_$$$.dbt', "c", "open write")
- end
- end
- astruct[1] = bytes.substr(2,1)
- astruct[1] = astruct[1].c2x
- astruct[1] = astruct[1].x2d -- Year last updated
-
- astruct[2] = bytes.substr(3,1)
- astruct[2] = astruct[2].c2x
- astruct[2] = astruct[2].x2d -- Month last updated
-
- astruct[3] = bytes.substr(4,1)
- astruct[3] = astruct[3].c2x
- astruct[3] = astruct[3].x2d -- Day last updated
-
- astruct[4] = bytes.substr(5,4).reverse
- cTemp = ''
- loop i=1 to 4
- cTemp = cTemp || aStruct[4].substr(i,1).c2x
- end
- astruct[4] = cTemp.x2d -- Number of records
-
- astruct[5] = bytes.substr(9,2).reverse
- cTemp = ''
- loop i=1 to 2
- cTemp = cTemp || aStruct[5].substr(i,1).c2x
- end
- astruct[5] = cTemp.x2d -- Header lenght
-
- -- the number of .dbf fields can be obtained by subtracting
- -- 34 bytes to the header lenght and dividing the result by 32,
- -- which is the field fixed lenght.
-
- nCampi = (aStruct[5]-34) % 32
-
- astruct[6] = bytes.substr(11,2).reverse
- cTemp = ''
- loop i=1 to 2
- cTemp = cTemp || aStruct[6].substr(i,1).c2x
- end
- astruct[6] = cTemp.x2d -- Record lenght
-
- -- Start reading the field definitions - .dbf structure
-
- aTypeField = Rexx[nCampi+1]
- astructRec = Rexx[nCampi+1,3]
- rRec = Rexx[nCampi+1,aStruct[4]+1]
- aStructRec[0,0] = nCampi
-
- loop i=1 to nCampi
- bytes = File1.charin(0,32)
- cTemp1=bytes.substr(1,11)
- cTemp2=''
- loop k=1 to 11
- if cTemp1.SubStr(k,1) = '0'.d2c then leave
- cTemp2 = ctemp2 || cTemp1.SubStr(k,1)
- end
- aStructRec[i,0] = 0
- aStructRec[i,1] = cTemp2
- aStructRec[i,2] = 'NONE0'
- aTypeField[i] = bytes.substr(12,1)
- cTemp1=bytes.substr(17,1).c2x.x2d
- cTemp2=bytes.substr(18,1).c2x.x2d
- If aTypeField[i] = 'C' & cTemp2 > 0 then
- do
- aStructRec[i,0] = cTemp2 * 256 + cTemp1
- End
- Else aStructRec[i,0] = cTemp1 -- (+cTemp2)
- -- aStructRec[i,0] = cTemp1 -- (+cTemp2)
- end
-
- -- Create _$$$.dat
-
- aStructRec[1,2] = 'ISAM00' -- index on the first field only
- File3.Deletedb('_$$$')
- File3 = null
- File3 = RXDbase()
- File3.connect('_$$$',aStructRec)
-
- -- Start reading the dbf
-
- bytes = File1.charin(0,2)
-
- -- Start converting dbf => dat
-
- rRec[0,0] = aStruct[4]
- Loop i = 1 to aStruct[4]
- bytes = File1.charin(0,aStruct[6])
- nPos = 1
- loop k = 1 to nCampi
- rRec[k,i] = Bytes.substr(nPos+1,aStructRec[k,0])
- If aTypeField[k].upper = 'L' then
- do
- If rRec[k,i] = ' ' && rRec[k,1] = 'F' then
- rRec[k,i] = 'N'
- else rRec[k,i] = 'S'
- end
- If aTypeField[k].upper = 'M' & IsDbt = 1 then
- do
-
- -- Calculate the memo start point
-
- nPosByte = rRec[k,i] * 512
-
- -- move the pointer to nPosByte
-
- File2.stream("c",'seek =1')
- File2.charin(0,nPosByte)
-
- -- Read the first 512 bytes
-
- bytesDbt = File2.charin(0,512)
-
- -- Write a reference to the temporary file
-
- File4.Lineout("Record " i )
-
- -- loop if record lenght > 512 bytes
-
- Loop forever
-
- -- check for end of record signature (1A Hex)
-
- PosStr = BytesDbt.pos('1A'.x2c)
- If PosStr > 0 then
-
- -- End of record signature exists.
- -- Write bytes up to the e.o.r.s.
- -- Close the loop
-
- do
- File4.LineOut(BytesDbt.left(PosStr-1))
- leave
- end
- else
-
- -- End of record signature does not exist.
- -- Write the bytes read without a CR-LF
- -- Read some 512 bytes more
-
- do
- File4.CharOut(BytesDbt)
- BytesDbt = File2.charin(0,512)
- end
- End
- end
-
- nPos = nPos + aStructRec[k,0]
- End
- End
-
- file3.saverec(rRec,"OVERWRITE")
-
- -- Close all open files
-
- file3.disconnect()
- File3 = null
- File1.Stream("c","close")
- File1 = null
- File2.Stream("c","close")
- File2 = null
- File4.Stream("c","close")
- File4 = null
-
- -- ConvFile = ConnectSave("Pick a name for the db (use no extension)")
-
- If FilesOut.Right(4) \= '____' Then
- do
- File4 = RXFile()
- File4.Rename("_$$$.dat", FilesOut || '.dat')
- File4.Rename("_$$$1___.idx", FilesOut || '1___.idx')
- If IsDbt = 1 then
- do
- File4.Rename("_$$$.dbt", FilesOut || '.dbt')
- end
- File4 = Null
- end
-
-
- method ConvertDatToDbf( FilesIn = Rexx , FilesOut = Rexx ) private
- cTemp = Rexx null
- astruct = Rexx[7]
- File1 = RXFile()
- File3 = RXDbase()
- Header = Rexx
- RecHeader = Rexx
- dDate = Date()
- If FilesIn.lower.right(4) = '.dat' then;
- FilesIn = FilesIn.Left(FilesIn.Length() - 4 )
-
- -- Open .dat file
- File3.Connect(FilesIn)
-
- -- Retrieve .dat file structure
- rRecStructDat=File3.getdbinfo()
-
-
- -- Retrieve .dat file N.o.R.
- nRecInDat=File3.getdbstats()
-
-
- -- Declare array structure of the .dbf file
- rRecStructDbf= Rexx[ rRecStructDat[0,0] + 1 , 5 ]
- rRecStructDbf[0,0] = 2
-
- -- Convert to .dbf file structure
- nIndex = 0
- loop i = 1 to rRecStructDat[0,0]
- if rRecStructDat[i,2].left(4) = 'ISAM' & nIndex = 0 then nIndex = i
-
- rRecStructDbf[i,1]= rRecStructDat[i,1].left(10,' ')
- rRecStructDbf[i,2]= 'C'
-
- If rRecStructDat[i,0] < 256 then
- do
- rRecStructDbf[i,3]=rRecStructDat[i,0]
- rRecStructDbf[i,4]=0
- end
- else
- do
- rRecStructDbf[i,3]= rRecStructDat[i,0] // 256
- rRecStructDbf[i,4]= rRecStructDat[i,0] % 256
- end
- end
-
- -- Open/Create the .dbf file
- File1.Delete(FilesOut)
- File1 = Null
- File1=RXFile()
- File1.stream(FilesOut,"c","open write")
-
- -- Creating .dbf file Header
-
- cTemp = dDate.GetYear()
- cTemp = cTemp.d2c()
- astruct[1] = cTemp -- Year last updated
-
- cTemp = dDate.GetMonth() + 1
- cTemp = cTemp.d2c()
- astruct[2] = cTemp -- Month last updated
-
- cTemp = dDate.GetDate()
- cTemp = cTemp.d2c()
- astruct[3] = cTemp -- Day last updated
-
- cTemp = nRecInDat[2].d2x(8)
- cTemp = xtoc(cTemp)
- cTemp = cTemp.reverse -- Number of records
- aStruct[4] = cTemp
-
-
- cTemp = (34 + rRecStructDat[0,0] * 32 ).d2x(4)
- cTemp = xtoc(cTemp)
- cTemp = cTemp.reverse -- Header lenght
- astruct[5] = cTemp
-
- -- Calculating record length
- nTemp = 0
-
- loop i = 1 to rRecStructDat[0,0]
- If rRecStructDbf[i,4] > 0 then
- do
- nTemp = nTemp + rRecstructDbf[i,4] * 256 + rRecStructDbf[i,3]
- end
- else
- do
- nTemp = nTemp + rRecStructDbf[i,3]
- end
-
- end
- nTemp = nTemp + 1
- cTemp = nTemp.d2x(4)
- cTemp = xToc(cTemp)
- cTemp = cTemp.reverse
- astruct[6] = cTemp -- Record lenght
-
- Header = '3'.d2c || aStruct[1] || aStruct[2] || aStruct[3] || aStruct[4] || aStruct[5] || aStruct[6]
- cZero = '0'.d2c
- Header = Header.left(32,cZero)
-
- RecHeader = ''
-
- loop i = 1 to rRecStructDat[0,0]
- cTemp = rRecStructDbf[i,1] || '0'.d2c
- RecHeader = RecHeader || cTemp
- cTemp = rRecStructDbf[i,2].left(5,cZero)
- RecHeader = RecHeader || cTemp
- cTemp = rRecStructDbf[i,3].d2c
- RecHeader = RecHeader || cTemp
- cTemp = rRecStructDbf[i,4].d2c
- RecHeader = RecHeader || cTemp.Left(15,cZero)
- cTemp = Null
- end
-
- RecHeader = RecHeader || '13'.d2c || '0'.d2c
-
- File1.CharOut(Header)
- File1.CharOut(RecHeader)
-
- -- Loading .dat file records
-
- File3.disconnect()
- File3=Null
- File3=RXDbase()
- File3.connect(FilesIn)
-
- rRec = File3.loadrec(nIndex, 'all', "1", 1)
-
- loop i = 1 to rRec[0,0]
- cTemp = ' '
-
- loop k = 1 to rRecStructDat[0,0]
- cTemp = cTemp || rRec[k,i]
- end
-
- File1.CharOut(cTemp)
-
- end
-
- -- Writing End of file signature
- File1.CharOut('26'.d2c)
-
- -- Close all open files
- file3.disconnect()
- file3 = null
-
- File1.stream("c","close")
- File1 = Null
-
- -- Method xToc(InByte = Rexx)
- --
- -- This function derived from the x2c method of the xstring class published
- -- by P.A. Marchesini under the GNU General Public License of the Free
- -- Software Foundation
- --
-
- method xToc(InByte = Rexx)
- RetVal = ''
- loop while InByte <> ''
- parse InByte ch +2 InByte
- RetVal = RetVal || ch.x2c()
- end
- return RetVal
-
-
- method DATtoDBF
- OpenFileDialog = FileDialog(this, rTXTChoose)
- OpenFileDialog2 = FileDialog(this, rTXTChooseDBF)
- InFile = Rexx
- OutFile = Rexx
- rStdString = Rexx"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
- File1 = RXFile()
-
- DbList.clear()
- DbList.reshape(0, 0, (fm.stringWidth(rStdString) * 4) % 1, fm.getHeight() * (5));
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
-
- OpenFileDialog.show()
- if OpenFileDialog.getFile = null then
- do
- DbList.addItem(rTXTFileNotPresent)
- return
- end
- InFile = OpenFileDialog.getFile
-
- if (InFile.right(4, ' ')).upper() \= '.DAT' then
- InFile = InFile || ".dat"
- if (File1.stream(InFile, "c", "query exists")).length() = 0 then
- do
- DbList.addItem(rTXTFileNotPresent)
- return
- end
-
- OpenFileDialog2.show()
- if OpenFileDialog2.getFile = null then
- do
- DbList.addItem(rTXTFileNotPresent)
- return
- end
- OutFile = OpenFileDialog2.getFile
-
- if (OutFile.right(4, ' ')).upper() \= '.DBF' then
- OutFile = OutFile || ".dbf"
-
- DbList.addItem(InFile"-->"OutFile)
- DbList.reshape(0, 0, (fm.stringWidth(DbList.getItem(DbList.countItems() - 1)) * 4) % 1, fm.getHeight() * (5));
-
- ConvertDatToDbf(InFile, OutFile)
-
- DBList.addItem(rTXTEnd)
-
-
- method DBFtoDAT
- OpenFileDialog = FileDialog(this, rTXTChooseDBF)
- OpenFileDialog2 = FileDialog(this, rTXTChoose)
- InFile = Rexx
- OutFile = Rexx
- rStdString = Rexx"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
- File1 = RXFile()
-
- DbList.clear()
- DbList.reshape(0, 0, (fm.stringWidth(rStdString) * 4) % 1, fm.getHeight() * (5));
- dbMine.disconnect()
- dbMine = null
- dbMine = RXDbase()
-
- OpenFileDialog.show()
- if OpenFileDialog.getFile = null then
- do
- DbList.addItem(rTXTFileNotPresent)
- return
- end
- InFile = OpenFileDialog.getFile
-
- if (InFile.right(4, ' ')).upper() \= '.DBF' then
- InFile = InFile || ".dbf"
- if (File1.stream(InFile, "c", "query exists")).length() = 0 then
- do
- DbList.addItem(rTXTFileNotPresent)
- return
- end
-
- OpenFileDialog2.show()
- if OpenFileDialog2.getFile = null then
- do
- DbList.addItem(rTXTFileNotPresent)
- return
- end
-
- OutFile = OpenFileDialog2.getFile
-
- if (OutFile.right(4, ' ')).upper() \= '.DAT' then
- OutFile = OutFile || ".dat"
-
- DbList.addItem(InFile"-->"OutFile)
-
- ConvertDbfToDat(InFile, OutFile.left(OutFile.length - 4))
-
- DBList.addItem(rTXTEnd)
-
-
-
-