Example: confidence

INFORMIX-4GL by Example

INFORMIX- 4 GLby ExampleVersion 1999 Part No. 000-5451iiINFORMIX-4GL by ExamplePublished byINFORMIX PressInformix Corporation4100 Bohannon DriveMenlo Park,CA 94025-1032 1999 Informix Corporation. All rights reserved. The following are trademarks of Informix Corporation or itsaffiliates:Answers OnLineTM;CBT StoreTM;C-ISAM ;ClientSDKTM; ContentBaseTM; Cyber PlanetTM; DataBlade ; DataDirectorTM; Decision FrontierTM; Dynamic Scalable ArchitectureTM; Dynamic ServerTM; Dynamic ServerTM,Developer EditionTM; Dynamic ServerTM with Advanced Decision Support OptionTM; Dynamic ServerTM withExtended Parallel OptionTM; Dynamic ServerTM with MetaCube ROLAP Option; Dynamic ServerTM withUniversal Data OptionTM; Dynamic ServerTM with Web Integration OptionTM; Dynamic ServerTM, WorkgroupEditionTM; FastStartTM;4GL for ToolBusTM; If you can imagine it, you can manage itSM; Illustra ;INFORMIX ;Informix Data Warehouse Turning Data Into Business AdvantageTM;INFORMIX -EnterpriseGateway withDRDA ; Informix Enterprise MerchantTM;INFORMIX -4GL; Informix-JWorksTM; InformixLink.

4 Table of Contents Example 2 Displaying a Message Window 43 Defining Global Variables 44 The MAIN Function 44 Displaying Messages in a …

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of INFORMIX-4GL by Example

1 INFORMIX- 4 GLby ExampleVersion 1999 Part No. 000-5451iiINFORMIX-4GL by ExamplePublished byINFORMIX PressInformix Corporation4100 Bohannon DriveMenlo Park,CA 94025-1032 1999 Informix Corporation. All rights reserved. The following are trademarks of Informix Corporation or itsaffiliates:Answers OnLineTM;CBT StoreTM;C-ISAM ;ClientSDKTM; ContentBaseTM; Cyber PlanetTM; DataBlade ; DataDirectorTM; Decision FrontierTM; Dynamic Scalable ArchitectureTM; Dynamic ServerTM; Dynamic ServerTM,Developer EditionTM; Dynamic ServerTM with Advanced Decision Support OptionTM; Dynamic ServerTM withExtended Parallel OptionTM; Dynamic ServerTM with MetaCube ROLAP Option; Dynamic ServerTM withUniversal Data OptionTM; Dynamic ServerTM with Web Integration OptionTM; Dynamic ServerTM, WorkgroupEditionTM; FastStartTM;4GL for ToolBusTM; If you can imagine it, you can manage itSM; Illustra ;INFORMIX ;Informix Data Warehouse Turning Data Into Business AdvantageTM;INFORMIX -EnterpriseGateway withDRDA ; Informix Enterprise MerchantTM;INFORMIX -4GL; Informix-JWorksTM; InformixLink.

2 Informix Session ProxyTM; InfoShelfTM; InterforumTM;I-SPYTM; MediazationTM; MetaCube ; NewEraTM;ON-BarTM; OnLine Dynamic ServerTM; OnLine for NetWare ; OnLine/Secure Dynamic ServerTM; OpenCase ;ORCATM; Regency Support ; Solution Design LabsSM; Solution Design ProgramSM; SuperView ; UniversalDatabase ComponentsTM; Universal Web ConnectTM; ViewPoint ; VisionaryTM; Web Integration SuiteTM. TheInformix logo is registered with the United States Patent and Trademark Office. The DataBlade logo isregistered with the United States Patent and Trademark Team: Elaina Von Haas, Adam Barnett, Mary Leigh Burke, Mary Kraemer, Eileen WollamGOVERNMENT LICENSE RIGHTSS oftware and documentation acquired by or for the US Government are provided with rights as follows:(1) if for civilian agency use, with rights as restricted by vendor s standard license, as prescribed in FAR ;(2) if for Dept.

3 Of Defense use, with rights as restricted by vendor s standard license, unless superseded by anegotiated vendor license, as prescribed in DFARS Any whole or partial reproduction of software ordocumentation marked with this legend must reproduce this ExampleIntroduction 15 About This Manual 15 Summary of Chapters 16 How to Use This Manual 18 How to Use The Examples 18 Typographical Conventions 19 The Demonstration Database and Application Files 19 Creating the Demo Database on Informix Dynamic Server 20 Creating the Demo Database on INFORMIX-SE 21 Copying the Example Files 22 Running an Example 22 Files Used in Each Example 24 Naming Conventions 25 Using the Examples with Prior Releases 25 Additional Documentation 26 Documentation Included with 4GL 26On-Line Manuals 27On-Line Help 27On-Line Error Messages 27 Related Reading 28 Informix Welcomes Your Comments 28 Example 1 Writing a Simple 4GL Program 31 Displaying

