THE WELCH COMPANY
440 Davis Court #1602
San Francisco, CA 94111-2496
415 781 5700
rodwelch@pacbell.net


S U M M A R Y


DIARY: May 11, 2008 10:14 PM Sunday; Rod Welch

SDS Subject Index increase account segments from 100 to 1000.

1...Summary/Objective
2...Increase Subject Account Index Capacity from 100 to 1000
3...00506 Segment Subject Index Account into Multiple Files - 1000
4...03502 Automatic Subject Account Construction and Assignments
5...F1 F3 Select Subject Account from Sorted Index to Edit Actual Account
6...Sorted Subject Index Error Find Account in Actual Index for Editing
7...Subroutine Nesting Error F1 F3 Find Account Selected from Sorted Index
8...Search for Target Account in Current Index
9...F1 F3 Navigate Subject Index Step Back 1 Level
10...Subroutine Nesting Error Solution
11...Search for Description Line in the Target Account


..............
Click here to comment!

CONTACTS 

SUBJECTS
Subject Index Accounts Chained Segments Increased 1000% from 100 to

0503 -
0503 -    ..
0504 - Summary/Objective
0505 -
050501 - Follow up ref SDS 5 0000.
050502 -
050503 - Expanded capacity by 10 fold (1000%) for context management using
050504 - granular indexing of subjects for SDS records.  Also, resolved
050505 - long-standing subroutine nesting problem.  Not sure if changes are
050506 - fully tested.  So far everything seems to be working which is unusual
050507 - for complicated changes, so problems may show up going forward.
050508 -
050509 -
050510 -
050511 -
050513 -  ..
0506 -
0507 -
0508 - Problems
0509 -
050901 - The subject index has developed two (2) problems the past month...
050902 -
050903 -        1.  Nested subroutine error occurs selecting an account from a
050904 -            sorted list to open the actual account for editing, and the
050905 -            account is beyond approximately 70+ segmented files.
050906 -            ref SDS 0 7W4H
050908 -             ..
050909 -        2.  The code that segments subject accounts can only handle 100
050910 -            files; several accounts are now approaching 100 files, and
050911 -            so the process of assigning unique account numbers,
050912 -            especially with the automatic system developed on 070511,
050913 -            ref SDS 5 0001, will fail unless this capacity can be
050914 -            expanded.
050916 -  ..
050917 - Segmenting Subject Index accounts into multiple files is a form of
050918 - virtual memory.  This may not be needed if SDS can be upgraded to use
050919 - more memory, similar to Windows applications.
050920 -
050921 -
050923 -  ..
0510 -
0511 -
0512 - Progress
0513 -
051301 - Increase Subject Account Index Capacity from 100 to 1000
051302 -
051303 - On 030810 developed current method of segmenting SDS subject index
051304 - accounts up to a maximum of 99 levels. ref SDS 1 8S4Y  Millie's
051305 - medical account for "History" has now reached about 97 segements over
051306 - just the past 15 months.  We need to expand from 100 to 1000 the
051307 - number of account segments.  The format for the current design is also
051308 - listed on 030810. ref SDS 1 3S4I
051310 -  ..
051311 - We have to make three (3) major changes...
051312 -
051313 -        1.  00506 to segment indexes into more than 100 files, which
051314 -            was originally created on 030810. ref SDS 1 RG4K
051315 -
051316 -            Done........ 080511........... ref SDS 0 E148
051318 -             ..
051319 -        2.  03502 to segment indexes automatically when constructing
051320 -            new subject accounts automatically using code from 00506,
051321 -            per report on 070511. ref SDS 5 JV4N
051323 -             ..
051324 -            Done........ 080511........... ref SDS 0 YP7M
051326 -             ..
051327 -        3.  03501 standard Subject Index profile to navigate indexes
051328 -            segmented into more than 100 files.
051330 -             ..
051331 -            Some done... 080511........... ref SDS 0 224K
051332 -
051333 -
051335 -  ..
051336 - 00506  Segment Subject Index Account into Multiple Files - 1000
051337 -
051339 -  ..
051340 - Line 30, ref OF 1 VN5M, in 00506
051341 -
051342 -    loc_cur 0 2
051343 -    chrcnt 1 0
051344 -    -if @1 = 58 -goto segmnt
051345 -
051346 -        Code looks for colon to assess when to perform segment, rather
051347 -        moved data from current to the prior segment.
051348 -
051350 -  ..
051351 - Line 160, ref OF 1 KY8N, -label segmnt in 00506
051352 -
051353 -    -label segmnt
051354 -
051355 -        Debug here to test the stuff.
051356 -
051358 -  ..
051359 - Line 460, ref OF 1 9N6O, -label nSegm in 00506
051360 -
051361 -    -label nSegm
051362 -       rel_cur 0 -2
051363 -    getscr 18
051364 -      strcnt 131 2
051365 -    strcnt 131 3
051366 -
051367 -        Changed command from rel_cur 0 -2 to restore initial position
051368 -        to getscr 18, which is more generic and flexible.  Changed
051369 -        strcnt 131 2 to strcnt 131 3 to read a 3 place number,  If
051370 -        there is only a two place number it will also read that.
051371 -
051373 -  ..
051374 - Line 660, ref OF 1 657G, -label lpdt in 00506 about 70 lines below
051375 -
051376 -    ic 46
051377 -
051378 -        Add a dot after restoring the account level number at the
051379 -        bottom of the index file, and in case we are going from a 3
051380 -        place number 100, back to a 2 place number 99.
051381 -
051383 -  ..
051384 - Line 680, ref OF 1 1V8L, -label lpdt in 00506 about 80 lines below
051385 -
051386 -    ic 46
051387 -
051388 -        Add a dot after restoring the account level number at the top
051389 -        of the index file, and in case we are going from a 3 place
051390 -        number 100, back to a 2 place number 99.
051392 -  ..
051393 - Line 700, ref OF 1 UZ4K, -label lpdt in 00506 about 100 lines below
051394 -
051395 -    setcnt 120 938
051396 -    setcnt 121 1
051397 -    @c:\sd\03\03501 #2
051398 -
051399 -        Set flags and call subject index process in 03501 that switches
051400 -        to another index level.
051402 -  ..
051403 - Line 730, ref OF 1 OF4H, -label lpdt in 00506 about 140 lines below
051404 -
051405 -      fr /$$/
051406 -      rel_cur 0 2
051407 -    fr /./
051408 -    rel_cur 0 -1
051409 -
051410 -        Changed the code from finding the end of the segment level
051411 -        number by looking for the first dot, and then backing up and
051412 -        appending $ to establish the end of the segement.
051413 -
051415 -  ..
051416 - Make similar changes to 03502....
051417 -
051419 -  ..
051420 - 03502 Automatic Subject Account Construction and Assignments
051421 -
051422 - Follow up ref SDS 5 0001
051423 -
051424 - On 070511 a new macro file was created starting with all of the code
051425 - in 03501 in order to open subject index files, find accounts,
051426 - construct new accounts, and extract accounts, including descriptions
051427 - from the Subject Index.  All of the code was deleted that is not
051428 - needed for automatic processing, and then adding code to perform
051429 - automatic processing.  This design was adopted because macro file
051430 - 03501 became too big for adding another major feature. ref SDS 5 MG4O
051431 -
051433 -  ..
051434 - Line 1850, ref OF 3 T46I, -label topoF in 03502 about 50 lines below
051435 -
051436 -     fr /$$/
051437 -     savescr 18
051438 -     rel_cur 0 2
051439 -     chrcnt 1 0
051440 -       -if @1 != 36 -goto siccns
051441 -     -if @1 = 36 -goto nSegm
051442 -     rel_cur 0 1
051443 -     chrcnt 1 0
051444 -     -if @1 != 36 -goto nSegm
051445 -     -goto siccns
051446 -     -label nSegm
051447 -     getscr 18
051448 -       rel_cur 0 -2
051450 -         ..
051451 -        Had to change this code developed on 070511, ref SDS 5 6G6K, to
051452 -        the same new scheme developed today for macro file 00506, and
051453 -        used the same labels, per above. ref SDS 0 E148
051454 -
051456 -  ..
051457 - Make similar changes to 03501....
051459 -  ..
051460 - Line 2340, ref OF 2 AZ5G, -label sbpsifa in 03501 about 40 lines below
051461 -
051462 -    fr /$$$/
051463 -    -if @0 > 0 -goto pnatc
051464 -      strcnt 1 2
051465 -    strcnt 1 3
051466 -    -if @1 = 1 -goto pnatc
051467 -    subcnt 1 1
051468 -    -if @1 < 10 ic 48
051469 -    inscnt 1 0
051470 -    ic 32
051471 -
051472 -        Change strcnt 1 2 to 1 3 in order to increase number of levels
051473 -        from 100 to 1000.  ic 32 shears off the 3 number position when
051474 -        changing from 100 to 99.
051475 -
051476 -
051478 -  ..
051479 - Line 1900, ref OF 2 H55L, -label prior in 03501 about 50 lines below
051480 -
051481 -    -label prior
051483 -  ..
051484 - Line 2000, ref OF 2 X65G, -label srtd66 in 03501
051485 -
051486 -    -label srtd66
051487 -
051488 -        Debug testing here.
051489 -
051490 -
051491 -
0515 -

