| |||||||||||||||||||||||||||||||||||||||||
Reading and writing records and lists Description This set of examples shows how to work with advanced data structures when accessing data in spreadsheets and databases:
Further explanation of this example: Xpress Whitepaper 'Using ODBC and other database interfaces with Mosel', Section Examples - Working with lists - Working with records.
Source Files By clicking on a file name, a preview is opened at the bottom of this page. Data Files
recordin1.mos (!****************************************************** Mosel Example Problems ====================== file recordin1.mos `````````````````` Reading records from a text file. (c) 2008 Fair Isaac Corporation author: S. Heipcke, Nov. 2007, rev. Jul. 2010 *******************************************************!) model "Record input (text files)" public declarations PRODUCTS: set of string MACH: range ProdRec = public record Cost: real Duration: integer end-record PDATA: dynamic array(PRODUCTS,MACH) of ProdRec R = 1..9 AllDataRec = public record Product: string Mach: integer Cost: real Duration: integer end-record ALLDATA: array(R) of AllDataRec end-declarations ! **** Reading complete records initializations from "recorddata.dat" PDATA as "ProdData" ALLDATA as "AllData" end-initializations ! Now let us see what we have writeln('PDATA is: ', PDATA) writeln('ALLDATA is: ', ALLDATA) end-model | |||||||||||||||||||||||||||||||||||||||||
© Copyright 2023 Fair Isaac Corporation. |