FORM error
Posted in 1996
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Gurus,
Please help. I am having a problem which I don't understand. I have a
user defined query which is defined in the CONSTRUCT. This query retrieves
approx., 20+ elemennts of data. Abut 10 elements are displayed on the
first screen. While browsing the first screen, I can choose 'Screen' from
the ring menu to display the rest of the data( and change it if I wish). The
problem is the second screen. Whenever I press 'Update' the program crashes:
FIELD NAME NOT FOUND IN FORM!!!!!!!
Here are the .4gl and .per files:
*** .4gl ***
DATABASE cmp
DEFINE p_case RECORD
case_no LIKE case.case_no,
ein LIKE case.ein,
trade_name LIKE case.trade_name,
est_adres1 LIKE case.est_adres1,
est_adres2 LIKE case.est_adres2,
est_city LIKE case.est_city,
est_st LIKE case.est_st,
est_zip LIKE case.est_zip,
contct_name LIKE case.contct_name,
contct_phone LIKE case.contct_phone,
contct_title LIKE case.contct_title,
contct_fax LIKE case.contct_fax
END RECORD
DEFINE p_case1 RECORD
case_no LIKE case.case_no,
ein LIKE case.ein,
trade_name LIKE case.trade_name,
vio_type LIKE case.vio_type,
p_name LIKE case.parent_name,
p_adres1 LIKE case.parent_adres1,
p_adres2 LIKE case.parent_adres2,
p_city LIKE case.parent_city,
p_st LIKE case.parent_st,
p_zip LIKE case.parent_zip,
p_phone LIKE case.parent_phone,
p_ein LIKE case.parent_ein
END RECORD,
next_opt CHAR(1),
mod_flag CHAR(1)
MAIN
INITIALIZE p_case.* TO NULL
INITIALIZE p_case1.* TO NULL
DEFER INTERRUPT
OPTIONS
PROMPT LINE 2,
FORM LINE 4,
ERROR LINE 24,
COMMENT LINE 23,
MESSAGE LINE 24,
INPUT WRAP
OPEN FORM f_c41 FROM "c4_1"
DISPLAY FORM f_c41
CALL prepare_cur()
MENU "OPTIONS"
COMMAND "Query" "Search for employer file data"
CALL query()
COMMAND "Next" "View the next employer file data in the list"
CALL query_next()
COMMAND "Previous" "View the previous employer file data in the list"
CALL query_previous()
COMMAND "First" "View the first employer file data in the list"
CALL query_first()
COMMAND "Last" "View the last employer file data in the list"
CALL query_last()
COMMAND "Update" "Update employer file data"
CALL update()
COMMAND "Screen" "Goto Parent Screen."
CALL pscreen()
COMMAND "Exit" "Exit to FILE MAINTENANCE menu"
CLEAR SCREEN
DISPLAY "Program end run..." AT 1,1
EXIT MENU
END MENU
END MAIN
FUNCTION pscreen()
{ Parent screen - This function displays the
parent info from the case table.
}
CLEAR SCREEN
OPEN FORM f_c1_1_2 FROM "c1_1_2"
DISPLAY FORM f_c1_1_2
SELECT
case_no, ein, vio_type, trade_name,
parent_name, parent_adres1, parent_adres2,
parent_city, parent_st, parent_zip,
parent_phone, parent_ein
INTO p_case1.*
FROM case
WHERE case.case_no = p_case.case_no
DISPLAY p_case1.* TO sc_head.*
MENU "OPTIONS"
COMMAND "Exit" "Return to previous menu."
CLEAR SCREEN
DISPLAY FORM f_c41
call display_screen()
exit menu
COMMAND "Update" "Update parent screen date."
CALL ParentUpd()
end menu
END FUNCTION {pscreen() }
{ Function to update the parent screen data record. }
FUNCTION ParentUpd()
DISPLAY
"UPDATE: <CTRL-C> Cancel, <CTRL-[> or ESC To Update", "" AT 1, 1
--INPUT BY NAME p_case1.case_no THRU p_case1.p_ein WITHOUT DEFAULTS
INPUT BY NAME
p_case1.case_no, p_case1.ein, p_case1.vio_type,
p_case1.trade_name, p_case1.p_name, p_case1.p_adres1,
p_case1.p_adres2, p_case1.p_city, p_case1.p_st, p_case1.p_zip,
p_case1.p_phone, p_case1.p_ein WITHOUT DEFAULTS
UPDATE case SET
(parent_name, parent_adres1, parent_adres2, parent_city,
parent_st, parent_zip, parent_phone, parent_ein) =
(p_case1.p_name, p_case1.p_adres1, p_case1.p_adres2,
p_case1.p_city,p_case1.p_st, p_case1.p_zip,
p_case1.p_phone,p_case1.p_ein)
WHERE case_no = p_case.case_no
IF (STATUS < 0 OR INT_FLAG) THEN
DISPLAY "Table NOT updated..." AT 1,1
ELSE
-- COMMIT WORK
DISPLAY "Table updated..." AT 1,1
END IF
SLEEP 2
END FUNCTION --ParentUpd()
FUNCTION prepare_cur()
DEFINE t_insert CHAR(200)
DEFINE t_query CHAR(200)
DEFINE t_query1 CHAR(200)
DEFINE s_insert CHAR(200)
DEFINE s_update CHAR(200)
DEFINE t_update CHAR(200)
DEFINE a_query CHAR(200)
LET s_update = "SELECT * FROM case WHERE case_no = ? FOR UPDATE"
PREPARE saccount_ins FROM s_update
DECLARE s_upd_cur CURSOR FOR saccount_ins
LET t_query = "SELECT * FROM transact WHERE case_no = ? AND indirect = \\"Y\\""
PREPARE transact_quy FROM t_query
DECLARE t_quy_cur CURSOR FOR transact_quy
{LET t_query1 = "SELECT * FROM transact WHERE case_no = ? AND control_no <> ? and depsit_date <= ? AND (rev_flag <> \\"Y\\" OR rev_flag IS NULL)"
PREPARE transact_quy1 FROM t_query1
DECLARE t_quy_cur1 CURSOR FOR transact_quy1
LET a_query = "SELECT * FROM account WHERE case_no = ? AND act_date <= ?"
PREPARE account_quy FROM a_query
DECLARE a_quy_cur CURSOR FOR account_quy
#LET t_update = "SELECT case_no, depsit_date, control_no, depsit_amt, source, principal, interest, penalty, admin_fee FROM transact WHERE case_no = ? AND control_no = ? AND indirect = \\"Y\\" FOR UPDATE"
LET t_update = "SELECT * FROM transact WHERE case_no = ? AND control_no = ? AND indirect = \\"Y\\" FOR UPDATE"
PREPARE transact_upd FROM t_update
DECLARE t_upd_cur CURSOR FOR transact_upd
#LET t_update2 = "SELECT principal, interest, penalty, admin_fee FROM transact WHERE case_no = ? AND control_no = ? AND indirect = \\"Y\\" FOR UPDATE"
#PREPARE transact_upd2 FROM t_update2
#DECLARE t_upd_cur2 CURSOR FOR transact_upd2
}
END FUNCTION
FUNCTION query()
DEFINE l_where CHAR(250)
DEFINE l_query_head CHAR(300)
CLEAR FORM
DISPLAY
"QUERY: <CTRL-C> Cancel, <CTRL-[> or ESC To Query", "" AT 1,1
CONSTRUCT BY NAME l_where ON case.case_no, case.ein, case.trade_name,
case.est_adres1, case.est_adres2,
case.est_city, case.est_st, case.est_zip,
case.contct_name, case.contct_phone,
case.contct_title,
case.contct_fax
{If the user interrupted the query (CTRL-C), return back to the menu}
IF INT_FLAG THEN