Google
 

Trailing-Edge - PDP-10 Archives - tops10_703a_sys_ap115_bb-ju01b-bb - dbsany.f05
There are 11 other files named dbsany.f05 in the archive. Click here to see a list.
;VERSION 5A COMMENT
;
;	THIS EDIT APPLIES TO BOTH DBMS-10/20. THE CORRESPONDING
;	EDIT NUMBER FOR DBMS V5 IS 455.
;
;SYMPTOM:
;
;	WHEN A MEMBER RECORD IN A SET OCCURRENCE HAS BINARY ZEROES IN 
;	ITS SET POINTERS, FIND NEXT AND FIND PRIOR GET INTO AN INFINITE 
;	LOOP.
;
;DIAGNOSIS:
;
;	FIND RSE 3 IS NOT EXPECTING CORRUPT DBKEYS IN THE SET POINTERS,
;	SO WHEN IT SEES ZEROES IN THE PARTICULAR SET POINTERS, IT THINKS
;	THAT SOME OTHER CONCURRENT RUN-UNIT IS WORKING WITH THIS RECORD.
;	IN ORDER TO GUARD AGAINST THIS POSSIBILITY, IT DEFINES A
;	CANONICAL NEXT OF SET, WHICH IS TYPICALLY THE RECORD WHICH IT IS
;	CURRENTLY WORKING WITH. THUS, IN THE CORRUPT SITUATION, IT
;	RE-FINDS THAT RECORD AND LOOPS INFINITELY. WHEN DBCS HAS FOUND
;	A RECORD, IT DOES NOT SPOT-CHECK THE SET POINTERS WHICH IT
;	CONTAINS FOR BINARY ZEROES. 
;
;	HOWEVER, IF CORRUPT SET POINTERS ARE NON-ZERO, THIS FACT WILL
;	BE CAUGHT UNDER THE XX22 ERROR-STATUS CODE BECAUSE THIS TYPE
;	OF CURRUPT SET POINTER WILL POINT OFF TO AN AREA OR DATA BASE
;	PAGE OR RECORD WHICH IS INCONSISTENT WITH THE WITHIN DEFINITION
;	FOR THE RECORD TYPE IN THE SCHEMA, OR WILL POINT OFF TO SOME
;	DATA BASE PAGE WHICH IS NOT DEFINED FOR AN AREA.
;
;	ALSO, IF AN OWNER RECORD CONTAINS BINARY ZEROES IN ITS SET
;	POINTERS THIS IS ALSO ALREADY REPORTED UNDER ERROR-STATUS XX22.
;
;CURE:
;
;	INSTALL EDIT 521 FOR DBMS-10/20 V5A, WHICH WILL SPOT-CHECK
;	SET POINTERS FOR THE PARTICULAR SET IN THE RECORD FOR BINARY
;	ZEROES. IF IT FINDS SUCH, IT WILL ISSUE AN ERROR-STATUS CODE
;	OF 0356.
;
;NOTE ***** THIS EDIT APPLIES TO BOTH DBMS-10 AND DBMS-20 VERSION 5A.
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 521.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;	APPLY THIS EDIT TO DBSANY.REL
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;  FOR A COBOL-68 DBMS SYSTEM...
;
;	R MAKLIB
;	*DBSANY.521=DBSANY.REL,521.FIX/F
;	*LIBOL.521=LIBOL.REL/M:DBFIND,DBSANY.521/R:DBFIND
;	*LIBOL.521=LIBOL.521/INDEX
;
;	R LINK
;	*LIBSHR,LIBOL.521/SEARCH/GO
;
;	SAVE LIBO12
;
;  FOR A COBOL-74 DBMS SYSTEM...
;
;	R MAKLIB
;	*DBSANY.521=DBSANY.REL,521.FIX/F
;	*C74LIB.521=C74LIB.REL/M:DBFIND,DBSANY.521/R:DBFIND
;	*C74LIB.521=C74LIB.521/INDEX
;
;	R LINK
;	*C74SHR,C74LIB.521/SEARCH/GO
;
;	SAVE C74O12
;
;  FOR FORTRAN DBMS SYSTEMS...
;
;	R MAKLIB
;	*DBSANY.521=DBSANY.REL,521.FIX/F
;	*FORLIB.521=FORLIB.REL/M:DBFIND,DBSANY.521/R:DBFIND
;	*FORLIB.521=FORLIB.521/INDEX
;
;	R LINK
;	*FORLIB.521/INCLUDE:FOROTS,FORLIB.521/SEARCH/GO
;
;	SAVE FOROTS
;
;THE PATCHED FILES SHOULD BE RENAMED TO  .REL TO BE USED AS THE BASE
;FOR ANY FUTURE EDITS.
;
.EDIT 521
.MODULE DBFIND
.NAME JSM 	;MODIFIED BY HRB
.INSERT F3S.EX+2,REPLACE:2,<CAMN R2,TMP.RB(X)>
		;COPY OVER FIRST TWO INSTRUCTIONS IN ORDER TO AVOID HAV-
		;ING MAKLIB COLLIDE WITH THE TRANSFER ADDRESS AFTER CAMN
	CAMN	R2,TMP.RB(X)	;IN ORIG CODE
	JRST	FND.EX+137	;IN ORIG CODE
		;MAIN PATCH BEGINS HERE
	PUSH	P,R1		;GRAB 3 AC'S TO WORK WITH
	PUSH	P,R3
	PUSH	P,R4
		;COMING INTO PATCH, FOLLOWING VALUES ARE PERTINENT
		;
		;	R5 -- ADDR OF TOP OF RECORD OCCURRENCE IN
		;		BUFFER
		;
		;	BLK -- POINTS AT CURRENT SET'S OWNER BLOCK
		;
		;FIRST, WE FIND THE PROPER MEMBER BLOCK IN THE IN-CORE
		;  DATA BASE
		;
	MOVE	R1,BLK		;[HRB] PICK UP THE OB FOR THE CURRENT SET
	MOVE	R3,13(R1)	;GET ADDR OF TABLE OF MEMBERS IN OWNER
			;  NOTE OB.ION  = 13
	HLRZ	R1,0(R3)	;GET ADDR OF MEMBER'S RECORD BLOCK
	CAMN	R0,R1		;IS IT THE CURRENT ONE?
	JRST	.+3		;YES
	AOBJN	R3,.-3		;GET NEXT ENTRY FROM TABLE OF MEMBERS
	PUSHJ	P,XC.RWT##	;EXHAUSTED THE LIST -- SHOULD NEVER HAPPEN
		;
		;AND SECOND, CHECK OUT THE SET POINTERS IN THE RECORD 
		;  IN THE BUFFER IN CORE
		;
		;	SLOTS FOR OWNER AND PRIOR PTRS IN MEMBER BLOCK
		;	CONTAIN 0 IF NOT DEFINED FOR SET. NEXT PTRS
		;	ALWAYS DEFINED -- 0 IS DISPLACEMENT TO NEXT PTR
		;
		;HANDLE OWNER AND PRIOR PTRS FIRST
		;
	HRRZ	R4,0(R3)	;GET ADDR OF MEMB REC'S MEMB BLOCK
	HRLI	R4,-2		;SET UP PTR TO CHECK OWNER AND PRIOR PTRS
	MOVE	R1,0(R4)	;GET DISPLACEMENT TO DBKEY IN RECORD
	CAIN	R1,0		;IS IT ZERO?
	JRST	.+4		;YES -- NOT DEFINED FOR THIS SET
	ADD	R1,R5		;NO -- GET ADDR OF DBKEY IN BUFFER
	SKIPN	R0,0(R1)	;IS DBKEY = 0?
	PUSHJ	P,XC.DAT##	;YES -- BAD
	AOBJN	R4,.-6		;NO -- GO GET ANOTHER DBKEY
		;
		;NOW HANDLE NEXT PTR
		;
	MOVE	R1,0(R4)	;GET DISPL OF "NEXT" DBKEY IN REC
	ADD	R1,R5		;GET ADDR OF DBKEY IN BUFFER
	SKIPN	R0,0(R1)		;IS IT ZERO?
	PUSHJ	P,XC.DAT##	;YES -- BAD
		;
		;IF WE GET PAST HERE THE SPOT-CHECK WAS SUCCESSFUL
		;
	POP	P,R4		;GIVE BACK AC'S
	POP	P,R3
	POP	P,R1
	JRST	F3.EX		; AND GET BACK IN LINE
