DATA PROCESSING MACHINE FOR AUTOMATICALLY CHANGING DATA FORMATS

Abstract: A data processing machine which is controlled to produce graphical output from stored sets of data. The data sets may be stored in the non-uniform manner. The machine is controlled to determine column boundaries in each row of a data set and then to determine column boundaries in each row of a data set and then to determine which rows of the set have missing items. Data sets can then be reformatted as graphs or similar representations. The machine takes away the constraint on users to accurately enter data items into specific slots in a table or date set.

Description: This invention relates to data processing machines and in particular to such machines that are controlled to produce graphical output from numerical data. One of the major advantages of data processing machines is the ability to change the format in which data is presented in either visual display or printed form. Machines are controlled, using a suitable graphics control program such as the IBM Graphics Data Display Manager (GDDM) (IBM and GDDM are trade marks of the IBM Corporation), to manipulate sets of data and produce almost any form of graph (bar charts, pie charts, line graphs etc.,). European Patent No. 26266 describes the basic operation of a graphics control program. A digital data display system in which the display device includes a plurality of random access stores into which character cell definitions are loaded from a remote central processing unit. A character cell may be a 9 x 16 picture element matrix and each is defined in the c.p.u. according to the requirements of a display request received from a users application program. The system control services include a graphics manager and graphics routines which construct a character buffer and character cell definition table according to the picture to be displayed. A character cell definition that is required more than once in a picture is only included once in the definition table, the character buffer having the required number of pointers to the one definition. When the character buffer and character definition table have been constructed they are transmitted to the display device using a data communication system. The system can be used for colour or monochrome displays. A class of application programs process data which generally takes the form of a two-dimensional table. Spreadsheets are a notable example. Business charting programs are another - typically a table may include a number of 'sets' of values, with conceptually the same number of items in each set (though some may in fact be missing). For example, the machine may be used to plot sales of a range of products for a number of months: Jan Feb Mar Apr May Televisions 45 67 66 98 78 Refrigerators 19 24 67 80 Toasters 50 55 51 46 Business charting programs normally have a Data Entry facility in which the display screen is formatted into uniform rows and columns of fields, into which the user can type values. However, manual data entry is tedious and error-prone, and many users already have tabular files stored in their computer which they would prefer the charting program to use. These tabular files may be 'soft' copies of printed reports, with regular columns of numbers, or they may be less formal files maintained by the user for his or her own convenience. The latter have the characteristic that the columns may be rather ragged in appearance - the human eye can distinguish the columns and recognise where values are 'missing'. The problem with these tabular files for the business charting program lies in understanding the format without too much analysis (which could be time-consuming and therefore frustrating to the user). A solution which the GDDM PFG Interactive Chart Utility uses is to require the user to identify the columns of numbers, by 'marking' the top-left and bottom-right positions of each column. This identification can then be saved for future use. The disadvantage is that the 'marking' process is awkward to learn and use, and the identification may lose its validity if the user's columns of numbers become more ragged as he adds more numbers from day to day. Further prior art as specified in the preambles of Claims 1 and 4 is disclosed in EP-A-0 075 743. The alternative solution provided by the present invention analyses the table automatically with relatively little processing being required - a scan involving a logical 'OR' on each line in the table to establish the column positions, then a scan to extract values. 'Missing' values are recognised, even when they occur on the first line in the table. Because the process is economical, the table can reasonably be analysed every time values are extracted from it rather than relying on a format identification which may have become out-of-date. The relevance of the process to spreadsheets is that a spreadsheet can potentially be exported to any different spreadsheet program, with different cell sizes, without the importing spreadsheet program needing specific information about the format of the spreadsheet being imported. According to the invention there is provided a data processing machine operable to automatically deduce the format of data to be printed or displayed and in which a set of stored data, nominally arranged in rows and columns, may have items missing and/or be stored in a non-uniform manner, characterised by: means for constructing and storing a mask of blank characters as long as the longest row in the set; and means for taking each row of the set in turn and performing a logical OR operation on it with the mask and restoring the cumulative result of the OR operation so that after processing the final row the mask contains a non-blank character in every position for which there is a corresponding character in at least one row of the set. In order that the invention may be fully understood a preferred embodiment will now be described with reference to the accompanying drawings, in which: FIG. 1 is a schematic diagram of a machine embodying the invention. FIGS. 2 and 3 are flow charts illustrating the steps of the preferred embodiment. A data processing machine which embodies the present invention is illustrated in Figure 1. The machine includes a processor 20, a random access store 11, a read only store 22, a display monitor 23, a keyboard 24 and a printer/plotter 25. A disc or tape storage device 16 is connected either directly or remotely to the processor 20. The processor 20 may be a microprocessor such as is found in the IBM Personal Computer (PS/2) or be a host processor connected to the other components through a data link. Data that have been processed and are not currently being used are stored on the disc store 26, data currently being processed are stored in the random access memory 21. The control of the machine is by program stored in the read only memory 22. A user may select control function by inputting commands at the keyboard 24 and data re entered into the machine either directly by a user through the keyboard or from a remote location over a communication link. Data are displayed in the selected format on the display monitor 23 and may be printed or plotted by the device 25. The machine is controlled by a series of electrical pulses which enable and disable logic circuit elements in the processor. The sequence of electric pulses is determined by the control program stored in the ROM 22. A particular embodiment of the invention will now be described with reference to the flow charts of Figures 2 and 3. To make for an easier understanding of the invention it will first be described way of example. PURPOSE To find columns of numbers in a rectangular area (table), typically a sequential file or part thereof. It is not known at the outset how many columns there may be, and the columns themselves may be ragged left or right edges, or both. The columns may not be complete - they may start or end away from the edges of the rectangular area, and they may contain gaps (missing values). The procedure must be efficient, since large quantities of data may be involved and the user may be waiting for results at the terminal. The columns in this example are extremely ragged, but the human eye can tell which numbers belong in which columns. APPLICATIONS Many graph-producing packages will extract numbers from a sequential file, as input values for making a graph. They normally require the sequential file to be in fixed format, with columns of numbers in predetermined positions. Alternatively they require the user to define exactly where each column of numbers lies. The first alternative is too restrictive - people want to be able to input tables of numbers from reports, which are unlikely to be in the required format. The second alternative tends to be laborious. Moreover, the format definition may lose its validity on future executions of the program, by which time the sequential file may have changed its format (as new numbers are added to it by someone who is unaware of the constraints of the format definition). THE PROGRAM Two passes are made through the table. The first pass detects the columns of numbers, while the second pass extracts them. The first pass This pass detects columns of numbers by noting the presence of 'rivers'. A river is a column of all-blanks. Adjacent columns of all-blanks are merged to form a single river. The left and right margins of the area are also regarded as all-blank. The strips between the rivers must, by definition, contain the columns of numbers. The technique is to start with a mask of all-blanks, as long as the width of the table. Each row of the table is successively OR'ed into the mask. At the end of the process the mask will contain sequences of blanks corresponding to rivers in the table, with sequences of non-blanks in the mask corresponding to columns of numbers. The second pass The mask is applied to each row of the table, and numbers are extracted according to the position in the mask of sequences of non-blanks. An all-blank 'number' within a number column is regarded as a 'missing value'. WORKED EXAMPLE This is how the method works in practice. First, the original table: Next, see how the mask develops as lines of the table are OR'ed with it: The table can now be scanned in conjunction with the mask to produce the following interpretation of the columns. Referring now to Figures 2 and 3 the steps of the preferred embodiment of the invention are shown, FIG 2 is the first pass of the mask and FIG 3 the second. Step 1 (FIG. 2) The register containing the mask is cleared to all blanks. The register is defined as part of the RAM store 21 and has a number of character positions equal to or greater than the number of character positions in the largest row of the data being processed. Step 2 Two registers NL and I are defined in the RAM 21 and NL is set with a value equal to the number of rows or lines in the table or data set. I is set with a value equal to 1. Step 3 The processor 20 compares the contents of I with NL to determine if I > NL. If the determination is positive then the control moves to the second pass starting at Step 6 (FIG 3). If not then the control proceeds to the next step 4. Step 4 The processor performs the operation of logically OR'ing the I th row of the table with the mask. To do this the character indication of each character position in turn are read from the mask register and the table row and input to a logical OR circuit and the output of the circuit is fed back to the character position in the mask register. Step 5 At the conclusion of step 4 the content of register I is incremented by 1 and control is passed back to step 3. This loop is repeated until the determination at Step 3 is positive indicating that all the rows or lines have been processed. The mask register will now contain non-blank for all the column positions in the table with blanks between each column as is shown in the final line of Table 2 in the example above. Step 6 (FIG 3) A register K is defined in the RAM 21 and the number of non-blank strings in the mask register is counted and the value entered into K. (In the example above K = 5). The value in register I is reset to 1. An area of RAM 21 is defined into which the entries for the columns of the table or data set will be put. The column area will be indexed 1 - K where K is the value in register K. Step 7 This is a repeat of step 3 except that in this case when I > NL provides a positive output then the process is finished. Step 8 A register IN is defined in RAM 21 and set to a value 1. Step 9 Determines whether the value in register IN is greater than the value in register K. If the result is positive then control passes to step 12. If not then on to step 10. Step 10 Row I of the table is transferred to a register in RAM 21. The characters corresponding to the non blank string IN in the mask are transferred to the column IN data set in RAM 21. If the row has no entries at the IN th position then a value for example 10⁷⁸ is entered into the column area. Such an entry indicates to the machine when formatting the data that it represents a missing or neutral value and is to be disregarded when plotting graphs or calculating averages etc. Step 11 The value in register IN is increased by 1 and control is returned to step 9. Step 12 The value in register I is increased by 1 and control is returned to step 7. When the process is finished data sets equivalent to the number of column will have been built up in RAM 21, as is illustrated above in Table 3. The bounds of the columns are then clearly defined and the data is in a form that can be changed or reformatted by other processes such as the graphics data display manager mentioned above. The control system of the machine that embodies the invention may be implemented in one of several ways, well known in the art. The control which is in the form of a series of instructions can be permanently stored in the ROM 22, or it may be stored as a routine in the store 26 and loaded into the RAM 21 only when required for use. Other methods include a specifically design semiconductor chip which has the control system built into its topography when the chip is designed and manufactured.