SUBJECTS
Sorted Subject Index F1 F3 Failure Select Account to Edit Actual Acc

1003 -
100401 -  ..
100402 - F1 F3 Select Subject Account from Sorted Index to Edit Actual Account
100403 - Sorted Subject Index Error Find Account in Actual Index for Editing
100404 - Subroutine Nesting Error F1 F3 Find Account Selected from Sorted Index
100405 -
100406 - Follow up ref SDS 3 S56F, ref SDS 2 YB5N.
100407 -
100408 - We have been getting a subroutine nesting error for many years when
100409 - using F1 F3.  This problem has mostly been random in that most of the
100410 - time the routine works correctly stepping back from a lower to a
100411 - higher level.  As a result, investing time to find and correct the
100412 - problem seemed unnecessary.
100414 -  ..
100415 - Navigating the Subject Index is explained on 061101. ref SDS 4 GJ5J
100416 - and lists specific functions. ref SDS 4 QE8J  The F1 F3 function that
100417 - finds the target in the actual index for a sorted index is explained
100418 - in the record on 030902. ref SDS 2 XD6L
100420 -  ..
100421 - F1 F3 was enhanced on 050219. ref SDS 3 S56F
100423 -  ..
100424 - The past few weeks, F1 F3 has begun to fail consistently when called
100425 - from a sorted index to open the account for editing in the actual
100426 - index file.  F1 F3 is really only an assignment of convenience, since
100427 - it uses the code for F1 F2 to step forward through a set of segmented
100428 - index files looking for the account selected from the sorted list.
100429 - Since F1 F2 is already used to open a lower level of the account
100430 - listed in the sorted list, F1 F3 makes sense for closing the sorted
100431 - list, finding, opening, and setting up the subject index file segment
100432 - so the user can work on the account.
100434 -  ..
100435 - The fact that the code worked correctly for several years, and only
100436 - fails on lists of sorted subjects for accounts with 70 or so segmented
100437 - files suggests something has a limit that is now being exceeded.
100439 -  ..
100440 - Was lucky today discovering fairly quickly that the code was cycling
100441 - through a subroutine multiple times, but without a return command for
100442 - each account segment file opened. ref SDS 0 7X6J  The file that
100443 - explains Medit commands says -gosub commands support only 10 levels.
100444 - ref OF 6 ZZ5F  This presents another mystery, since the code does not
100445 - seem to be failing until well above 50 cycles.
100447 -  ..
100448 - In any case, the following code changes seem to correct the problem,
100449 - and also apply revisions today increasing the number of files from 100
100450 - to 1000 for segmenting subject accounts, per above. ref SDS 0 NF5I
100452 -  ..
100453 - The solution was to avoid the subroutine for the required process by
100454 - configuring a direct loop that continues until the target is located.
100456 -  ..
100457 - Making this correction found a number of ways to consolidate the code
100458 - for this particular operation.  Initially, made a mistake of not
100459 - including the second process, ref SDS 0 756J, finding the description
100460 - line for the target account selected from the sorted list. ref SDS 0
100461 - T67I
100462 -
100463 -
100465 -  ..
100466 - Search for Target Account in Current Index
100467 -
100468 - Line 1040, ref OF 2 DC4F -label fpaclar in 03501 about 40 lines below
100469 -
100470 -    *%09f
100471 -    z 4
100472 -    **
100473 -    l ^
100474 -    -if @0 > 0 -goto nffp...................... ref SDS 0 3O6N
100475 -    -if @123 = 666 -goto slf1f3................ ref SDS 0 T67I
100476 -
100477 -        After a segmented index file is opened, per below, ref SDS 0
100478 -        T65I, This is the code that searches for the account string,
100479 -        and if not found, it cycles to open the next segmened index
100480 -        file to keep looking until it is found.  If the account is
100481 -        found, then it branches to look for the account description
100482 -        line, as explained in the original work on 030902. ref SDS 2
100483 -        XD6L
100485 -  ..
100486 - Line 1400, ref OF 2 KG7O, -label nffp in 03501
100487 -
100488 -    -label nffp
100489 -    setcnt 164 213
100490 -    setgbl 164 213
100491 -    top
100492 -    setcnt 0 0
100493 -    up 10
100494 -    z 1 80
100495 -    l- /. Master Index /
100496 -    -if @0 = 0 -goto msiop
100497 -    setcnt 0 0
100498 -    up 10
100499 -    l- /$$/
100500 -    -if @0 > 0 -goto npsics
100501 -    e c:\sd\03\03501
100502 -    line                                                       && *%5
100503 -    loc_cur 4 1
100504 -    setcnt 0 0
100505 -    fr /$$$/
100506 -    -if @0 = 0 -goto cispf6
100507 -
100508 -        This is the main code loop that opens index files, and is
100509 -        called for this process each time the search fails to find the
100510 -        either the target account and the description.
100511 -
100512 -
100514 -  ..
100515 - F1 F3 Navigate Subject Index Step Back 1 Level
100516 -
100517 -
100518 - Line 1900, ref OF 2 OF4I, -label prior in 03501
100519 -
100520 -    -label prior
100521 -    -if @123 = 666 -goto srtd66.............. ref SDS 0 T56I
100522 -
100523 -        This starts F1 F3 and -if @123 = 666 -goto strd66 branches
100524 -        processing for a sorted list.
100525 -
100526 -
100528 -  ..
100529 - Line 2010, ref OF 2 PU5K, -label srtd66 in 03501
100530 -
100531 -    -label srtd66
100532 -    setgbl 123 666
100533 -    setcnt 115 1000
100534 -    setgbl 115 1000
100535 -    of 0
100536 -    loc_cur 0 1
100537 -    fr /.. /
100538 -    setcur 0 0
100539 -    of @0
100540 -    setgbl 97 @0
100541 -    setcnt 86 1
100542 -    macro 1182
100543 -    e c:\sd\03\03501
100544 -    line                                                       && *%66
100546 -         ..
100547 -        Debug trying here
100549 -         ..
100550 -        Set up flags for F1 F3 in sorted index.
100552 -         ..
100553 -        There are two (2) search steps in this operation.
100554 -
100555 -        1.  Find the account selected by the user, which is normally
100556 -            all that is needed for F1 F3 navigating through the organic
100557 -            structure of context. ref SDS 0 3P6I
100558 -
100559 -        2.  Sorted lists are used to find specific language describing
100560 -            context among multiple views, and so F1 F3 does a second
100561 -            locate command to find the narrative description for the
100562 -            target account which was selected by the user when F1 F3
100563 -            was called. ref SDS 0 T67I
100564 -
100566 -  ..
100567 - Line 2320, ref OF 2 9Y3F, -label sbpsifa in 03501
100568 -
100569 -    -label sbpsifa
100570 -    line                                                       && *%5
100571 -    loc_cur 4 1
100572 -    getgbl 123 123
100573 -    -if @123 = 666 -goto slrtusl.................. ref SDS 0 7W5N
100574 -
100575 -        F1 F3 is used to find an account in the index from a sorted; so
100576 -        the code starts at the top of the current account and looks
100577 -        through all of the segment files, using the code for F1 F2.
100578 -        So, even the the command is executed with F1 F3, it actually
100579 -        processes F1 F2.
100580 -
100582 -  ..
100583 - Line 2460, ref OF 2 SN8L, -label slrtusl in 03501
100584 -
100585 -    -label slrtusl
100586 -    getgbl 124 124
100587 -    -if @124 = 666 -goto egcar$
100588 -    z 10 90
100589 -     ..
100590 -    -label lp$s
100591 -    errorcnt 0 0
100592 -    fr /$$$/
100593 -    -if @0 > 0 -goto egcar$................... ref SDS 0 7X5J
100594 -    immed d
100595 -    loc_cur 4 1
100596 -    line                                                       && *f%2
100597 -    down 3
100598 -    immed r
100599 -    line                                                       && *%5
100600 -    -goto lp$s............................... ref SDS 0 7W6K
100601 -
100602 -        Code checks to see if the current index is a segmented file
100603 -        based on finding $$$ in the filename; and, if so,then the line
100604 -        is deleted so the code can open the primary level for the
100605 -        account, which automatically scrolls up to replace the deleted
100606 -        line in the stack; after adding a blank filler line to adjust
100607 -        the bottom of the stack so that all of the code structure
100608 -        remains constant, processing cycles back to look for another
100609 -        instance of a segmented filename; since the line has been
100610 -        deleted, this locate command fails, which allows processing to
100611 -        open the index file for the primary account, and the code then
100612 -        runs a subroutine that steps through opening each of the
100613 -        segmented files until the target account is located, which must
100614 -        be there because it was in the sorted list.
100615 -
100617 -  ..
100618 - Line 2500, ref OF 2 F34M, -label egcar$ in 03501
100619 -
100620 -    -label egcar$
100621 -    setcnt 0 0
100622 -    loc_cur 0 1
100623 -    ic 71
100624 -    setgbl 123 0
100625 -    setgbl 124 0
100626 -    -goto bH_PrIor
100627 -
100628 -        This code sets up to open the primary account to begin
100629 -        searching for the target account selected from the sorted list.
100630 -        Should global 124 that identifies sorted list be reset, or
100631 -        retained to avoid nesting error?
100632 -
100634 -  ..
100635 - Line 3150, ref OF 2 4I6K, -label bH_dFlt in 03501 about 60 lines below
100636 -
100637 -    *f%2
100638 -    **
100639 -    **
100640 -    getgbl 123 123
100641 -    -if @123 = 666 -if @18 = 7777 -goto slfx3f.... ref SDS 0 T67I
100642 -    -if @123 = 666 -goto fpaclar................ ref SDS 0 3P6I
100643 -
100644 -        The code has opened the segmented index file, and is ready to
100645 -        search for the target account.
100646 -
100647 -
100648 -
100650 -  ..
100651 - Subroutine Nesting Error Solution
100652 -
100653 - Line 3740, ref OF 2 D16F, -label bH_mrk in 03501
100654 -
100655 -     -label bH_mrk
100656 -     -if @115 = 1000 top
100657 -     -if @104 = 6949 -return
100658 -     -gosub fpaclar
100659 -
100660 -        Here is where the code searches for the target line, and if
100661 -        not found, it keeps opening segmented files until it is found.
100663 -         ..
100664 -        This is creating a nesting error, because the code is cycling
100665 -        through to call the subroutine over and over, without exiting
100666 -        from the subroutine.
100668 -         ..
100669 -        Actually, this code is completely bypassed with the new scheme
100670 -        today that corrects the nesting error.
100671 -
100672 -
100674 -  ..
100675 - Search for Description Line in the Target Account
100676 -
100677 - Line 3800, ref OF 2 5L6J -label slf1f3 in 03501
100678 -
100679 -    -label slf1f3
100680 -    errorcnt 0 0
100681 -    *%66
100682 -    z 40 123
100683 -    l !
100684 -    -if @0 = 0 -goto fndit7
100685 -    setcnt 123 666
100686 -    -goto nffp................................. ref SDS 0 3O6N
100687 -
100688 -        This is the second search after first finding the target
100689 -        account, per above, ref SDS 0 3P6I, the code looks for the
100690 -        description line selected with F1 F3 in a sorted list in the
100691 -        target account.
100693 -         ..
100694 -        Changes today consolidated a number of steps, or actually
100695 -        eliminated a number that are needed to accomplish routine
100696 -        operations, but not needed for the current task using F1 F3 in
100697 -        a sorted index.  Initially, I overlooked this second step,
100698 -        because the full process was not clear.
100699 -
100700 -
100701 -
100702 -
100703 -
100704 -
100705 -
100706 -
100707 -
100708 -
100709 -
1008 -