.ENDI
.ENDE
;VERSION 5A COMMENT
;
;	THIS EDIT, WHICH WAS EDITS 411/451 FOR DBMS-10/20 VERSION 5 
;	DID NOT MAKE IT INTO VERSION 5A. ALSO, PLEASE NOTE THAT THE
;	LIBRARY FILE DBSANY.REL IS BEING CHANGED TO DBSINF.REL IN
;	THE MAKLIB STEP BELOW, IN ACCORDANCE WITH EDITS 522/523. 
;	THE SYMPTOM, DIAGNOSIS AND CURE FOR EDITS 411/451 ARE BEING 
;	REPRODUCED HERE FOR YOUR CONVENIENCE.
;
;SYMPTOM
;
;	(411)
;	USING SCHEMAS CONTAINING DDL USING INTERSPERSED "AREA NAME",
;	"RECORD NAME" AND "SET NAME" SYNTAX, DBINFO MAY FAIL WITH
;	THE MESSAGE "?INFSAF -- SCHEMA ACCESS FAILURE".
;
;	(451)
;	WITH EDITS 411 AND 412 INSTALLED, THE DBINFO FUNCTIONS 
;	/DISPLAY DATA:"SET-NAME" AND /DISPLAY USAGE:"SET-NAME" MAY
;	REPORT NO DATA WHEN APPROPRIATE DATA EXISTS ON THE DBMS
;	DATA BASE.
;
;
;DIAGNOSIS
;
;	(411)
;	DBINFO DOES NOT BIND SUCH SCHEMAS PROPERLY BECAUSE THE
;	INTERNAL NAME-ID'S FOR THE USER-DEFINED SYMBOLS IN THE 
;	SCHEMA GET OUT OF SEQUENCE WITH THE TID'S ASSIGNED FOR
;	USER'S RECORD TYPES. THIS IS REALLY A SCHEMA PROBLEM, AS
;	THE SCHEMA PROCESSOR MAY INADVERTENTLY OVERLAP AN IN-CORE
;	WORK AREA FOR PROCESSING RECORD TYPES AND SET TYPES. HOW-
;	EVER, COBOL PROGRAMS USING SUCH SCHEMAS BIND AND EXECUTE
;	PROPERLY. COBOL DOES THE BIND IN TWO STAGES. FIRST, AT
;	COMPILE TIME IT FOLLOWS THE LINKED LIST OF RECORD-TYPES
;	IN THE .SCH FILE WHEN IT IS CREATING THE BIND STATEMENTS.
;	AS A RESULT, THE NAME-ID'S FOR THE VARIOUS DATA-NAMES ARE
;	IN ASCENDING ORDER ALTHOUGH THE BIND STATEMENTS MAY NOT
;	BE IN ORDER AS DEFINED IN THE SCHEMA. AT RUN-TIME DBCS
;	EXPECTS THE NAME-ID'S TO BE IN ORDER, AND USES THE TID'S
;	TO CREATE A TABLE OF REFERENCES TO THE RECORD TYPES IN
;	THE IN-CORE DATA BASE. ON THE OTHER HAND, DBINFO TRIES THE
;	SAME THING IN ONE PASS, BUT IT IS NOT SMART ENOUGH TO
;	SHUFFLE THE RECORD TYPES IN THE SAME WAY. AS A RESULT,
;	THE NAME-ID'S GET OUT OF SEQUENCE AS DBINFO ATTEMPTS TO
;	BIND THE RECORD TYPES IN SUCCESSION.
;
;	IT WAS DECIDED NOT TO FIX THE PROBLEM IN SCHEMA BECAUSE
;	OF THE FACT THAT IT CAUSES NO PROBLEMS FOR COBOL (OR FOR
;	FORTRAN). AS A RESULT, DBINFO IS BEING MODIFIED IN 
;	ORDER TO CONTAIN THE PROBLEM AT THE POINT WHERE AN EDIT
;	WILL HAVE THE FEWEST POTENTIAL REPERCUSSIONS.
;
;	(451)
;	AFTER EDIT 411 IS THROUGH SHUFFLING THE RECORD LIST FOR THE
;	SUB-SCHEMA BINDING PROCESS IN DBINFO, IT FAILS TO CLEAR THE
;	LEFT HALF OF THE WORD FOR THE AFFECTED MEMBERS OF THIS LIST.
;	THESE TWO DBINFO FUNCTIONS USE THE ENTRIES OF THIS LIST IN
;	ORDER TO SEE IF THE CURRENT DATA BASE RECORD IS AN OWNER OF
;	THE SPECIFIED SET TYPE. IF THE LEFT HALF OF THE ENTRY IN
;	THE RECORD LIST IS NOT CLEARED, THE COMPARISON WILL FAIL 
;	WHEN IT SHOULD PASS.
;
;CURE
;
;	INSTALL EDIT 524, CAUSING DBINFO TO RETAIN INFORMATION
;	IN ITS IN-CORE TABLE OF REFERENCES AS TO WHAT ORDER THE
;	RECORD TYPES SHOULD HAVE BEEN IN. THE ORIGINAL ENTRIES
;	ARE A SERIES OF HALF-WORD ADDRESSES IN THE RIGHT HALF OF
;	EACH WORD, AND THE LEFT HALF OF EACH REMAINS AT 0 FOR
;	THE ENTIRE RUN OF DBINFO. IT IS THE LEFT HALF OF THESE
;	WORDS WHICH ARE BEING USED FOR THE PURPOSES OF THIS EDIT.
;
;	(451)
;	ALSO, WHEN THE WORK OF EDIT 411 IS COMPLETE, CLEAR THOSE
;	LEFT HALF-WORDS.
;
;
;WARNINGS
;
;	WHEN THIS EDIT IS INSTALLED INTO DBINFO, ITS "DISPLAY
;	DATA" FUNCTION STILL WILL NOT KNOW WHERE TO LOOK IN THE
;	IN-CORE DATA BASE FOR THE INFORMATION ON RECORD TYPES
;	WHICH ARE OUT OF ORDER, AND IT WILL PRODUCE THE MESSAGE
;	"?INFDAF -- DATA BASE ACCESS FAILURE". IN ORDER TO CLEAR
;	THIS PROBLEM, YOU MUST INSTALL EDIT 525.
;
;	EDITS 524 AND 525 ARE INTENDED TO FIX A VERY SPECIALIZED
;	PROBLEM AS EXPLAINED ABOVE, AND YOU NEED NOT INSTALL THEM
;	UNLESS YOU CONSTRUCT YOUR SCHEMA DDL IN THE UNUSUAL FASH-
;	ION AS INDICATED UNDER "SYMPTOM" ABOVE AND YOU ARE EXPER-
;	IENCING THIS PROBLEM.
;
;	ALSO, WHEN THE "DISPLAY MAP" FUNCTION IS USED, DBINFO WILL
;	PUT THE LISTINGS FOR THE RECORD TYPES WHICH ARE OUT OF
;	ORDER AT THE BOTTOM OF THE "MAP" REPORT. THE CONTENTS OF
;	THESE LISTINGS WILL BE ACCURATE. IT WAS DECIDED NOT TO
;	FIX THIS PROBLEM AT THIS TIME, AS IT WOULD HAVE REQUIRED
;	A MAJOR RE-WRITE OF THE "MAP" FUNCTION IN ORDER TO OVER-
;	COME WHAT AMOUNTS TO A MINOR INCONVENIENCE FOR THE USER.
;
;	FINALLY, DO NOT INSTALL THIS EDIT UNTIL AFTER YOU HAVE INSTALLED
;	EDIT 522 FOR DBMS-20 OR EDIT 523 FOR DBMS-10.
;
;NOTE ***** THIS EDIT APPLIES TO DBINFO FOR DBMS10 + DBMS20 VERSION 5A
;		BUT NOT TO COBOL AND FORTRAN
;
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 524.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;
;	FOR DBINFO APPLY THIS EDIT TO DBSINF.REL **********
;
;	NOTE: THE MAKLIB STEP BELOW OUTPUTS DBSINF.REL FROM YOUR INPUT
;	DBSANY.REL. THE INPUT DBSANY.REL WILL BE UNCHANGED AND REMAINS
;	SUITABLE FOR FUTURE EDITS TO DBSANY.REL FOR DBCS FOR LIBOL AND 
;	FORLIB.
;
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;FOR DBMS-10
;
;  .R MAKLIB
;  *DBSINF.524=DBSANY.REL,524.FIX/F
;
;  .R LINK
;  *@DBINF1
;
;  .SAVE DBINFO
;
;
;FOR DBMS-20
;
;  @R MAKLIB
;  *DBSINF.524=DBSANY.REL,524.FIX/F
;
;  @R LINK
;  *@DBINF2
;
;  @SAVE DBINFO
;
;
;THE PATCHED FILE SHOULD BE RENAMED TO DBSINF.REL AND SAVED ASIDE TO
;BE USED AS THE BASIS FOR ANY FUTURE ENDITS TO DBINFO. IT SHOULD NOT
;BE CONFUSED WITH THE DBSANY.REL FOR DBCS IN LIBOL AND FORLIB.
;
;
;**********************************************************************
;
;
.EDIT 524
.NAME JSM
.MODULE REC.WALK
;			 <MOVE BMASK,@MASKB(AP)>
.INSERT REC.WALK+1,AFTER,<MOVE 6,@0(16)>
	PUSH P,R1	;GET LOC ON STACK TO HOLD POINTER TO TABLE
	PUSH P,R1	;GET AN AC TO USE
	HRRZ R1,127(SS)		;GET START ADDR OF TABLE (RECLIST=127)
	MOVEM R1,-1(P)	;SAVE IT IN STACK LOC.
	POP P,R1		;RESTORE AC
.ENDI
.INSERT RW.LP+1,AFTER,<PUSHJ P,FIND3%>
	CAIE R0,0	;AT END OF BIND SCAN FOR RECORD TYPES?
	JRST .+11	;NO
	PUSH P,R1	;GET AN AC TO SET UP AOBJN PTR
	MOVE R1,127(SS)		;RECLIST IS THE POINTER
	MOVE R0,0(R1)	;GET AN ENTRY OF THE LIST
	HRRZM R0,0(R1)	;PUT IT BACK WITH LEFT HALF ZEROED
	AOBJN R1,.-2	;GO TO PICK UP NEXT ENTRY
	POP P,R1	;GIVE BACK AC
	POP P,R0		;YES -- GIVE BACK STACK LOCATION
	HRRZI R0,0	;TELL DBINFO IT IS THRU WITH SCAN
.ENDI
;			<MOVEM 1,LIN>
.INSERT RW.LP+3,BEFORE,<MOVEM 1,7>
	PUSH P,R1	;GET AN AC
	MOVE R1,-1(P)	;GET POINTER TO IN-CORE TABLE
	ADDI R1,1	;POINT TO NEXT ENTRY
	MOVEM R1,-1(P)	;PUT UPDATED POINTER BACK
	POP P,R1		;RESTORE AC
.ENDI
;			   <ADD 1,TIDVEC(SS)>
.INSERT RW.LP+33,REPLACE:2,<ADD 1,140(14)>
	PUSH P,R0	;GET TWO AC'S
	PUSH P,R1
	MOVEI R0,40		;SET UP TID VALUE OF SYSTEM REC
				;  SYSTID = 40
	ADD R1,TIDVEC(SS)	;FIND ENTRY IN TABLE WHERE NEW
				;  POINTER SHOULD GO
	CAMN R0,0(P)	;IS IT FOR THE SYSTEM RECORD?
	JRST .+3		;YES -- BYPASS
	HRLM R1,CIC	;NO -- AC1 IS WHERE REC'S ENTRY SHOULD GO
				;  MOVE IT TO AC13 L.H.
	MOVE R1,-2(P)		;FIND WHERE WE WILL PUT IT
	MOVEM CIC,0(R1)		;PUT IT THERE IN TABLE
	HRLI CIC,0		;CLEAR AC13 L.H. TO AVOID PROBS
				;  BELOW IN MAIN CODE
	POP P,R1			;RESTORE AC'S
	POP P,R0