Claims: A data processing machine operable to automatically deduce the format of data to be printed or displayed and in which a set of stored data, nominally arranged in rows and columns, may have items missing and/or be stored in a non-uniform manner, characterised by means (1) for constructing and storing a mask of blank characters as long as the longest row in the set; and means (2-5) for taking each row of the set in turn and performing a logical OR operation on it with the mask and restoring the cumulative result of the OR operation so that after processing the final row the mask contains a non-blank character in every position for which there is a corresponding character in at least one row of the set. A data processing machine as claimed in claim 1, further comprising: means (6-12) for determining the number of non-blank strings in the cumulative mask and constructing a data sub set for each non blank string comprising the corresponding items from the rows of the set of data. A data processing machine as claimed in claim 2, further comprising means for entering into the data sub sets an indication of missing or neutral values from the set of data. A method of controlling a data processing machine which is operable to automatically deduce the format of data to be printed or displayed and in which a set of stored data, nominally arranged in rows and columns, may have items missing and/or be stored in a non-uniform manner, characterised by the steps of: a) constructing and storing a mask of blank characters as long as the longest row in the set: and b) taking each row of the set in turn and performing a logical OR operation on it with the mask and restoring the cumulative result of the OR operation so that after processing the final row the mask contains a non-blank character in every position for which there is a corresponding character in at least one row of the set. A method as claimed in claim 4, further comprising the step of (c) determining the number of non-blank strings in the cummulative mask and constructing a data sub set for each non blank string comprising the corresponding items from the rows of the set of data. A method as claimed in claim 5, further comprising the step of (d) entering into the data sub sets an indication of missing or neutral values from the set of data.

Inventors: HEALEY, MARTIN JAMES RONAN
Applicants: INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1987
Main classification: G06F15
IPC codes: G06F3, G09G5, G06F17, G06K15, B41J21