!FORMS$CHECKING_BASIC_COMMON.BAS ! ! © Copyright 2005 Hewlett-Packard Development Company, L.P. ! ! Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ! Computer Software Documentation, and Technical Data for Commercial ! Items are licensed to the U.S. Government under vendor's standard ! commercial license. ! ! This is the BASIC common declaration included in all the subroutines ! of the BASIC sample checking application for DECforms V4.0. ! ! Status of the return from a FORMS$... call. It's recommended ! to check status after every call. ! DECLARE INTEGER forms_status ! ! Receive control text is an array of up to five five-character ! control text items returned by the FORMS$... calls. The call ! also returns a count. ! RECORD receive_ctl_rec VARIANT CASE STRING receive_ctl_txt(4) =5 CASE STRING receive_ctl_txt_string =25 END VARIANT END RECORD receive_ctl_rec ! ! Send control text is an array of up to five five-character control ! text items sent to the FORMS$... calls. The call also requires a ! count. This program doesn't treat it as an array, but as a string ! since it only uses the first position in the array. ! RECORD send_ctl_rec STRING send_ctl_txt_string =25 END RECORD send_ctl_rec !+ ! Records passed to DECforms and/or the data file. ! ! The ACCOUNT record is stored in the data file. ! It is sent to the form at the beginning of the program to set the ! form data variables. ! It is received when account updating is to be done. ! ! Note that this and all records passed to DECforms must be passed ! by descriptor. It's easiest to do this by declaring a variant ! for the record which is a string; BASIC's default mechanism for ! strings is by descriptor. !- RECORD account_rec VARIANT CASE LONG account_number STRING date_established = 8 LONG zip_code STRING last_name = 20 STRING first_name = 15 STRING middle_name =15 STRING street = 30 STRING city = 20 STRING state = 2 STRING home_phone = 10 STRING work_phone = 10 STRING password = 12 STRING account_pad = 2 ! padding for VAX/AXP compatibility CASE STRING account_string =152 END VARIANT END RECORD account_rec !+ ! CHOICE record is the record that comes back with the operator's ! choice. The first record field, operator_choice, has the choice type. ! In the case of a check, a deposit, a withdrawal, or a transfer between ! accounts, there is also an amount, and possible some subsidiary ! information (memo and amount). For the other choices, the ! subsidiary information is not defined. RECORD choice_rec VARIANT CASE INTEGER operator_choice ! Valid transaction type INTEGER amount ! Positive from form, ! Positive or negative in program STRING current_date=8 ! VAX DATE STRING memo=35 ! Reminder of transaction BYTE choice_pad ! Padding for VAX/AXP compatibility CASE STRING choice_string =52 END VARIANT END RECORD choice_rec ! ! The account register and related variables ! ! The REGISTER keeps track of all checks written and all deposits made, ! one entry for each check or deposit. For simplicity in the application, ! we keep only 30 register records. A real application would be much ! more complex. ! RECORD register_entry_rec LONG reg_check_num STRING reg_date = 8 LONG reg_amount LONG reg_balance STRING reg_mem = 35 BYTE reg_tax_ded END RECORD register_entry_rec DECLARE INTEGER CONSTANT reg_size = 30 DECLARE INTEGER CONSTANT reg_max_sub = 29 RECORD register_rec VARIANT CASE INTEGER number_entries_used register_entry_rec reg(reg_max_sub) CASE STRING register_string = 1684 END VARIANT END RECORD register_rec COMMON register_rec register, & account_rec account, & INTEGER last_check_num, & INTEGER checking_balance, & INTEGER savings_balance, & INTEGER receive_ctl_txt_ct, & receive_ctl_rec receive_ctl, & INTEGER send_ctl_txt_ct, & send_ctl_rec send_ctl, & STRING session_id = 16, & choice_rec choice