.ENDI
.ENDE
;VERSION 5A COMMENT
;
;	THIS WAS EDIT 430 IN VERSION 5. CHANGES TO THE MAKLIB TEXT
;	FOR VERSION 5A ARE FLAGGED WITH [V5A] IN THE MARGINAL COMMENTS.
;	ALL CHANGES REPRESENT CHANGES OF ADDRESS FOR EXPANDED IN-LINE
;	LITERALS.
;
;	NOTE: VERSION 5 EDITS 430 AND HIGHER WERE CREATED AFTER THE 
;	CUTOFF DATE FOR VERSION 5A. CONSEQUENTLY, THERE WAS NO OPPORTUN-
;	ITY TO INTEGRATE THEM INTO THE RELEASED VERSION OF V5A.
;	ALL SUCH EDITS FOR VERSION 5A WHICH HAVE A CORRESPONDING
;	VERSION 5 EDIT WILL BE DOCUMENTED WITH A VERSION 5A COMMENT
;	PREFIX SUCH AS THIS ONE.
;
;SYMPTOM
;
;	IF ORDER IS SORTED DUPLICATES ARE FIRST/LAST/UNSPECIFIED
;	ALLOWED IS SPECIFIED IN THE ORDER CLAUSE OF A SET TYPE
;	WHICH HAS MEMBERSHIP CONSISTING OF MULTIPLE MEMBER REC-
;	ORD TYPES, ENTER MACRO FINS6 WILL NOT NECESSARILY RE-
;	TRIEVE THE PROPER MEMBER RECORD TYPE WHEN A MATCH IS
;	FOUND ON THE USER-SUPPLIED SORT KEY VALUE.
;
;DIAGNOSIS
;
;	FOR A SET OCCURRENCE WITH ORDER SORTED DUPLICATES ...
;	AS SPECIFIED ABOVE, FINS6 FAILS TO CHECK THE RECORD
;	TYPE OF THE MEMBER RECORD WHEN A USER KEY MATCH IS
;	FOUND BECAUSE THE INTERNAL RECORD TYPE ID IS NOT PART
;	OF THE SORT KEY FOR THE SET TYPE. THIS PROBLEM APPLIES
;	FOR RANGE KEY MATCHES AS WELL AS FOR EXACT KEY VALUE
;	MATCHES. FINS6 WORKS APPROPRIATELY FOR ALL OTHER TYPES
;	ORDER SORTED WITH EITHER EXACT OR RANGE KEY MATCHES.
;
;CURE
;
;	SINCE FINS6 REQUIRES THE USER TO SUPPLY A RECORD NAME
;	AS A "USING" PARAMETER AS WELL AS A SET NAME, IT AP-
;	PEARS ONLY PROPER THAT IT SHOULD CHECK FOR RECORD TYPE
;	AS WELL AS USER KEY VALUE. INSTALL EDIT NO. 540 IN
;	ORDER TO MAKE IT DO THIS EXTRA CHECKING FOR ORDER
;	SORTED DUPLICATES.
;
;	THIS LARGE AND COMPLEX PATCH AFFECTS RETRIEVAL THRU 
;	FINS6 ON THE FOURTH OF THE FOUR MAJOR TYPES OF SORTED 
;	SETS, WHICH MAY NOT NECESSARILY BE USED AT ALL SITES. IT
;	IS COMPLEX BECAUSE CHECKING MUST BE DONE FOR RANGE KEY
;	MATCHES AS WELL AS FOR EXACT KEY MATCHES. FOR RANGE KEY
;	MATCHES, WE HAVE TAKEN THE INTERPRETATION THAT A RANGE
;	MATCH EXISTS ONLY IF TWO CONDITIONS EXIST. THE FIRST IS
;	AS SPECIFIED IN THE DBMS VER 5 ADMINISTRATOR'S MANUALS
;	FOR RANGE KEY MATCHES ON PAGE 4-21 TECHNICAL NOTES 8 AND
;	9 AND ON PAGE 4-23 TECHNICAL NOTE 9. HOWEVER, THE LIST
;	OF CONDITIONS GIVEN IN NOTE 9 ON PAGE 4-23 APPLIES TO 
;	BOTH MODES OF SET OCCURRENCE SELECTION -- CURRENT OF SET
;	AS WELL AS LOCATION MODE OF OWNER. THE OTHER FORMS OF 
;	ORDER SORTED WHERE DUPLICATES ARE ALLOWED CURRENTLY 
;	ADHERE TO THIS INTERPRETATION. THE SECOND IS THAT
;	THE INTERNAL TYPE ID OF THE FOUND RECORD MUST MATCH THE
;	RECORD TYPE SPECIFIED BY THE USER AS THE "RECORD NAME"
;	PARAMETER SUPPLIED TO FINS6 UNDER ORDER SORTED DUPLICATES.
;
;
;
;NOTE ***** THIS EDIT APPLIES TO DBMS10 + DBMS20 V5A, AND TO COBOL
;		AND TO FORTRAN
;
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 540.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;
;	APPLY THIS EDIT TO DBSANY.REL **********
;
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;FOR A COBOL-68 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.540=DBSANY.REL,540.FIX/F
;  *LIBOL.540=LIBOL.REL/M:(DBFIND,DBSET),DBSANY.540/R:(DBFIND,DBSET)
;  *LIBOL.540=LIBOL.540/INDEX
;
;  R LINK
;  *LIBSHR,LIBOL.540/SEARCH/GO
;
;  SAVE LIBO12
;
;FOR A COBOL-74 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.540=DBSANY.REL,540.FIX/F
;  *C74LIB.540=C74LIB.REL/M:(DBFIND,DBSET),DBSANY.540/R:(DBFIND,DBSET)
;  *C74LIB.540=C74LIB.540/INDEX
;
;  R LINK
;  *C74SHR,C74LIB.521/SEARCH/GO
;
;  SAVE C74O12
;
;FOR FORTRAN DBMS SYSTEMS...
;
;  R MAKLIB
;  *DBSANY.540=DBSANY.REL,540.FIX/F
;  *FORLIB.540=FORLIB.REL/M:(DBFIND,DBSET),DBSANY.540/R:(DBFIND,DBSET)
;  *FORLIB.540=FORLIB.540/INDEX
;
;  R LINK
;  *FORLIB.540/INCLUDE:FOROTS,FORLIB.540/SEARCH/GO
;
;  SAVE FOROTS
;
;THE PATCHED FILES SOULD BE RENAMED TO .REL TO BE USED AS THE BASE FOR 
;	ANY FUTURE EDITS.
;
;
;**********************************************************************
;
;
.EDIT 540
.NAME JSM
.MODULE DBFIND
.INSERT FINS6$+14,AFTER,<HRRZ 2,0(2)>
	PUSH P,R2  ;SAVE ASIDE ADDR OF RCD'S IN-CORE RCD BLOCK
		  ;  AT FIXED POINT ON STACK -- FINS6 WILL RETURN
		  ;  THIS RECORD TYPE IN THE APPROPRIATE SYSCOM 
		  ;  FIELD
.ENDI
.INSERT FINS6$+35,BEFORE,<JUMPE 1,XC.NRS>
	POP P,TMP.RB(X)  ;GIVE BACK STACK LOC, ALSO SAVE RCD'S
		;IN-CORE BLOCK ADDR FOR SYSCOM REPORTING
.ENDI
.MODULE DBSET
.INSERT BO.TREE+10,BEFORE,<JRST BO.LEAF>
		;THE FOLLOWING TESTS ARE DONE HERE SO THAT THEY
		;WILL NOT HAVE TO BE DONE REPETITIOUSLY BELOW.
		;THEY ARE CHECKING FOR A SORTED SET FIND WITH
		;ORDER SORTED DUPLICATES FIRST/LAST/UNSPECIFIED
		;(BUT NOT "NOT") ALLOWED. FINS6 IS THE ONLY FIND
		;WHICH CALLS BO.TREE, AND THE SPECIAL CASE WHERE
		;STORE CALLS BO.TREE FOR INSERTS INTO SORTED SETS
		;IT IS NOT LEGAL TO HAVE SOME LEGITIMATE FORM OF
		;DUPLICATES IN THE SET DEFINITION.
	SETZM R0  ;INIT AC0 TO SET UP FLAGS FOR TESTS BELOW
	HRRZI R1,3  ;SET UP AC1 TO TEST IF DOING FIND. FINS6 IS
	CAMN R1,400(X)  ;  ONLY FIND USING BO.TREE
			;  NOTE: 400 = VERBID
	TRO R0,1  ;  YES -- SET "FIND" FLAG
	MOVE R1,3(MEMBLK)  ;RETRIEVE SET MEMBERSHIP DESCRIP FROM
			;  IN-CORE DB MEM BLK FOR RCD TYPE
	TRC R1,1400  ;COMPLEMENT THE BITS FOR ORDER SORTED DUP-
			;  LICATES
	TRNE R1,1700	;IS IT O. S. DUPS.?
	JRST .+4	;  NO
	TRC R1,3	;COMPLEM BITS FOR DUPS NOT ALLOWED
	TRNE R1,3	;IS IT DUPS NOT ALLOWED?
	TRO R0,2   ;  NO -- SET O.S. DUPS. FLAG
	PUSH P,R0  ;SAVE FLAGS ON STACK FOR TESTS BELOW
.ENDI
.INSERT BOL.L1+3,REPLACE:1,<JUMPE 0,BO.EX>
	CAIE R0,0  ;SUCCESSFUL KEY MATCH FROM COMITM?
	JRST .+16  ;  NO -- EITHER BYPASSED (<0) OR NOT YET (>0)
		;CAME HERE BECAUSE WE GOT AN EXACT MATCH ON USER
		;  SUPPLIED KEY -- WANT TO CHECK FOR MATCH ON
		;  USER RECORD TYPE.
	PUSH P,0  ;GET AN AC TO WORK WITH
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT NOT "NOT")
	CAME R1,-1(P)  ; DO TEST
	JRST .+10   ;FAILED -- DOING STORE FOR NESTED SETS WITH
			;  S.O.S. LOC. MODE OF OWNER OR OTHER
			;  O.S. FIND
	PUSHJ P,LIN.BF  ;GET TID OF CURR. REC. OF SET OCC. NOTE:
		; AP POINTS AT DBK.HX(X), WHICH IS WHAT WE WANT
		; LIN.BF TO HANDLE
	MOVE R1,15(X)  ;GET STACK POINTER SAVED ON ENTRY TO DBCS
		; (WAS CONTENTS OF P AT THAT POINT)
	MOVE R1,4(R1)  ;GET ADDR OF IN-CORE MEMB REC BLOCK -- 
			; WAS SAVED ASIDE IN PATCH AT FINS6$+14
	CAMN R0,3(R1)  ;TID OF FOUND REC = TID OF REC PASSED TO
			;  FINS6?
	JRST .+3     ; YES
	HRRZI R1,1  ;  NO -- PUT "NOT YET" FLAG IN STACK LOC
	MOVEM R1,0(P)  ;  WHICH WILL BE RESTORED TO R0
	POP P,0		;RESTORE R0 -- IN ITS CURRENT STATE
	JUMPE R0,BO.FEX+1  ;COMPLETE SUCCESS ON TID + USER KEY
				;  MATCH