4 Information Using a Form 32 The MAIN Function 32 The DISPLAY Statements 33 Function Overview 33 The f_logo Form Specification 34 The MAIN Function 36 The dsply_logo() Function 364 Table of ContentsExample 2 Displaying a Message Window 43 Defining Global Variables 44 The MAIN Function 44 Displaying Messages in a Window 44 Function Overview 45 The GLOBALS Statement and MAIN Function 46 The message_window() Function 48 The init_msgs() Function 52 Example 3 Populating a Ring Menu with Options 55 Opening a Menu 55 Demonstrating the Choice of a Menu Option 56 Executing a Command Supplied by the User 56 Function Overview 56 The MAIN Function 58 The dsply_option() Function 62 The bang() Function 64 The hlpmsgs Message File 66 Example 4 Displaying a Row on a Form 69 Defining Records 70 Returning Values from Functions 70 Entering Information on a Form 71 Selecting Database Information 71 Recovering from Runtime Errors 72 Function Overview 73 The f_custkey and f_custsum Forms 74 The DATABASE and GLOBALS Statements 76 The MAIN Function 76 The cust_summary() Function 78 The get_custnum() Function 80 The get_summary() Function 84 The dsply_summary() Function 86 The tax_rates() Function 88 The prompt_window()

5 Function 88 Example 5 Programming a Query by Example 95 Constructing Criteria from the User s Entry 96 Executing an SQL Query Dynamically 97 Accessing Multiple Rows with Cursors 97 Handling User Interrupts 98 Utility Functions 100 Function Overview 100 Table of Contents5 The f_customer Form 102 The GLOBALS Statement and MAIN Function 104 The query_cust1() Function 106 The answer_yes() Function 114 The msg() Function 114 Example 6 Querying and Updating117 Modifying the Rows Qualified by a Query 117 Checking for Dependent Rows 118 Function Overview 118 The GLOBALS Statement and MAIN Function 120 The query_cust2() Function 120 The browse_custs Function 124 The next_action() Function 126 The change_cust() Function 128 The update_cust() Function 130 The delete_cust() Function 130 The verify_delete() Function 132 The clear_lines() Function 134 Example 7 Validating and Inserting a Row 137 Validating Data Entry 137 Retrieving Information from Multiple Tables 138 Function Overview 138 The f_stock Form 140 The GLOBALS Statement 142 The MAIN Function 142 The input_stock() Function 144 The unique_stock() Function 146 The insert_stock() Function 148 Example 8 Displaying a Screen Array in a Popup Window151 Displaying Information in an Array Form 152 Triggering Form Actions with Keys 153 Function Overview 153 The f_manufsel Form 154 The input_stock2() Function 156 The manuf_popup() Function 1586 Table of ContentsExample 9 Accessing a Table with a Single-Row Form 165 Function Overview 166 The f_statesel Form 168 The MAIN Function 170 The cust_menu1() Function 170 The browse_custs1()

6 Function 172 The next_action2() Function 172 The addupd_cust() Function 174 The state_popup() Function 180 The insert_cust() Function 182 Example 10 Accessing a Table with a Multi-Row Form 185 Modifying Information in an Array Form 186 Handling Empty Fields 186 Identifying Keystrokes 187 Function Overview 189 The f_manuf Form 190 The DATABASE and GLOBALS Statements 192 The MAIN Function 192 The dsply_manuf() Function 194 The valid_null() Function 204 The reshuffle() Function 206 The verify_mdel() Function 208 The choose_op() Function 210 The insert_manuf() Function 210 The update_manuf() Function 212 The delete_manuf() Function 212 The verify_rowid() Function 214 The save_rowid() Function 214 Example 11 Implementing a Master-Detail Relationship 217 Program Overview 217 Function Overview 222 The f_orders Form 224 The f_custsel Form 226 The f_stocksel Form 226 The f_ship Form 228 The DATABASE and GLOBALS Statements 230 The MAIN Function 232 The add_order() Function 232 The input_cust() Function 234 The cust_popup() Function 238 The input_order() Function 240 The input_items() Function 242 Table of Contents7 The renum_items() Function 248 The stock_popup() Function 250 The dsply_taxes() Function 252 The order_amount() Function 254 The ship_order() Function 254 The input_ship() Function 256 The order_tx() Function 258 The insert_order() Function 260 The insert_items()

