ABSTRACT

The main purpose of writing computer programs is to deliver useful and actionable information as outputs. This chapter discusses this aspect of computer programming in detail here. Some people, especially in the field of software measurement, make a distinction between enquiry and output. But for computer programmers, both are outputs. The discussion begins with the structure of the output statements and moves on to delivering the output to flat files and database tables. We can deliver the data to flat files in append mode in which the records are appended at the end of the file or overwrite the file, erasing the existing data. In some cases, some platforms allow modifying and updating the existing data in the flat files. All these aspects are discussed. All the important output statements for flat files, including the open statement, the modes of such opening, the close statement, and the write statement, are discussed. Formatting the output data for presentation and the common formatting methods are described. The chapter also discusses different modes of the writing data to flat files and how they appear in the files are presented. Moving on to database tables, we discuss the operations that need to be programmed for delivering output data to database tables, including establishment of a connection with the database, the components of the database connection string, the precautions to be taken while writing the connection sting, including what can go wrong in connecting the database, and the need for error trapping. Then the aspects of opening a table are discussed, including the components of the statement that open a database table using the standard SELECT statement of SQL. The aspects of inserting a new record in the table and updating the information in a record are described in detail. Then we discuss the aspects of delivering outputs to applications like the MS-Excel, MS-Word, PDF, and so on, including the steps in so delivering. Since computers are all-pervasive now, the aspects of sending outputs to machines is also discussed, albeit briefly. Screen is another important destination to deliver outputs to, and it is very important for the programmer to master; it is also discussed in detail. We discuss delivering the bulk outputs to both onto-the-screen as well as onto-the-printer. The importance of control statistics in bulk outputs is discussed, including the information that needs to be included in control statistics. Output onto Internet is also discussed, including the components of the statement.