.ENDI
.INSERT BOL.L1+5,AFTER,<SOJG 12,BOL.LP>
		;GOT HERE BECAUSE "NOT YET" FLAG WAS SET BY COMITM
		; AND BUOY CHAIN COUNT EXHAUSTED
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT NOT "NOT")
	CAME R1,0(P)  ;  DO TEST
	JRST .+21   ;FAILED -- DOING STORE FOR NESTED SETS WITH
			;  S.O.S. LOC. MODE OF OWNER OR OTHER
			;  O.S. FIND -- HOP BACK IN LINE
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+350  ;[V5A] CALL GET.PT TO POINT AT NEXT
	PUSHJ P,GET.PT    ;  REC IN SET OCC.
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	CAME R1,OWNDBK(X)  ;IS IT THE OWNER?
	JRST .+4	;  NO -- GO TO FIND ITS REC TYPE
	TRNN R2,2	;  YES -- ARE WE DOING DESC RANGE MATCH?
	JRST BO.FEX	;    NO -- FAILED ASCENDING RANGE MATCH
	JRST BO.OVP	;    YES -- GO TO WEND OUR WAY BACK THRU
			;       THE SET OCCURRENCE
	MOVEM R1,IDXKEY  ;  NO -- MUST BE A BUOY, CHECK IT OUT
	MOVEI AP,NEX.NO+310  ;SET UP FOR CALL TO LIN.BF TO POINT
	PUSHJ P,LIN.BF       ;  TO NEXT REC. IN SET OCC.
	MOVEM R1,RECKEY   ;MOVE BUFFER ADDR OF NEXT REC FOR SETUP
			;  ON RE-ENTERING BO.LEAF
	CAIE R0,3	;IS NEXT REC A BUOY?
	JRST XC.SOF	;  NO -- SET OCCURRENCE IS SCREWED UP
	JRST BO.LEAF	;  YES -- GO TO PROCESS BOUY
.ENDI
.INSERT BO.OVP+4,REPLACE:1,<JRST BO.EX>
		;GOT HERE IF DOING RANGE KEY AND BOUY CHAIN
		;   EXHAUSTED
	PUSH P,R1  ;GET AN AC -- ALSO SAVE ASIDE CURR DBKEY
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT "NOT")
	CAME R1,-1(P)  ; DO TEST
	JRST .+13	;  FAILED -- AS ABOVE
	POP P,IDXKEY  ;RESTORE TO AC13 -- SET UP FOR CALL TO LIN.BF
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+310
	PUSHJ P,LIN.BF  ;GET TID OF CURRENT RECORD
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	MOVE R1,15(X)  ;RETRIEVE TID OF REC TYPE PASSED TO FINS6
	MOVE R1,4(R1)  ;  AS ABOVE
	CAMN R0,3(R1)  ;ARE TIDS = ? I.E. SAME REC TYPE?
	JRST .+3	;  YES -- SUCCESS
	JRST BO.OVLAP	;  NO --RECYCLE
	POP P,R1	;BYPASS FROM JRST .+11 ABOVE -- RESTORE AC
	JRST BO.FEX+1   ;TO GIVE BACK AC FROM BO.TREE+10 ABOVE
.ENDI
.INSERT BO.FEX+1,BEFORE,<JRST BO.EX>
	POP P,R1   ;RESTORE STACK, BUT DON'T CLOBBER AC0
		   ;  AC1 WILL BE REFILLED BY MEM.FX (THE FINS6
		   ;  CALLER) OR OWN.SOS (THE STORE CALLER)
.ENDI
.INSERT NEX.NO+360,REPLACE:1,<JRST BO.EX> ;[V5A]
		;GOT HERE BECAUSE DOING RANGE KEY AND BYPASSED
		;  FLAG IS ON (AC0<0) -- MUST CONTINUE SCAN FOR
		;  RANGE MATCH
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT "NOT")
	CAME R1,0(P)  ;DO TEST
	JRST .+7	;  FAILED -- BYPASS
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	PUSHJ  P,LIN.BF	;FIND TID OF CURRENT REC -- AC16 ALREADY
			;  POINTING AT IT
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	MOVE R1,15(X)	;FIND TID OF REC TYPE PASSED TO FINS6
	MOVE R1,4(R1)
	CAMN R0,3(R1)	;TID'S = ?
	JRST BO.FEX+1   ;  YES -- SUCCESS
	JRST BO.OVLAP	;  NO -- RECYCLE TO PICK UP NEXT/PRIOR REC
.ENDI
.INSERT NEX.NO+363,REPLACE:1,<JRST BO.EX> ;[V5A]
	JRST BO.FEX+1	;TO RESTORE STACK -- GIVE BACK AC
.ENDI
.INSERT NEX.NO+371,REPLACE:3,<MOVEI AP,NEX.NO+366> ;[V5A]
		;REPLACE:3 DONE HERE TO AVOID TWO FUNCTIONAL
		;  JUMPA'S IN A ROW
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+366  ;[V5A] CALL TO FIND NEXT OF SET -- IN
	PUSHJ P,FND.NS		; ORIGINAL CODE
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	JRST BO.OVP+1	;TO TEST IF NEXT IS OWNER -- IN ORIG CODE
		;IF WE HAVE BUMPED INTO THE OWNER HERE, SEARCH 
		;  HAS FAILED
.ENDI
.INSERT NEX.NO+374,REPLACE:3,<MOVEI AP,NEX.NO+366> ;[V5A]
		;REPLACE:3 DONE HERE TO AVOID TWO FUNCTIONAL
		;  JUMPA'S IN A ROW
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+366  ;[V5A] CALL TO FIND PRIOR OF SET -- IN
	PUSHJ P,FND.PS		; ORIGINAL CODE
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	JRST BO.OVP+1	;TO TEST IF PRIOR IS OWNER -- IN ORIG CODE
		;IF WE HAVE BUMPED INTO THE OWNER HERE, SEARCH 
		;  HAS FAILED
.ENDI
.ENDE
;VERSION 5A COMMENT.
;
;	THIS WAS EDIT 456 FOR VERSION 5. NO CHANGES WERE REQUIRED
;	IN THE MAKLIB TEXT.
;
;SYMPTOM:
;
;	WHEN THE CALC CHAIN POINTER IN A CALC RECORD POINTS TO ITSELF,
;	WITH DUPLICATES NOT ALLOWED THE USER PROGRAM HANGS, BUT WITH
;	WITH DUPLICATES ALLOWED THE USER PROGRAM LOOPS.
;
;DIAGNOSIS:
;
;	FIND RSE 5 IS NOT EXPECTING A CALC-CHAIN POINTER TO POINT TO
;	ITSELF, AND IT ACCEPTS THIS CORRUPT POINTER AS THE POINTER
;	TO THE NEXT RECORD ON THE CALC CHAIN. THIS KIND OF CORRUPTION
;	CAN OCCUR IF AN ERROR-STATUS CODE IS ISSUED ON A STORE OF A
;	CALC RECORD AND THE FAILED STORE IS NOT PROPERLY BACKED OUT.
;	FIND RSE 5 CHECKS FOR OTHER KINDS OF INCONSISTENCIES ON CALC-
;	CHAIN POINTERS, HOWEVER.
;
;CURE:
;
;	INSTALL EDIT 551 FOR DBMS-10/20 V5A, WHICH WILL SPOT-CHECK
;	CALC-CHAIN POINTERS TO SEE IF THEY POINT BACK TO THEMSELVES.
;	IF IT FINDS THIS CONDITION, IT WILL ISSUE AN ERROR-STATUS CODE
;	OF 356.
;	
;
;NOTE ***** THIS EDIT APPLIES TO BOTH DBMS-10 AND DBMS-20 VERSION 5A.
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 551.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;	APPLY THIS EDIT TO DBSANY.REL
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;  FOR A COBOL-68 DBMS SYSTEM...
;
;	R MAKLIB
;	*DBSANY.551=DBSANY.REL,551.FIX/F
;	*LIBOL.551=LIBOL.REL/M:DBCALC,DBSANY.551/R:DBCALC
;	*LIBOL.551=LIBOL.551/INDEX
;
;	R LINK
;	*LIBSHR,LIBOL.551/SEARCH/GO
;
;	SAVE LIBO12
;
;  FOR A COBOL-74 DBMS SYSTEM...
;
;	R MAKLIB
;	*DBSANY.551=DBSANY.REL,551.FIX/F
;	*C74LIB.551=C74LIB.REL/M:DBCALC,DBSANY.551/R:DBCALC
;	*C74LIB.551=C74LIB.551/INDEX
;
;	R LINK
;	*C74SHR,C74LIB.551/SEARCH/GO
;
;	SAVE C74O12
;
;  FOR FORTRAN DBMS SYSTEMS...
;
;	R MAKLIB
;	*DBSANY.551=DBSANY.REL,551.FIX/F
;	*FORLIB.551=FORLIB.REL/M:DBCALC,DBSANY.551/R:DBCALC
;	*FORLIB.551=FORLIB.551/INDEX
;
;	R LINK
;	*FORLIB.551/INCLUDE:FOROTS,FORLIB.551/SEARCH/GO
;
;	SAVE FOROTS
;
;THE PATCHED FILES SHOULD BE RENAMED TO  .REL TO BE USED AS THE BASE
;FOR ANY FUTURE EDITS.
;
;
.EDIT 551
.MODULE DBCALC
.NAME JSM
.INSERT CAF.LP+1,AFTER,<PUSHJ P,CC.ITM>
	CAMN	R1,DBNEXT	;NEXT DBKEY SAME AS CURRENT?
	PUSHJ	P,XC.DAT##	;YES -- BAD CALC CHAIN ENTRY