7 Function 260 Example 12 Displaying an Unknown Number of Rows 263 Paging Through Rows Using Array Form 264 Function Overview 265 The f_ordersel File 266 The GLOBALS Statement 268 The MAIN Function 268 The find_order() Function 270 The cust_popup2() Function 276 The order_popup() Function 282 The calc_order() Function 288 The upd_order() Function 288 Example 13 Calling a C Function 291 The Interface Between C and 4GL 291 The Argument Stack 291 Passing Arguments to a C Function 292 Returning Values from a C Function 292 The Module 293 Using fglgets() 293 The Design of fglgets() 294 Returning Both a Value and a Code 294 Handling Arguments 296 Running the Example 297 Creating the Executable Files 298 Calling the Executable File 299C Module Overview 300 Function Overview 301 The f_name Form 302 The MAIN Function 304 The fdump() Function 3068 Table of ContentsThe Module 308 The Module 310 The getquote() Function 312 The fglgetret() Function 312 The fglgets() Function 314 Example 14 Generating a Report 319 The Program Model 320 Steps in Generating a Report 320 Basic Parts of a Report 321 Directing a Report to the Screen 323 Function Overview 323 The MAIN Function 324 The manuf_listing() Function 324 The manuf_rpt()

8 Report Function 326 Example 15 Reporting Group Totals329 Choosing a Report Destination 329 The Report Contents 331 Function Overview 332 The DATABASE and GLOBALS Statements 334 The MAIN Function 334 The add_order2() Function 336 The invoice() Function 338 The report_output() Function 340 The invoice_rpt() Report Function 342 Example 16 Creating Vertical Menus 351A Hard-Coded Vertical Menu Example 16a 352A Generic Vertical Menu Example 16b 353 Example 16a: The f_menu Form 356 The DATABASE and GLOBALS Statements 358 The MAIN Function 358 The main_menu() Function 358 The cust_maint() Function 360 The Remaining maint() Functions 360 Example 16b: The f_menu2 Form 362 The DATABASE and GLOBALS Statements 364 The MAIN Function 364 The dsply_menu() Function 364 The init_menu() Function 366 The init_opnum() Function 368 The choose_option() Function 368 Table of Contents9 Example 17 Using the DATETIME Data Type373 Redefining the DATETIME Data Entry 373 Conserving Screen Space 375 Function Overview 376 The f_custcall Form 378 The f_edit Form 380 The DATABASE and GLOBALS Statements 382 The MAIN Function 384 The cust_menu2() Function 384 The browse_custs2() Function 386 The next_action3() Function 386 The open_calls() Function 388 The call_menu() Function 388 The addupd_call() Function 390 The input_call() Function 392 The browse_calls() Function 404 The nxtact_call() Function 406 The get_timeflds() Function 408 The get_datetime()

9 Function 410 The init_time() Function 410 The edit_descr() Function 412 The insert_call() Function 414 The update_call() Function 416 Example 18 Using TEXT and VARCHAR Data Types419 Verifying the Database Type 419 Positioning the DATABASE Statement in a Program 419 Using Parallel Arrays to Manage Information 421 Handling VARCHAR Data 422 Handling TEXT Data 422 Handling BYTE Data 423 Function Overview 424 The f_catalog Form 426 The f_catadv Form 428 The f_catdescr Form 430 The DATABASE and GLOBALS Statements 432 The MAIN Function 432 The is_online() Function 434 The load_arrays() Function 436 The open_wins() Function 44010 Table of ContentsThe close_wins() Function 440 The dsply_cat() Function 440 The show_advert() Function 442 The show_descr() Function 446 The upd_err() Function 448 Example 19 Browsing with a Scroll Cursor 451 The Main Function 451 The Browsing Function 452A Simple Approach to Scrolling 453 Fetching Ahead 453 Manipulating the Menu 454 Error Handling 454 Function Overview 455 The DATABASE and GLOBALS Statements 456 The MAIN Function 456 The scroller_1() Function 458 Example 20 Combining Criteria from Successive Queries 465 The Main Function 465 The Browsing Function 466 Revising a Query 467 Displaying the Search Criteria 467 The Query By Example Functions 468 The answer() Function 468 Function Overview 469 The f_answer Form 470 The MAIN Function 472 The scroller_2() Function 472 The query_cust3a() Function 476 The answer()

10 Function 478 Example 21 Using an Update Cursor 483 Displaying Multiple Forms 483 Updating Rows 484 Using an Update Cursor 485 Handling Locked Rows 486 Function Overview 487 The f_date Form 488 The f_payord Form 488 The DATABASE and GLOBALS Statements 490 The MAIN Function 490 The input_date() Function 492 Table of Contents11 The open_ckey() Function 494 The close_ckey() Function 494 The find_cust() Function 494 The find_unpaid() Function 500 The pay_orders() Function 502 Example 22 Determining Database Features 509 The SQLAWARN Array 509 Opening the Database 510 Conditional Transactions 510 Function Overview 511 The GLOBALS Statement and MAIN Function 512 The open_db() Function 514 The begin_wk() Function 516 The commit_wk() Function 518 The rollback_wk() Function 518 Example 23 Handling Locked Rows 521 Locks and Transactions 522 Testing for Locked Rows 523 Running the Lock Test 523 Function Overview 525 The DATABASE Statement and MAIN Function 526 Th


Related search queries