diblanch@sdrc.UUCP (Jeff Blanchet) (12/28/89)
I hope someone out there can help me. I am having a problem with an indexed file. The file is a file of records that are quite large (Larger then I have ever done before). The problem seems to be in the resetk command while using the error_recovery parameter. The program just hangs on the resetk command and the process begins page faulting like crazy. If I take out the error_recovery on the resetk command it works fine. Any ideas? What makes this problem worse is that it only occurs when the file does not exist and I am creating it for the first time. I took out the error_recovery to initial create the file. I then put the error_recovery back into the program and it worked fine. I deleted the file, ran the executable with the error_recovery and it hung. Please Help!!! I am using the Pascal V3.9-289 compiler with the V05-05 linker. I have include a copy of a test program that shows the problem I am having. If anyone can help I would really appreciate it. ----- cut here ----- cut here ----- cut here ----- cut here ----- cut here ----- PROGRAM Jeff (input,output); CONST MAX_PROD_LINE = 120; { Max no of scrolled lines in buffer } TYPE PACK_1 = PACKED ARRAY [1..1] OF CHAR; PACK_3 = PACKED ARRAY [1..3] OF CHAR; PACK_6 = PACKED ARRAY [1..6] OF CHAR; PACK_7 = PACKED ARRAY [1..7] OF CHAR; PACK_9 = PACKED ARRAY [1..9] OF CHAR; PACK_10 = PACKED ARRAY [1..10] OF CHAR; PACK_15 = PACKED ARRAY [1..15] OF CHAR; PACK_REGION = PACKED ARRAY [1..4] OF CHAR; PACK_BRANCH = PACKED ARRAY [1..4] OF CHAR; PACK_CO_ID = PACKED ARRAY [1..10] OF CHAR; PACK_SITE_ID = PACKED ARRAY [1..3] OF CHAR; PACK_PO = PACKED ARRAY [1..25] OF CHAR; PACK_PR_NUMBER = PACKED ARRAY [1..8] OF CHAR; PACK_RESTRICTED = PACKED ARRAY [1..1] OF CHAR; PACK_MASTER = PACKED ARRAY [1..8] OF CHAR; PACK_JOB_ID = PACKED ARRAY [1..7] OF CHAR; PACK_OPER_SYS = PACKED ARRAY [1..6] OF CHAR; SHIP_FORM_PACK = PACKED ARRAY[1..31] OF CHAR; SHIP_FORM_PACK_INST = PACKED ARRAY[1..33] OF CHAR; SHIP_FORM_DESC = PACKED ARRAY[1..55] OF CHAR; SHIP_FORM_POC_PACK = PACKED ARRAY[1..9] OF CHAR; PACK_PROD_CODE = PACKED ARRAY [1..10] OF CHAR; ITEM_REC = RECORD LINE_ITEM : PACK_3; QTY : PACK_3; PART_NO : PACK_PROD_CODE; DESCRIPTION : SHIP_FORM_DESC; END; { Anytime the BUFFER_REC definition changes then you must write a convert procdure for the orders.dat file (the online file copy of the shipping orders).} BUFFER_REC = RECORD DATE : PACK_9; SALESMAN : PACK_15; REGION : PACK_REGION; BRANCH : PACK_BRANCH; CUSTOMER_ID : [key(1)] PACK_CO_ID; CUSTOMER_SITE_ID : [key(2)] PACK_SITE_ID; CUSTOMER_ORDER_NO : [key(3)] PACK_PO; PROD_REQ_NO : [key(4)] PACK_PR_NUMBER; PACK_COUNT : PACK_3; SHIPPING_TOTAL : PACK_1; SHIPMENT_DISP : PACK_7; SHIP_VIA : PACK_15; SHIPPING_TYPE : PACK_1; SHIPPING_TYPE1 : PACK_6; CHARGE_NO : PACK_15; RESTRICTED : PACK_RESTRICTED; MASTER_LEASE : PACK_MASTER; JOB_ID : PACK_JOB_ID; SYSTEM : PACK_OPER_SYS; SHIP_COUNTER : [key(0)] PACK_10; CURR_PAGE : PACK_1; TOT_PAGE : PACK_1; SHIP_TO_1 : SHIP_FORM_PACK; SHIP_TO_2 : SHIP_FORM_PACK; SHIP_TO_3 : SHIP_FORM_PACK; SHIP_TO_4 : SHIP_FORM_PACK; SHIP_TO_5 : SHIP_FORM_PACK; SHIP_TO_6 : SHIP_FORM_PACK; SHIP_TO_7 : SHIP_FORM_PACK; END_USER_1 : SHIP_FORM_PACK; END_USER_2 : SHIP_FORM_PACK; END_USER_3 : SHIP_FORM_PACK; END_USER_4 : SHIP_FORM_PACK; END_USER_5 : SHIP_FORM_PACK; END_USER_6 : SHIP_FORM_PACK; END_USER_7 : SHIP_FORM_PACK; SPEC_INSTR_1 : SHIP_FORM_PACK_INST; SPEC_INSTR_2 : SHIP_FORM_PACK_INST; SPEC_INSTR_3 : SHIP_FORM_PACK_INST; SPEC_INSTR_4 : SHIP_FORM_PACK_INST; SPEC_INSTR_5 : SHIP_FORM_PACK_INST; SPEC_INSTR_6 : SHIP_FORM_PACK_INST; SPEC_INSTR_7 : SHIP_FORM_PACK_INST; SPEC_INSTR_8 : SHIP_FORM_PACK_INST; SPEC_INSTR_9 : SHIP_FORM_PACK_INST; MONTH_1 : PACK_3; MONTH_2 : PACK_3; MONTH_3 : PACK_3; ITEM : ARRAY[1..MAX_PROD_LINE] OF ITEM_REC; POC_1 : ARRAY[1..MAX_PROD_LINE] OF SHIP_FORM_POC_PACK; POC_2 : ARRAY[1..MAX_PROD_LINE] OF SHIP_FORM_POC_PACK; POC_3 : ARRAY[1..MAX_PROD_LINE] OF SHIP_FORM_POC_PACK; END; VAR buffer : buffer_rec; PROCEDURE CLEAR_BUFFER(var buffer : buffer_rec); { Clear all fields in the buffer } VAR i : integer; BEGIN WITH BUFFER DO BEGIN DATE := ''; SALESMAN := ''; REGION := ''; BRANCH := ''; CUSTOMER_ID := ''; CUSTOMER_SITE_ID := ''; CUSTOMER_ORDER_NO := ''; PROD_REQ_NO := ''; PACK_COUNT := ''; SHIPPING_TOTAL := ''; SHIPMENT_DISP := ''; SHIP_VIA := ''; SHIPPING_TYPE := ''; SHIPPING_TYPE1 := ''; CHARGE_NO := ''; RESTRICTED := ''; MASTER_LEASE := ''; JOB_ID := ''; SHIP_TO_1 := ''; SHIP_TO_2 := ''; SHIP_TO_3 := ''; SHIP_TO_4 := ''; SHIP_TO_5 := ''; SHIP_TO_6 := ''; SHIP_TO_7 := ''; END_USER_1 := ''; END_USER_2 := ''; END_USER_3 := ''; END_USER_4 := ''; END_USER_5 := ''; END_USER_6 := ''; END_USER_7 := ''; SPEC_INSTR_1 := ''; SPEC_INSTR_2 := ''; SPEC_INSTR_3 := ''; SPEC_INSTR_4 := ''; SPEC_INSTR_5 := ''; SPEC_INSTR_6 := ''; SPEC_INSTR_7 := ''; SPEC_INSTR_8 := ''; SPEC_INSTR_9 := ''; MONTH_1 := ''; MONTH_2 := ''; MONTH_3 := ''; END; { Clear the QTY, PROD_DESC, DESCRIPTION array } FOR I:=1 TO MAX_PROD_LINE DO BEGIN WITH BUFFER.ITEM[I] DO BEGIN LINE_ITEM := ''; QTY := ''; PART_NO := ''; DESCRIPTION := ''; END; BUFFER.POC_1[I] := ''; BUFFER.POC_2[I] := ''; BUFFER.POC_3[I] := ''; END; END; {******************************************************************************} Procedure save_buffer_file(buffer : buffer_rec); var outfile : file of buffer_rec; begin open(outfile,'ORDERS.DAT',sharing := readwrite, access_method := keyed, organization := indexed, history := unknown); (*THE FOLLOWING RESETK IS CAUSING THE PROBLEM. IT JUST HANGS. *) repeat resetk(outfile,0,error:=continue); until status(outfile) = 0; (*COMMENTING OUT THE ABOVE THREE LINES AND USING THE ONE BELOW WORKS FINE *) (* resetk(outfile,0,error:=continue); *) repeat findk(outfile,0,buffer.ship_counter,eql,error:=continue); until status(outfile) = 0; if not ufb(outfile) then begin outfile^:=buffer; repeat update(outfile,error:=continue); until status(outfile) = 0; end else begin outfile^:=buffer; repeat put(outfile,error:=continue); until status(outfile) = 0; end; close(outfile); end; {******************************************************************************} begin clear_buffer(buffer); save_buffer_file(buffer); end. ----- cut here ----- cut here ----- cut here ----- cut here ----- cut here ----- Jeff Blanchet UUCP: uunet!sdrc!diblanch SDRC Cincinnati Ohio