.ENDI
.ENDE
;VERSION 5A COMMENT
;
;	THE CORRESPONDING EDIT FOR VERSION 5 IS EDIT 467.
;
;SYMPTOM:
;
;	A DML PROGRAM USING ENTER MACRO JRDATA, WHICH OMITS THE SECOND
;	PARAMETER INDICATING THE NUMBER OF WORDS OF NON-PRINTING DATA
;	TO BE PASSED TO THE JOURNAL, FAILS WITH A ?MEMORY PROTECTION
;	VIOLATION.
;
;DIAGNOSIS:
;
;	JRDATA NEVER CHECKS TO SEE IF THIS REQUIRED PARAMETER IS PRESENT
;	AND MERELY ASSUMES THAT IT IS THERE.
;
;CURE:
;
;	INSTALL EDIT 562 FOR DBMS-10/20 V5A TO MAKE JRDATA CHECK FOR THE
;	PRESENCE OF THIS REQUIRED PARAMETER. IT IT IS NOT PRESENT, MAKE
;	JRDATA GIVE AN ERROR-STATUS CODE OF 1658.
;
;NOTE ***** THIS EDIT APPLIES TO DBMS10 AND DBMS20 VERSION 5A ONLY!
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 562.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;	APPLY THIS EDIT TO DBSANY.REL
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;  FOR A COBOL-68 DBMS SYSTEM...
;
;	R MAKLIB
;	*DBSANY.562=DBSANY.REL,562.FIX/F
;	*LIBOL.562=LIBOL.REL/M:DBJOUR,DBSANY.562/R:DBJOUR
;	*LIBOL.562=LIBOL.562/INDEX
;
;	R LINK
;	*LIBSHR,LIBOL.562/SEARCH/GO
;
;	SAVE LIBO12
;
;  FOR A COBOL-74 DBMS SYSTEM...
;
;	R MAKLIB
;	*DBSANY.562=DBSANY.REL,562.FIX/F
;	*C74LIB.562=C74LIB.REL/M:DBJOUR,DBSANY.562/R:DBJOUR
;	*C74LIB.562=C74LIB.562/INDEX
;
;	R LINK
;	*C74SHR,C74LIB.562/SEARCH/GO
;
;	SAVE C74O12
;
;  FOR FORTRAN DBMS SYSTEMS...
;
;	R MAKLIB
;	*DBSANY.562=DBSANY.REL,562.FIX/F
;	*FORLIB.562=FORLIB.REL/M:DBJOUR,DBSANY.562/R:DBJOUR
;	*FORLIB.562=FORLIB.562/INDEX
;
;	R LINK
;	*FORLIB.562/INCLUDE:FOROTS,FORLIB.562/SEARCH/GO
;
;	SAVE FOROTS
;
;THE PATCHED FILES SHOULD BE RENAMED TO  .REL TO BE USED AS THE BASE
;FOR ANY FUTURE EDITS.
;
.EDIT 562
.MODULE DBJOUR
.NAME JSM
.INSERT JRDAT$,BEFORE,<MOVEI R2,@DATA(AP)>
	MOVE	R0,@SIZE(AP)	;GET SECOND PARM INTO R0 FOR TEST
	PUSHJ	P,ISNUMOK	;DO TEST, IF RETURN .+1 TEST SUCCESSFUL
.ENDI
.ENDE
;SYMPTOM
;
;	WITH EDIT 540 INSTALLED, FINS6 APPEARS TO LOOP INDEFINITELY IN
;	CASES WHERE THERE ARE NO OWNER POINTERS IN THE MEMBER RECORDS
;	OF A SORTED SET OCCURRENCE.
;
;DIAGNOSIS
;
;	IN EDIT 540 THE CALL TO LIN.BF ASSUMES THAT REGISTER AP IS STILL
;	SET UP FROM THE PREVIOUS CALL, BUT IN THE CASE DESCRIBED IN THE
;	SYMPTOM THIS REGISTER HAS BEEN CLOBBERED.
;
;CURE
;
;	INSTALL EDIT 565 TO TEACH EDIT 540 HOW TO PRESERVE THE REGISTER.
;
;	NOTE: THIS EDIT REMOVES EDIT 540. IF YOU DO NOT HAVE EDIT 540 
;	INSTALLED, OMIT THE TWO OCCURRENCES OF THE MAKLIB INSTRUCTION
;	".REMOVE 540" WHICH ARE SHOWN IN THE TEXT OF THE EDIT BELOW.
;
;NOTE ***** THIS EDIT APPLIES TO DBMS10 + DBMS20 V5A, AND TO COBOL
;		AND TO FORTRAN
;
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 565.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;
;	APPLY THIS EDIT TO DBSANY.REL **********
;
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;FOR A COBOL-68 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.565=DBSANY.REL,565.FIX/F
;  *LIBOL.565=LIBOL.REL/M:(DBFIND,DBSET),DBSANY.565/R:(DBFIND,DBSET)
;  *LIBOL.565=LIBOL.565/INDEX
;
;  R LINK
;  *LIBSHR,LIBOL.565/SEARCH/GO
;
;  SAVE LIBO12
;
;FOR A COBOL-74 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.565=DBSANY.REL,565.FIX/F
;  *C74LIB.565=C74LIB.REL/M:(DBFIND,DBSET),DBSANY.565/R:(DBFIND,DBSET)
;  *C74LIB.565=C74LIB.565/INDEX
;
;  R LINK
;  *C74SHR,C74LIB.521/SEARCH/GO
;
;  SAVE C74O12
;
;FOR FORTRAN DBMS SYSTEMS...
;
;  R MAKLIB
;  *DBSANY.565=DBSANY.REL,565.FIX/F
;  *FORLIB.565=FORLIB.REL/M:(DBFIND,DBSET),DBSANY.565/R:(DBFIND,DBSET)
;  *FORLIB.565=FORLIB.565/INDEX
;
;  R LINK
;  *FORLIB.565/INCLUDE:FOROTS,FORLIB.565/SEARCH/GO
;
;  SAVE FOROTS
;
;THE PATCHED FILES SOULD BE RENAMED TO .REL TO BE USED AS THE BASE FOR 
;	ANY FUTURE EDITS.
;
;
;**********************************************************************
;
;
.EDIT 565
.NAME CLH
.MODULE DBFIND
.REMOVE 540
.INSERT FINS6$+14,AFTER,<HRRZ 2,0(2)>
	PUSH P,R2  ;SAVE ASIDE ADDR OF RCD'S IN-CORE RCD BLOCK
		  ;  AT FIXED POINT ON STACK -- FINS6 WILL RETURN
		  ;  THIS RECORD TYPE IN THE APPROPRIATE SYSCOM 
		  ;  FIELD
.ENDI
.INSERT FINS6$+35,BEFORE,<JUMPE 1,XC.NRS>
	POP P,TMP.RB(X)  ;GIVE BACK STACK LOC, ALSO SAVE RCD'S
		;IN-CORE BLOCK ADDR FOR SYSCOM REPORTING
.ENDI
.MODULE DBSET
.REMOVE 540
.INSERT BO.TREE+10,BEFORE,<JRST BO.LEAF>
		;THE FOLLOWING TESTS ARE DONE HERE SO THAT THEY
		;WILL NOT HAVE TO BE DONE REPETITIOUSLY BELOW.
		;THEY ARE CHECKING FOR A SORTED SET FIND WITH
		;ORDER SORTED DUPLICATES FIRST/LAST/UNSPECIFIED
		;(BUT NOT "NOT") ALLOWED. FINS6 IS THE ONLY FIND
		;WHICH CALLS BO.TREE, AND THE SPECIAL CASE WHERE
		;STORE CALLS BO.TREE FOR INSERTS INTO SORTED SETS
		;IT IS NOT LEGAL TO HAVE SOME LEGITIMATE FORM OF
		;DUPLICATES IN THE SET DEFINITION.
	SETZM R0  ;INIT AC0 TO SET UP FLAGS FOR TESTS BELOW
	HRRZI R1,3  ;SET UP AC1 TO TEST IF DOING FIND. FINS6 IS
	CAMN R1,400(X)  ;  ONLY FIND USING BO.TREE
			;  NOTE: 400 = VERBID
	TRO R0,1  ;  YES -- SET "FIND" FLAG
	MOVE R1,3(MEMBLK)  ;RETRIEVE SET MEMBERSHIP DESCRIP FROM
			;  IN-CORE DB MEM BLK FOR RCD TYPE
	TRC R1,1400  ;COMPLEMENT THE BITS FOR ORDER SORTED DUP-
			;  LICATES
	TRNE R1,1700	;IS IT O. S. DUPS.?
	JRST .+4	;  NO
	TRC R1,3	;COMPLEM BITS FOR DUPS NOT ALLOWED
	TRNE R1,3	;IS IT DUPS NOT ALLOWED?
	TRO R0,2   ;  NO -- SET O.S. DUPS. FLAG
	PUSH P,R0  ;SAVE FLAGS ON STACK FOR TESTS BELOW
.ENDI
.INSERT BOL.L1+3,REPLACE:1,<JUMPE 0,BO.EX>
	CAIE R0,0  ;SUCCESSFUL KEY MATCH FROM COMITM?
	JRST .+16  ;  NO -- EITHER BYPASSED (<0) OR NOT YET (>0)
		;CAME HERE BECAUSE WE GOT AN EXACT MATCH ON USER
		;  SUPPLIED KEY -- WANT TO CHECK FOR MATCH ON
		;  USER RECORD TYPE.
	PUSH P,0  ;GET AN AC TO WORK WITH
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT NOT "NOT")
	CAME R1,-1(P)  ; DO TEST
	JRST .+10   ;FAILED -- DOING STORE FOR NESTED SETS WITH
			;  S.O.S. LOC. MODE OF OWNER OR OTHER
			;  O.S. FIND
	MOVEI 16,[-1,,0
		DBK.HX(X)]+1	;[565] SET UP ARG FOR LIN.BF TO FIND
	PUSHJ P,LIN.BF  ;GET TID OF CURR. REC. OF SET OCC.
	MOVE R1,15(X)  ;GET STACK POINTER SAVED ON ENTRY TO DBCS
		; (WAS CONTENTS OF P AT THAT POINT)
	MOVE R1,4(R1)  ;GET ADDR OF IN-CORE MEMB REC BLOCK -- 
			; WAS SAVED ASIDE IN PATCH AT FINS6$+14
	CAMN R0,3(R1)  ;TID OF FOUND REC = TID OF REC PASSED TO
			;  FINS6?
	JRST .+3     ; YES
	HRRZI R1,1  ;  NO -- PUT "NOT YET" FLAG IN STACK LOC
	MOVEM R1,0(P)  ;  WHICH WILL BE RESTORED TO R0
	POP P,0		;RESTORE R0 -- IN ITS CURRENT STATE
	JUMPE R0,BO.FEX+1  ;COMPLETE SUCCESS ON TID + USER KEY
				;  MATCH
.ENDI
.INSERT BOL.L1+5,AFTER,<SOJG 12,BOL.LP>
		;GOT HERE BECAUSE "NOT YET" FLAG WAS SET BY COMITM
		; AND BUOY CHAIN COUNT EXHAUSTED
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT NOT "NOT")
	CAME R1,0(P)  ;  DO TEST
	JRST .+21   ;FAILED -- DOING STORE FOR NESTED SETS WITH
			;  S.O.S. LOC. MODE OF OWNER OR OTHER
			;  O.S. FIND -- HOP BACK IN LINE
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+350  ;[V5A] CALL GET.PT TO POINT AT NEXT
	PUSHJ P,GET.PT    ;  REC IN SET OCC.
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	CAME R1,OWNDBK(X)  ;IS IT THE OWNER?
	JRST .+4	;  NO -- GO TO FIND ITS REC TYPE
	TRNN R2,2	;  YES -- ARE WE DOING DESC RANGE MATCH?
	JRST BO.FEX	;    NO -- FAILED ASCENDING RANGE MATCH
	JRST BO.OVP	;    YES -- GO TO WEND OUR WAY BACK THRU
			;       THE SET OCCURRENCE
	MOVEM R1,IDXKEY  ;  NO -- MUST BE A BUOY, CHECK IT OUT
	MOVEI AP,NEX.NO+310  ;SET UP FOR CALL TO LIN.BF TO POINT
	PUSHJ P,LIN.BF       ;  TO NEXT REC. IN SET OCC.
	MOVEM R1,RECKEY   ;MOVE BUFFER ADDR OF NEXT REC FOR SETUP
			;  ON RE-ENTERING BO.LEAF
	CAIE R0,3	;IS NEXT REC A BUOY?
	JRST XC.SOF	;  NO -- SET OCCURRENCE IS SCREWED UP
	JRST BO.LEAF	;  YES -- GO TO PROCESS BOUY
.ENDI
.INSERT BO.OVP+4,REPLACE:1,<JRST BO.EX>
		;GOT HERE IF DOING RANGE KEY AND BOUY CHAIN
		;   EXHAUSTED
	PUSH P,R1  ;GET AN AC -- ALSO SAVE ASIDE CURR DBKEY
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT "NOT")
	CAME R1,-1(P)  ; DO TEST
	JRST .+13	;  FAILED -- AS ABOVE
	POP P,IDXKEY  ;RESTORE TO AC13 -- SET UP FOR CALL TO LIN.BF
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+310
	PUSHJ P,LIN.BF  ;GET TID OF CURRENT RECORD
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	MOVE R1,15(X)  ;RETRIEVE TID OF REC TYPE PASSED TO FINS6
	MOVE R1,4(R1)  ;  AS ABOVE
	CAMN R0,3(R1)  ;ARE TIDS = ? I.E. SAME REC TYPE?
	JRST .+3	;  YES -- SUCCESS
	JRST BO.OVLAP	;  NO --RECYCLE
	POP P,R1	;BYPASS FROM JRST .+11 ABOVE -- RESTORE AC
	JRST BO.FEX+1   ;TO GIVE BACK AC FROM BO.TREE+10 ABOVE
.ENDI
.INSERT BO.FEX+1,BEFORE,<JRST BO.EX>
	POP P,R1   ;RESTORE STACK, BUT DON'T CLOBBER AC0
		   ;  AC1 WILL BE REFILLED BY MEM.FX (THE FINS6
		   ;  CALLER) OR OWN.SOS (THE STORE CALLER)
.ENDI
.INSERT NEX.NO+360,REPLACE:1,<JRST BO.EX> ;[V5A]
		;GOT HERE BECAUSE DOING RANGE KEY AND BYPASSED
		;  FLAG IS ON (AC0<0) -- MUST CONTINUE SCAN FOR
		;  RANGE MATCH
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT "NOT")
	CAME R1,0(P)  ;DO TEST
	JRST .+7	;  FAILED -- BYPASS
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	PUSHJ  P,LIN.BF	;FIND TID OF CURRENT REC -- AC16 ALREADY
			;  POINTING AT IT
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	MOVE R1,15(X)	;FIND TID OF REC TYPE PASSED TO FINS6
	MOVE R1,4(R1)
	CAMN R0,3(R1)	;TID'S = ?
	JRST BO.FEX+1   ;  YES -- SUCCESS
	JRST BO.OVLAP	;  NO -- RECYCLE TO PICK UP NEXT/PRIOR REC
.ENDI
.INSERT NEX.NO+363,REPLACE:1,<JRST BO.EX> ;[V5A]
	JRST BO.FEX+1	;TO RESTORE STACK -- GIVE BACK AC
.ENDI
.INSERT NEX.NO+371,REPLACE:3,<MOVEI AP,NEX.NO+366> ;[V5A]
		;REPLACE:3 DONE HERE TO AVOID TWO FUNCTIONAL
		;  JUMPA'S IN A ROW
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+366  ;[V5A] CALL TO FIND NEXT OF SET -- IN
	PUSHJ P,FND.NS		; ORIGINAL CODE
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	JRST BO.OVP+1	;TO TEST IF NEXT IS OWNER -- IN ORIG CODE
		;IF WE HAVE BUMPED INTO THE OWNER HERE, SEARCH 
		;  HAS FAILED
.ENDI
.INSERT NEX.NO+374,REPLACE:3,<MOVEI AP,NEX.NO+366> ;[V5A]
		;REPLACE:3 DONE HERE TO AVOID TWO FUNCTIONAL
		;  JUMPA'S IN A ROW
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+366  ;[V5A] CALL TO FIND PRIOR OF SET -- IN
	PUSHJ P,FND.PS		; ORIGINAL CODE
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	JRST BO.OVP+1	;TO TEST IF PRIOR IS OWNER -- IN ORIG CODE
		;IF WE HAVE BUMPED INTO THE OWNER HERE, SEARCH 
		;  HAS FAILED
.ENDI
.ENDE
;SYMPTOM
;
;	WHEN USING THE FIND identifier-2 FORMAT OF FIND RSE 3 AND IF
;	identifier-2 IS NOT DECLARED AS A DATA-NAME WITH PICTURE S9(10)
;	OR LESS AND USAGE COMP (IN OTHER WORDS ONE-WORD BINARY), THIS
;	FORM OF THE RSE DOES NOT NECESSARILY RETRIEVE THE CORRECT RECORD
;	OCCURRENCE OR RETURN AN APPROPRIATE ERROR-STATUS CODE.
;
;DIAGNOSIS
;
;	THE RSE EXPECTS THAT THE identifier-2 WHICH IS PASSED TO IT MUST
;	BE ONE-WORD BINARY BUT IT DOES NOT CHECK TO SEE IF IT IS.
;
;CURE
;
;	INSTALL EDIT 566 TO MAKE FIND RSE 3 CHECK THE DATA TYPE OF THE
;	PASSED identifier-2 AND IF IT IS NOT COMPUTATIONAL, TO REJECT
;	IT WITH AN ERROR-STATUS CODE OF 358.
;
;NOTE ***** THIS EDIT APPLIES TO DBMS10 + DBMS20 V5A, AND TO COBOL
;		AND TO FORTRAN
;
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 566.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;
;	APPLY THIS EDIT TO DBSANY.REL **********
;
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;FOR A COBOL-68 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.566=DBSANY.REL,566.FIX/F
;  *LIBOL.566=LIBOL.REL/M:(DBFIND),DBSANY.566/R:(DBFIND)
;  *LIBOL.566=LIBOL.566/INDEX
;
;  R LINK
;  *LIBSHR,LIBOL.566/SEARCH/GO
;
;  SAVE LIBO12
;
;FOR A COBOL-74 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.566=DBSANY.REL,566.FIX/F
;  *C74LIB.566=C74LIB.REL/M:(DBFIND),DBSANY.566/R:(DBFIND)
;  *C74LIB.566=C74LIB.566/INDEX
;
;  R LINK
;  *C74SHR,C74LIB.566/SEARCH/GO
;
;  SAVE C74O12
;
;FOR FORTRAN DBMS SYSTEMS...
;
;  R MAKLIB
;  *DBSANY.566=DBSANY.REL,566.FIX/F
;  *FORLIB.566=FORLIB.REL/M:(DBFIND),DBSANY.566/R:(DBFIND)
;  *FORLIB.566=FORLIB.566/INDEX
;
;  R LINK
;  *FORLIB.566/INCLUDE:FOROTS,FORLIB.566/SEARCH/GO
;
;  SAVE FOROTS
;
;THE PATCHED FILES SOULD BE RENAMED TO .REL TO BE USED AS THE BASE FOR 
;	ANY FUTURE EDITS.
;
;
;**********************************************************************
;
;
.EDIT 566
.NAME JSM
.MODULE DBFIND
.INSERT FINDO$+1,AFTER,<MOVEI R2,F3.OFF>
	HLRZ	R4,OFSET(AP)	;GET DATA TYPE OF PASSED identifier-2
	CAIE	R4,100		;IS IT ONE-WORD BINARY
	PUSHJ	P,XC.ARG	;NO -- GIVE 358 ERROR-STATUS
.ENDI
.ENDE
;SYMPTOM
;
;	IN FIND RSE 3 THE SYNTAX FOR SET OR FOR AREA CAN BE USED INDIS-
;	CRIMINATELY WITH A USER-DEFINED SET-NAME OR AREA-NAME.
;
;DIAGNOSIS
;
;	FIND RSE 3 DOES NOT CHECK WHETHER IT HAS BEEN PASSED THE AREA
;	PARAMETER OR THE SET PARAMETER.
;
;CURE
;
;	INSTALL EDIT 570 TO MAKE FIND RSE 3 CHECK WHETHER THE APPRO-
;	PRIATE PARAMETER HAS BEEN PASSED WITH THE USER-DEFINED NAME.
;
;NOTE ***** THIS EDIT APPLIES TO DBMS10 + DBMS20 V5A, AND TO COBOL
;		AND TO FORTRAN
;
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 570.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;
;	APPLY THIS EDIT TO DBSANY.REL **********
;
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;FOR A COBOL-68 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.570=DBSANY.REL,570.FIX/F
;  *LIBOL.570=LIBOL.REL/M:(DBFIND),DBSANY.570/R:(DBFIND)
;  *LIBOL.570=LIBOL.570/INDEX
;
;  R LINK
;  *LIBSHR,LIBOL.570/SEARCH/GO
;
;  SAVE LIBO12
;
;FOR A COBOL-74 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.570=DBSANY.REL,570.FIX/F
;  *C74LIB.570=C74LIB.REL/M:(DBFIND),DBSANY.570/R:(DBFIND)
;  *C74LIB.570=C74LIB.570/INDEX
;
;  R LINK
;  *C74SHR,C74LIB.570/SEARCH/GO
;
;  SAVE C74O12
;
;FOR FORTRAN DBMS SYSTEMS...
;
;  R MAKLIB
;  *DBSANY.570=DBSANY.REL,570.FIX/F
;  *FORLIB.570=FORLIB.REL/M:(DBFIND),DBSANY.570/R:(DBFIND)
;  *FORLIB.570=FORLIB.570/INDEX
;
;  R LINK
;  *FORLIB.570/INCLUDE:FOROTS,FORLIB.570/SEARCH/GO
;
;  SAVE FOROTS
;
;THE PATCHED FILES SOULD BE RENAMED TO .REL TO BE USED AS THE BASE FOR 
;	ANY FUTURE EDITS.
;
;
;**********************************************************************
;
;
.EDIT 570
.NAME JSM
.MODULE DBFIND
.INSERT ..0004,AFTER,<MOVEM R1,FND.1(X)>
	MOVE	BLK,@3(AP)	;GET PARAMETER FOR AREA/SET SYNTAX
				;THESE PARMS ARE DOCUMENTED IN THE PGMR'S
				;MANUAL ON PAGE A-2, WHERE THE DECIMAL
				;VALUES ARE GIVEN. THUS, WE CAN ADD
				;OCTAL 32 TO FIND THE APPROP VALUE TO
				;COMPARE WITH THE LH OF THE ENTRY FOUND
				;IN THE SYMBOL NODE TABLE
	ADDI	BLK,32		;TO BUMP IT UP FOR COMPARE BELOW
	PUSH	P,BLK		;SAVE IT ASIDE FOR COMPARE BELOW
.ENDI
.INSERT ..0004+5,AFTER,<HLRZ TAP,0(BLK)>
	CAME	TAP,0(P)	;USER SYMBOL TYPE FROM IDVEC = PASSED PARM?
	PUSHJ	P,XC.ARG	;NO -- GIVE ERROR-STATUS 358
	POP	P,TAP		;YES, ALSO POP LOCATION OFF STACK.
.ENDI
.ENDE
;SYMPTOM:
;
;	WHEN USING DBMEND TO DO THE FIRST OPEN ON A SYSTEM AREA WHICH
;	JUST BEEN CREATED BY THE SCHEMA PROCESSOR, DBMEND DOES NOT
;	CREATE THE SYSTEM RECORD AND INITIALIZE THE SETS WHICH IT OWNS.
;
;DIAGNOSIS:
;
;	DBMEND IN VERSION 5A DOES NOT KNOW ABOUT RECORDS AND SETS, EXCEPT
;	FOR THE AREA STATUS RECORD, AS IT ONLY KNOWS ABOUT DATA BASE
;	AREAS AND PAGES. SO, WHEN IT OPENS A NEWLY CREATED AREA, IT DOES
;	NOT KNOW THAT IT IS BEING EXPECTED TO CREATE THE SYSTEM RECORD
;	WHEN IT OPENS THE SYSTEM AREA. IT WOULD BE EXTREMELY DIFFICULT
;	TO TEACH DBMEND ABOUT THE SYSTEM RECORD, AND BESIDES DBMEND
;	SHOULD NOT BE USED TO OPEN OR FORCEOPEN A NEWLY CREATED AREA.
;	RATHER, A USER-PROGRAMMED RUN-UNIT SHOULD BE DOING THIS INSTEAD.
;	SO, THE BEST APPROACH IS FOR DBMEND TO GIVE AN ERROR MESSAGE IF
;	IT IS USED IN THIS CIRCUMSTANCE. SINCE DBMEND DOES NOT KNOW ABOUT
;	RECORDS, WE CAN USE THIS FACT AS A BASIS FOR TESTING FOR THIS
;	ERRONEOUS USAGE. 
;
;
;	HOWEVER, THE AREA STATUS RECORD HAS ALREADY BEEN FORMATTED IN THE
;	BUFFER AND THE BUFFER HAS ALREADY BEEN FLAGGED AS UPDATED BEFORE
;	THIS TEST IS MADE. AS A RESULT, THIS EDIT WILL NOT UN-DO THE
;	UPDATE BEING DONE BY DBMEND. IT WILL ONLY AVISE THE USER THAT HE
;	HAS INCURRED A PROBLEM. AS A RESULT, HE WILL HAVE TO GO BACK AND
;	RE-CREATE THE AREA AS INDICATED IN THE EXPLANATION OF ERROR-STATUS
;	CODE XX43 IN THE DBMS-10/20 PROGRAMMERS MANUALS.
;
;CURE:
;
;	INSTALL EDIT 571 IN ORDER TO DO THE APPROPRIATE CHECKING AND TO
;	HAVE DBMEND GIVE THE ?MNDACS ERROR MESSAGE IN THIS SITUATION.
;
;	NOTE 1: THIS EDIT IS INSTALLED INTO THE DBSANY CODE WHICH IS USED
;	BY DBCS AND DBINFO, AS WELL AS DBMEND, FOR OPENING DATA BASE
;	AREAS. IT MAY BE INSTALLED INTO DBCS AND DBINFO WITH NO ILL
;	EFFECT BECAUSE DBCS AND DBINFO KNOW ABOUT RECORDS. BESIDES,
;	DBINFO ONLY OPENS THE DATA BASE IN USAGE-MODE EXCLUSIVE RETRIEVAL
;	AND DOES NOT UPDATE THE DATA BASE. ALSO, WHEN DBINFO ATTEMPTS
;	TO OPEN A NEWLY CREATED AREA, IT ALREADY GIVES THE ?INFAOE ERROR
;	MESSAGE.
;
;	NOTE 2: THIS EDIT ONLY CAUSES DBMEND TO PRODUCE THE ?MNDACS
;	ERROR MESSAGE WHEN IT GETS INVOLVED IN THE INITIALIZATION OF A
;	DATA BASE AREA. IT DOES NOT INHIBIT FURTHER ATTEMPTS TO OPEN
;	THE AREA, EVEN WITHIN THE SAME RUN OF DBMEND. THUS, IT IS
;	EXPECTED THAT THE USER WILL TAKE DIAGNOSTIC ACTION ON THE BASIS
;	OF THE APPEARANCE OF THE ERROR MESSAGE ITSELF.
;
;NOTE ***** THIS EDIT APPLIES TO DBMS10 + DBMS20 VERSION 5A
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 571.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;	APPLY THIS EDIT TO DBSANY.REL
;
;EVEN THOUGH THE EDIT MAY BE BUILT INTO ALL DBMS-10/20 COMPONENTS WHICH
;USE DBSANY, INSTALLATION INSTRUCTIONS WILL BE GIVEN ONLY FOR DBMEND.
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;FOR DBMEND-10:
;
;	.R MAKLIB
;	*DBSANY.REL=DBSANY.REL,571.FIX/FIX
;
;	.R LINK
;	*@DBMEN1
;
;	.SAVE DBMEND
;
;FOR DBMEND-20:
;
;	@R MAKLIB
;	*DBSANY.REL=DBSANY.REL,571.FIX/FIX
;
;	@R LINK
;	*@DBMEN2
;
;	@SAVE DBMEND
;
;
;***************************************************************
.EDIT 571
.NAME JSM
.MODULE DBOPEN
.INSERT OP.ARINI+11,BEFORE,<HLRZ R0,SYSREC(SS)>
	MOVE	R0,127(SS)	;GET THE POINTER TO THE RECORD LIST FOR
				; FOR THE SUB-SCHEMA. (RECLIST=127)
	CAIN	R0,0		;DOES IT CONTAIN A NON-ZERO VALUE?
	PUSHJ	P,XC.ACS##	;NO -- WE ARE IN DBMEND -- GIVE ERROR MSG
.ENDI
.ENDE
;SYMPTOM
;
;	WITH EDIT 565 INSTALLED, FINS6 INCORRECTLY EXCLUDES RECORDS FROM
;	ITS SEARCH PROCEDURE, RETURNING AN ERROR-STATUS CODE OF 326 WHEN
;	THE DESIRED RECORD EXISTS ON THE SORTED SET OCCURRENCE. IN OTHER
;	CASES, IT WAS REPORTING A SUCCESSFUL RETRIEVAL PREMATURELY.
;
;DIAGNOSIS
;
;	EDIT 565 FAILED TO UPDATE TWO "JRST" INSTRUCTIONS WHEN IT ADDED 
;	AN INSTRUCTION IN THE FOURTH INSERT OF EDIT 540.
;
;CURE
;
;	INSTALL EDIT 577 TO CAUSE EDIT 565 TO "JRST" TO THE PROPER
;	INSTRUCTION IN BOTH CASES.
;
;	NOTE: THIS EDIT REMOVES EDIT 565. EDIT 565 REMOVED EDIT 540.
;	IF YOU DO NOT HAVE EITHER EDIT INSTALLED, OMIT THE TWO OCCUR-
;	RENCES OF THE MAKLIB INSTRUCTION ".REMOVE 565" SHOWN IN THE
;	TEXT OF THE EDIT BELOW. IF YOU HAVE EDIT 540 INSTALLED BUT NOT
;	EDIT 565, CHANGE THE TWO OCCURRENCES OF THE MAKLIB INSTRUCTION
;	FROM ".REMOVE 565" TO ".REMOVE 540".
;
;NOTE ***** THIS EDIT APPLIES TO DBMS10 + DBMS20 V5A, AND TO COBOL
;		AND TO FORTRAN
;
;THE RECOMMENDED FILENAME FOR THIS EDIT IS 577.FIX.    THE LINES
;.EDIT THRU .ENDE SHOULD BE TYPED INTO THAT FILE
;
;
;	APPLY THIS EDIT TO DBSANY.REL **********
;
;
;THE EDIT CAN BE INSERTED USING THE FOLLOWING COMMANDS:
;
;FOR A COBOL-68 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.577=DBSANY.REL,577.FIX/F
;  *LIBOL.577=LIBOL.REL/M:(DBFIND,DBSET),DBSANY.577/R:(DBFIND,DBSET)
;  *LIBOL.577=LIBOL.577/INDEX
;
;  R LINK
;  *LIBSHR,LIBOL.577/SEARCH/GO
;
;  SAVE LIBO12
;
;FOR A COBOL-74 DBMS SYSTEM...
;
;  R MAKLIB
;  *DBSANY.577=DBSANY.REL,577.FIX/F
;  *C74LIB.577=C74LIB.REL/M:(DBFIND,DBSET),DBSANY.577/R:(DBFIND,DBSET)
;  *C74LIB.577=C74LIB.577/INDEX
;
;  R LINK
;  *C74SHR,C74LIB.521/SEARCH/GO
;
;  SAVE C74O12
;
;FOR FORTRAN DBMS SYSTEMS...
;
;  R MAKLIB
;  *DBSANY.577=DBSANY.REL,577.FIX/F
;  *FORLIB.577=FORLIB.REL/M:(DBFIND,DBSET),DBSANY.577/R:(DBFIND,DBSET)
;  *FORLIB.577=FORLIB.577/INDEX
;
;  R LINK
;  *FORLIB.577/INCLUDE:FOROTS,FORLIB.577/SEARCH/GO
;
;  SAVE FOROTS
;
;THE PATCHED FILES SOULD BE RENAMED TO .REL TO BE USED AS THE BASE FOR 
;	ANY FUTURE EDITS.
;
;
;**********************************************************************
;
;
.EDIT 577
.NAME JSM
.MODULE DBFIND
.REMOVE 565
.INSERT FINS6$+14,AFTER,<HRRZ 2,0(2)>
	PUSH P,R2  ;SAVE ASIDE ADDR OF RCD'S IN-CORE RCD BLOCK
		  ;  AT FIXED POINT ON STACK -- FINS6 WILL RETURN
		  ;  THIS RECORD TYPE IN THE APPROPRIATE SYSCOM 
		  ;  FIELD
.ENDI
.INSERT FINS6$+35,BEFORE,<JUMPE 1,XC.NRS>
	POP P,TMP.RB(X)  ;GIVE BACK STACK LOC, ALSO SAVE RCD'S
		;IN-CORE BLOCK ADDR FOR SYSCOM REPORTING
.ENDI
.MODULE DBSET
.REMOVE 565
.INSERT BO.TREE+10,BEFORE,<JRST BO.LEAF>
		;THE FOLLOWING TESTS ARE DONE HERE SO THAT THEY
		;WILL NOT HAVE TO BE DONE REPETITIOUSLY BELOW.
		;THEY ARE CHECKING FOR A SORTED SET FIND WITH
		;ORDER SORTED DUPLICATES FIRST/LAST/UNSPECIFIED
		;(BUT NOT "NOT") ALLOWED. FINS6 IS THE ONLY FIND
		;WHICH CALLS BO.TREE, AND THE SPECIAL CASE WHERE
		;STORE CALLS BO.TREE FOR INSERTS INTO SORTED SETS
		;IT IS NOT LEGAL TO HAVE SOME LEGITIMATE FORM OF
		;DUPLICATES IN THE SET DEFINITION.
	SETZM R0  ;INIT AC0 TO SET UP FLAGS FOR TESTS BELOW
	HRRZI R1,3  ;SET UP AC1 TO TEST IF DOING FIND. FINS6 IS
	CAMN R1,400(X)  ;  ONLY FIND USING BO.TREE
			;  NOTE: 400 = VERBID
	TRO R0,1  ;  YES -- SET "FIND" FLAG
	MOVE R1,3(MEMBLK)  ;RETRIEVE SET MEMBERSHIP DESCRIP FROM
			;  IN-CORE DB MEM BLK FOR RCD TYPE
	TRC R1,1400  ;COMPLEMENT THE BITS FOR ORDER SORTED DUP-
			;  LICATES
	TRNE R1,1700	;IS IT O. S. DUPS.?
	JRST .+4	;  NO
	TRC R1,3	;COMPLEM BITS FOR DUPS NOT ALLOWED
	TRNE R1,3	;IS IT DUPS NOT ALLOWED?
	TRO R0,2   ;  NO -- SET O.S. DUPS. FLAG
	PUSH P,R0  ;SAVE FLAGS ON STACK FOR TESTS BELOW
.ENDI
.INSERT BOL.L1+3,REPLACE:1,<JUMPE 0,BO.EX>
	CAIE R0,0  ;SUCCESSFUL KEY MATCH FROM COMITM?
	JRST .+17  ;  NO -- EITHER BYPASSED (<0) OR NOT YET (>0) ;[577]
		;CAME HERE BECAUSE WE GOT AN EXACT MATCH ON USER
		;  SUPPLIED KEY -- WANT TO CHECK FOR MATCH ON
		;  USER RECORD TYPE.
	PUSH P,0  ;GET AN AC TO WORK WITH
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT NOT "NOT")
	CAME R1,-1(P)  ; DO TEST
	JRST .+11   ;FAILED -- DOING STORE FOR NESTED SETS WITH ;[577]
			;  S.O.S. LOC. MODE OF OWNER OR OTHER
			;  O.S. FIND
	MOVEI 16,[-1,,0
		DBK.HX(X)]+1	;[565] SET UP ARG FOR LIN.BF TO FIND
	PUSHJ P,LIN.BF  ;GET TID OF CURR. REC. OF SET OCC.
	MOVE R1,15(X)  ;GET STACK POINTER SAVED ON ENTRY TO DBCS
		; (WAS CONTENTS OF P AT THAT POINT)
	MOVE R1,4(R1)  ;GET ADDR OF IN-CORE MEMB REC BLOCK -- 
			; WAS SAVED ASIDE IN PATCH AT FINS6$+14
	CAMN R0,3(R1)  ;TID OF FOUND REC = TID OF REC PASSED TO
			;  FINS6?
	JRST .+3     ; YES
	HRRZI R1,1  ;  NO -- PUT "NOT YET" FLAG IN STACK LOC
	MOVEM R1,0(P)  ;  WHICH WILL BE RESTORED TO R0
	POP P,0		;RESTORE R0 -- IN ITS CURRENT STATE
	JUMPE R0,BO.FEX+1  ;COMPLETE SUCCESS ON TID + USER KEY
				;  MATCH
.ENDI
.INSERT BOL.L1+5,AFTER,<SOJG 12,BOL.LP>
		;GOT HERE BECAUSE "NOT YET" FLAG WAS SET BY COMITM
		; AND BUOY CHAIN COUNT EXHAUSTED
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT NOT "NOT")
	CAME R1,0(P)  ;  DO TEST
	JRST .+21   ;FAILED -- DOING STORE FOR NESTED SETS WITH
			;  S.O.S. LOC. MODE OF OWNER OR OTHER
			;  O.S. FIND -- HOP BACK IN LINE
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+350  ;[V5A] CALL GET.PT TO POINT AT NEXT
	PUSHJ P,GET.PT    ;  REC IN SET OCC.
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	CAME R1,OWNDBK(X)  ;IS IT THE OWNER?
	JRST .+4	;  NO -- GO TO FIND ITS REC TYPE
	TRNN R2,2	;  YES -- ARE WE DOING DESC RANGE MATCH?
	JRST BO.FEX	;    NO -- FAILED ASCENDING RANGE MATCH
	JRST BO.OVP	;    YES -- GO TO WEND OUR WAY BACK THRU
			;       THE SET OCCURRENCE
	MOVEM R1,IDXKEY  ;  NO -- MUST BE A BUOY, CHECK IT OUT
	MOVEI AP,NEX.NO+310  ;SET UP FOR CALL TO LIN.BF TO POINT
	PUSHJ P,LIN.BF       ;  TO NEXT REC. IN SET OCC.
	MOVEM R1,RECKEY   ;MOVE BUFFER ADDR OF NEXT REC FOR SETUP
			;  ON RE-ENTERING BO.LEAF
	CAIE R0,3	;IS NEXT REC A BUOY?
	JRST XC.SOF	;  NO -- SET OCCURRENCE IS SCREWED UP
	JRST BO.LEAF	;  YES -- GO TO PROCESS BOUY
.ENDI
.INSERT BO.OVP+4,REPLACE:1,<JRST BO.EX>
		;GOT HERE IF DOING RANGE KEY AND BOUY CHAIN
		;   EXHAUSTED
	PUSH P,R1  ;GET AN AC -- ALSO SAVE ASIDE CURR DBKEY
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT "NOT")
	CAME R1,-1(P)  ; DO TEST
	JRST .+13	;  FAILED -- AS ABOVE
	POP P,IDXKEY  ;RESTORE TO AC13 -- SET UP FOR CALL TO LIN.BF
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+310
	PUSHJ P,LIN.BF  ;GET TID OF CURRENT RECORD
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	MOVE R1,15(X)  ;RETRIEVE TID OF REC TYPE PASSED TO FINS6
	MOVE R1,4(R1)  ;  AS ABOVE
	CAMN R0,3(R1)  ;ARE TIDS = ? I.E. SAME REC TYPE?
	JRST .+3	;  YES -- SUCCESS
	JRST BO.OVLAP	;  NO --RECYCLE
	POP P,R1	;BYPASS FROM JRST .+11 ABOVE -- RESTORE AC
	JRST BO.FEX+1   ;TO GIVE BACK AC FROM BO.TREE+10 ABOVE
.ENDI
.INSERT BO.FEX+1,BEFORE,<JRST BO.EX>
	POP P,R1   ;RESTORE STACK, BUT DON'T CLOBBER AC0
		   ;  AC1 WILL BE REFILLED BY MEM.FX (THE FINS6
		   ;  CALLER) OR OWN.SOS (THE STORE CALLER)
.ENDI
.INSERT NEX.NO+360,REPLACE:1,<JRST BO.EX> ;[V5A]
		;GOT HERE BECAUSE DOING RANGE KEY AND BYPASSED
		;  FLAG IS ON (AC0<0) -- MUST CONTINUE SCAN FOR
		;  RANGE MATCH
	HRRZI R1,3  ;SET UP TO TEST FIND O.S. DUPS. (BUT "NOT")
	CAME R1,0(P)  ;DO TEST
	JRST .+7	;  FAILED -- BYPASS
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	PUSHJ  P,LIN.BF	;FIND TID OF CURRENT REC -- AC16 ALREADY
			;  POINTING AT IT
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	MOVE R1,15(X)	;FIND TID OF REC TYPE PASSED TO FINS6
	MOVE R1,4(R1)
	CAMN R0,3(R1)	;TID'S = ?
	JRST BO.FEX+1   ;  YES -- SUCCESS
	JRST BO.OVLAP	;  NO -- RECYCLE TO PICK UP NEXT/PRIOR REC
.ENDI
.INSERT NEX.NO+363,REPLACE:1,<JRST BO.EX> ;[V5A]
	JRST BO.FEX+1	;TO RESTORE STACK -- GIVE BACK AC
.ENDI
.INSERT NEX.NO+371,REPLACE:3,<MOVEI AP,NEX.NO+366> ;[V5A]
		;REPLACE:3 DONE HERE TO AVOID TWO FUNCTIONAL
		;  JUMPA'S IN A ROW
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+366  ;[V5A] CALL TO FIND NEXT OF SET -- IN
	PUSHJ P,FND.NS		; ORIGINAL CODE
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	JRST BO.OVP+1	;TO TEST IF NEXT IS OWNER -- IN ORIG CODE
		;IF WE HAVE BUMPED INTO THE OWNER HERE, SEARCH 
		;  HAS FAILED
.ENDI
.INSERT NEX.NO+374,REPLACE:3,<MOVEI AP,NEX.NO+366> ;[V5A]
		;REPLACE:3 DONE HERE TO AVOID TWO FUNCTIONAL
		;  JUMPA'S IN A ROW
	PUSH P,R2  ;  SAVE ASIDE KEY DESCRIPTOR FLAGS
	MOVEI AP,NEX.NO+366  ;[V5A] CALL TO FIND PRIOR OF SET -- IN
	PUSHJ P,FND.PS		; ORIGINAL CODE
	POP P,R2  ;  RESTORE FLAGS -- DONT NEED ADDRESS OF IN-
			;  CORE SET DESCRIPTOR BLOCK
	JRST BO.OVP+1	;TO TEST IF PRIOR IS OWNER -- IN ORIG CODE
		;IF WE HAVE BUMPED INTO THE OWNER HERE, SEARCH 
		;  HAS FAILED
.ENDI
.ENDE