home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR36 / C7101.ZIP / LIST.TPX < prev    next >
Text File  |  1994-01-12  |  25KB  |  531 lines

  1. #!┌───────────────────────────┤Template Segment├───────────┬─────────────────┐
  2. #!│                                List.TPX                │Version: 3007.000│
  3. #!├───────────────────────────────┤Contents├───────────────┴─────────────────┤
  4. #!│Structure             Type       Description                              │
  5. #!│────────────────────  ─────────  ─────────────────────────────────────────│
  6. #!│List                  PROCEDURE  Scroll records from a file from a memory │
  7. #!│                                 queue                                    │
  8. #!│ShowFileProgress      GROUP                                               │
  9. #!│ListErrorCheck        GROUP                                               │
  10. #!│BuildListIndex        GROUP                                               │
  11. #!├───────────────────────────────┤Comments├─────────────────────────────────┤
  12. #!│Version   Comments                                                        │
  13. #!│────────  ────────────────────────────────────────────────────────────────│
  14. #!│3007.000  Release of CDD3 version 3007 templates                          │
  15. #!└──────────────────────────────────────────────────────────────────────────┘
  16. #!
  17. #PROCEDURE(List,'Scroll all selected records from a file'),SCREEN,PULLDOWN
  18. #!
  19. #!┌──────────────────────────┤Procedure Template├──────────┬─────────────────┐
  20. #!│                                  List                  │Version: 3007.000│
  21. #!├──────────────────────────────┤Description├─────────────┴─────────────────┤
  22. #!│  The List template loads the entire set of selected records into         │
  23. #!│  a memory queue for displaying with a list box structure.                │
  24. #!│                                                                          │
  25. #!│  Since the entire queue is filled at load time, this template should     │
  26. #!│  not be used with very large files as they may overflow the primary      │
  27. #!│  virtual memory area and spill over to disk.  The result would be        │
  28. #!│  a listbox which works very slow and accesses the hard disk drive when   │
  29. #!│  scrolling.                                                              │
  30. #!│                                                                          │
  31. #!│  A checkbox is available to view a file in Record order. This is         │
  32. #!│  primarily useful in viewing ASCII, DOS, or BASIC files.                 │
  33. #!│  (The View template may also be used.)                                   │
  34. #!│                                                                          │
  35. #!│  If the Record Order checkbox is on, any reference to the                │
  36. #!│  PrimaryKey is ignored.  Deletes, and Updates may not be allowed         │
  37. #!│  with certain non-keyed data file types.                                 │
  38. #!│                                                                          │
  39. #!│  Also, a checkbox is available to display the queue in reverse           │
  40. #!│  order.  If both the Record Order checkbox, and the Reverse Order        │
  41. #!│  checkbox are on then the file will be displayed in Reverse record       │
  42. #!│  order.  If Just the Reverse Order checkbox is on, the file              │
  43. #!│  will be displayed in Reverse key order.                                 │
  44. #!│                                                                          │
  45. #!│  Use with an Update Procedure:                                           │
  46. #!│                                                                          │
  47. #!│  Since a Form template allows the multiple add ability, and              │
  48. #!│  since a List procedure may be used on a network, a checkbox             │
  49. #!│  has been added to control the rebuilding of the queue upon              │
  50. #!│  return from the Update Procedure.  When checked, the queue              │
  51. #!│  will always be rebuilt to accomodate any updates made by other          │
  52. #!│  network file users, or multiple record adds by another procedure.       │
  53. #!├───────────────────────────────┤Comments├─────────────────────────────────┤
  54. #!│Version   Comments                                                        │
  55. #!│────────  ────────────────────────────────────────────────────────────────│
  56. #!│3007.000  Release of CDD3 version 3007 templates                          │
  57. #!└──────────────────────────────────────────────────────────────────────────┘
  58. #!
  59. #PROMPT('Range &Limit Field',COMPONENT),%KeyRangeField
  60. #PROMPT('Range &Value Field',FIELD),%RangeValue
  61. #PROMPT('Record Filter',@S180),%RecordFilter
  62. #PROMPT('Upd&ate Procedure',PROCEDURE),%UpdateProc
  63. #PROMPT('Enable Hot Records',CHECK),%HotBar
  64. #PROMPT('&Queue Rebuild',CHECK),%QueueRebuild
  65. #PROMPT('Record Order',CHECK),%RecordOrder
  66. #PROMPT('Reverse Order',CHECK),%ReverseOrder
  67. #PROMPT('Progress &Indicator',CHECK),%ShowProg
  68. #PROMPT('Progress &Character',@S8),%ProgChar
  69. #PROTOTYPE('')
  70. #INSERT(%StandardHeader)
  71. #INSERT(%SetBrowseSymbols)
  72. #INSERT(%ListErrorCheck)
  73.  
  74. %Procedure       PROCEDURE
  75.  
  76. Queue            QUEUE                           !Listbox Queue contains
  77. FilePointer      Ulong
  78. #FIX(%File,%Primary)
  79. #FIX(%Key,%PrimaryKey)
  80. #SET(%FirstField, %Null)
  81. #FOR(%KeyField)
  82. QUE::%KeyField    LIKE(%KeyField)              #<! And Key element(s) for sort
  83.   #IF(%FirstField = %Null)
  84.     #SET(%FirstField, %KeyField)
  85.     #SET(%FirstFieldSequence, %KeyFieldSequence)
  86.   #ENDIF
  87.   #IF(%RecordOrder = %Null)
  88.     #IF(%KeyFieldSequence <> 'DESCENDING' AND %ReverseOrder = %Null)
  89.       #SET(%SortString, (CLIP(LEFT(%SortString)) & ',+QUE::' & %KeyField))
  90.     #ELSE
  91.       #SET(%SortString, (CLIP(LEFT(%SortString)) & ',-QUE::' & %KeyField))
  92.     #ENDIF
  93.   #ENDIF
  94. #ENDFOR
  95. #IF((%RecordOrder AND %ReverseOrder))
  96.   #SET(%SortString,(','& %FixRows+1))
  97. #ENDIF
  98. #FIX(%ScreenField,'?LIST')
  99. Line             STRING(%ScreenFieldQueueSize) #<! Line to be scrolled
  100.                  .
  101. #INSERT(%SetupKeyRangeFields)
  102. ButtonIsDisabled BYTE                            !Flag to allow button enable
  103. #INSERT(%FileControl)
  104. InitialLoad      BYTE(1)
  105. %LocalData
  106. %ScreenStructure
  107. %PulldownStructure
  108. #EMBED('Data Section')
  109.  
  110. PreUpdateCount   ULONG                           !Records in file count.
  111. FirstPage        BYTE                            !First page flag
  112. #IF(%ShowProg)
  113. VEW::Length      BYTE                            ! Progress variable
  114. VEW::ProgString  STRING('<176>{80}')             ! Progress display variable
  115. #ENDIF
  116.  
  117.   CODE
  118.   #EMBED('Setup Procedure')
  119.   #INSERT(%FileControl)
  120.   OPEN(Screen)                                   !Open the screen
  121.   #EMBED('Setup Screen')
  122.   DISPLAY                                        !Display screen fields
  123.   #IF(%Pulldown)                                #!If a Pulldown exists
  124.   OPEN(%Pulldown)                              #<!Open the Pulldown
  125.   #EMBED('Setup Pulldown')
  126.   #ENDIF
  127.   #INSERT(%BuildListIndex)
  128.  
  129.   IF ?LIST = %FirstEntryField                  #<!If no entry for ranges
  130.     DO FillQueue                                 ! Fill the QUEUE
  131.     IF RECORDS(Queue) = %FixRows               #<! If no QUEUE records
  132.   #IF(%InsertExists)
  133.       SELECT(?Insert)                            !  Select the Insert button
  134.   #ELSIF(%UpdateProc)
  135.       #INSERT(%RestoreRangeFields)
  136.       SETKEYCODE(InsKey)                         ! Set action to Insert
  137.       Do UpdateProcedure                         ! Call the update procedure
  138.       DO FillQueue                               !  Fill the QUEUE
  139.       IF RECORDS(Queue) = %FixRows             #<!  If still no records
  140.         DO ProcedureReturn
  141.       END                                        !  End IF
  142.   #ELSE
  143.       DO ProcedureReturn
  144.   #ENDIF
  145.     END                                          !  End IF
  146.   END                                            !End IF
  147.   #IF(%HotBar)
  148.     #SET(%FirstRecordRow,(%FixRows+1))
  149.   GET(Queue,%FirstRecordRow)
  150.   GET(%Primary,FilePointer)
  151.   DISPLAY()
  152.   #ENDIF
  153.   LOOP                                           !Screen handling loop
  154.   #FOR(%Formula)
  155.     #IF(UPPER(%FormulaClass) <> 'LIST')
  156.       #IF(UPPER(%FormulaClass) <> 'FILTER')
  157.     #INSERT(%GenerateFormula)
  158.       #ENDIF
  159.     #ENDIF
  160.   #ENDFOR
  161.     #EMBED('End of General Formulas')
  162.     CASE SELECTED()                              !Jump to field setup routine
  163.       #INSERT(%ScreenSetupRoutines)
  164.     END                                          !End CASE
  165.     ACCEPT                                       !Enable the keyboard
  166.     CASE KEYCODE()                               !Jump to hotkey procedures
  167.     #FOR(%HotKey)
  168.     OF %HotKey                                   !User defined HotKey
  169.       %HotKeyProc                                !HotKey Procedure
  170.     #ENDFOR
  171.     #FIX(%ScreenField,'?Exit')
  172.     #IF(%ScreenField)
  173.     OF EscKey
  174.       IF FIELD() <> ?Exit
  175.         SELECT(?Exit)
  176.         PRESS(EnterKey)
  177.         CYCLE
  178.       END
  179.     #ENDIF
  180.     END                                          !End CASE
  181.     IF REFER() AND SELECTED() = ?List |          !If list field is selected
  182.        AND FIELD() < ?List                       ! From a prior changed field
  183.       DO FillQueue                               !  Fill the QUEUE
  184.     END                                          !End IF
  185.     CASE FIELD()                                 !Jump to edit routine
  186.   #FOR(%ScreenField)
  187.     #IF(%ScreenField = '?Insert')
  188.       #IF(%UpdateProc)
  189.     OF ?Insert                                   !Process the Insert Button
  190.         #IF(%ScreenFieldEdit)
  191.       %ScreenFieldEdit                         #<! Insert button Edit Routine
  192.         #ENDIF
  193.       GET(%Primary,0)                          #<! Dereference current record
  194.       #INSERT(%ClearFileFields)
  195.       #INSERT(%RestoreRangeFields)
  196.       PreUpdateCount = Records(%Primary)       #<! Save a record count
  197.       SETKEYCODE(InsKey)                         ! Set action to Insert
  198.       Do UpdateProcedure                         ! Call the update procedure
  199.         #IF(%QueueRebuild)
  200.       Do FillQueue                               ! Fill the QUEUE
  201.         #ELSE
  202.       CASE RECORDS(%Primary)                   #<! Check the record count
  203.       OF PreUpdateCount                          !  If no change
  204.         SELECT(?List)                            !   Reselect the list box
  205.       OF PreUpdateCount + 1                      !  If 1 record added
  206.           #FIX(%ScreenField,'?List')
  207.         Line = %ScreenFieldExpression          #<!   Fill the QUEUE line
  208.         FilePointer = POINTER(%Primary)        #<!   Save the file pointer
  209.         #INSERT(%FillKeyValues)
  210.         ADD(Queue %SortString)                 #<!   Add the record sorted
  211.       ELSE                                       !  Otherwise
  212.         Do FillQueue                             !   Rebuild the QUEUE
  213.       END                                        !  End CASE
  214.         #ENDIF
  215.       SELECT(?List)                              ! Reselect the List field
  216.       #ENDIF
  217.     #ENDIF
  218.     #IF(%ScreenField = '?Change')
  219.       #IF(%UpdateProc)
  220.     OF ?Change                                   !Process the Change Button
  221.         #IF(%ScreenFieldEdit)
  222.       %ScreenFieldEdit                         #<! Change button Edit Routine
  223.         #ENDIF
  224.       GET(Queue,CHOICE(?List))                   !Get the QUEUE element
  225.       GET(%Primary,FilePointer)                #<!Get the record
  226.       SETKEYCODE(EnterKey)                       ! Set action to Change
  227.       Do UpdateProcedure                         ! Call the update procedure
  228.         #IF(%QueueRebuild)
  229.       Do FillQueue                               !  Fill the QUEUE
  230.         #ENDIF
  231.         #IF(%HotBar)
  232.       GET(Queue,CHOICE(?List))                   !Get the QUEUE element
  233.       GET(%Primary,FilePointer)                #<!Get the record
  234.         #ENDIF
  235.       SELECT(?List)                              ! Reselect the List field
  236.       #ENDIF
  237.     #ENDIF
  238.     #IF(%ScreenField = '?Delete')
  239.       #IF(%UpdateProc)
  240.     OF ?Delete                                   !Process the Delete Button
  241.         #IF(%ScreenFieldEdit)
  242.       %ScreenFieldEdit                         #<! Delete button Edit Routine
  243.         #ENDIF
  244.       GET(Queue,CHOICE(?List))                   ! Get the QUEUE element
  245.       GET(%Primary,FilePointer)                #<! Get the record
  246.       SETKEYCODE(DelKey)                         ! Set action to Delete
  247.       Do UpdateProcedure                         ! Call the update procedure
  248.         #IF(%QueueRebuild)
  249.       Do FillQueue                               !  Fill the QUEUE
  250.         #ENDIF
  251.         #IF(%HotBar)
  252.       GET(Queue,CHOICE(?List))                   ! Get the QUEUE element
  253.       GET(%Primary,FilePointer)                #<! Get the record
  254.         #ENDIF
  255.       SELECT(?List)                              ! Reselect the List field
  256.       #ENDIF
  257.     #ENDIF
  258.     #IF(%ScreenField = '?List')
  259.     OF ?List                                     !Process the list field
  260.       #IF(%HotBar)
  261.       GET(Queue,CHOICE(?List))                   !  Get the QUEUE element
  262.       GET(%Primary,FilePointer)                #<!  Get the record
  263.       #ENDIF
  264.       #IF(%ScreenFieldEdit)
  265.       %ScreenFieldEdit                         #<! Exit button Edit Routine
  266.       #ENDIF
  267.       #IF(%HotBar)
  268.       DISPLAY()                                #<!  Display the hot fields
  269.       #ENDIF
  270.       #IF(%UpdateProc)
  271.       CASE KEYCODE()                             ! Jump to keycode routine
  272.         #IF(%NoButtonsExist OR %InsertExists)
  273.       OF InsKey                                  ! For the insert key
  274.         GET(%Primary,0)                        #<!  Dereference current record
  275.         #INSERT(%ClearFileFields)
  276.         #INSERT(%RestoreRangeFields)
  277.         PreUpdateCount = Records(%Primary)       #<! Save a record count
  278.         Do UpdateProcedure                         ! Call the update procedure
  279.           #IF(%QueueRebuild)
  280.         Do FillQueue                               ! Fill the QUEUE
  281.           #ELSE
  282.         CASE RECORDS(%Primary)                   #<! Check the record count
  283.         OF PreUpdateCount                          !  If no change
  284.           SELECT(?List)                            !   Reselect the list box
  285.         OF PreUpdateCount + 1                      !  If 1 record added
  286.             #FIX(%ScreenField,'?List')
  287.           Line = %ScreenFieldExpression          #<!   Fill the QUEUE line
  288.           FilePointer = POINTER(%Primary)        #<!   Save the file pointer
  289.           #INSERT(%FillKeyValues)
  290.           ADD(Queue %SortString)                 #<!   Add the record sorted
  291.         ELSE                                       !  Otherwise
  292.           Do FillQueue                             !   Rebuild the QUEUE
  293.         END                                        !  End CASE
  294.           #ENDIF
  295.         SELECT(?List)                              ! Reselect the List field
  296.         #ENDIF
  297.         #IF(%NoButtonsExist OR %DeleteExists)
  298.       OF DelKey                                  ! For the delete key
  299.         PreUpdateCount = Records(%Primary)       !  Save a record count
  300.         GET(Queue,CHOICE(?List))                 !  Get the QUEUE element
  301.         GET(%Primary,FilePointer)              #<!  Get the record
  302.         Do UpdateProcedure                       ! Call the update procedure
  303.           #IF(%QueueRebuild)
  304.         Do FillQueue                             !  Fill the QUEUE
  305.           #ELSE
  306.         IF RECORDS(%Primary) = PreUpdateCount -1 #<! If the record was deleted
  307.           DELETE(Queue)                          !  Delete the Queue entry
  308.         END                                      ! End IF
  309.           #ENDIF
  310.         #ENDIF
  311.         #IF(%HotBar)
  312.         GET(Queue,CHOICE(?List))                 ! Get the QUEUE element
  313.         GET(%Primary,FilePointer)              #<! Get the record
  314.         #ENDIF
  315.         #IF(%NoButtonsExist OR %ChangeExists )
  316.       OF EnterKey                                ! Or the enter key
  317.       OROF MouseLeft2                            ! Or a double mouse click
  318.         GET(Queue,CHOICE(?List))                 !  Get the QUEUE element
  319.         GET(%Primary,FilePointer)              #<!  Get the record
  320.         Do UpdateProcedure                       ! Call the update procedure
  321.           #IF(%QueueRebuild)
  322.         Do FillQueue                             !  Fill the QUEUE
  323.           #ENDIF
  324.         #ENDIF
  325.         #IF(%HotBar)
  326.         GET(Queue,CHOICE(?List))                 ! Get the QUEUE element
  327.         GET(%Primary,FilePointer)              #<! Get the record
  328.         #ENDIF
  329.       END                                        ! End CASE keycode
  330.       #ENDIF
  331.     #ELSIF(%ScreenField = '?Exit')
  332.     OF ?Exit                                     !Process the Exit button
  333.       #IF(%ScreenFieldEdit)
  334.       %ScreenFieldEdit                         #<! Exit button Edit Routine
  335.       #ENDIF
  336.       DO ProcedureReturn
  337.     #ELSE
  338.     #INSERT(%ScreenEditRoutines)
  339.     #ENDIF
  340.   #ENDFOR
  341.     #INSERT(%PulldownEditRoutines)
  342.     END                                          !End CASE FIELD()
  343.     DISPLAY
  344.   END                                            !End LOOP
  345.   DO ProcedureReturn
  346.  
  347. FillQueue Routine
  348.  
  349.   #EMBED('Start of Fill Queue Routine')
  350.   FREE(Queue)                                  #<!Clear the QUEUE
  351.   Firstpage = 1                                  !Set the FirstPage flag
  352.   #IF(%ShowProg)                                #!If showing the progress
  353.   VEW::Length = 1                                !Set the status bar counter
  354.   #ENDIF
  355.   #FIX(%ScreenField,'?List')
  356.   #FOR(%ScreenFieldFix)
  357.   Line = %ScreenFieldFix                       #<!Add list box fields
  358.     #IF(%RecordOrder = %Null)
  359.       #IF(%FirstFieldSequence <> 'DESCENDING' AND %ReverseOrder = %Null)
  360.   CLEAR(QUE::%FirstField)                      #<!Clear the key field
  361.       #ELSE
  362.   CLEAR(QUE::%FirstField,1)                    #<!Clear the key field
  363.       #ENDIF
  364.     #ENDIF
  365.   ADD(Queue)                                     !Add the fixed line
  366.   DISPLAY(?List)                               #<!Blank the listbox
  367.   #ENDFOR
  368.   #IF(%RecordOrder)
  369.   SET(%Primary)                                #<!Set to file order
  370.   #ELSIF(%KeyRangeField)
  371.     #IF(%ReverseOrder)
  372.   #INSERT(%ClearRecordHigh)
  373.     #ELSE
  374.   #INSERT(%ClearRecordLow)
  375.     #ENDIF
  376.   %KeyRangeField = %RangeValue                 #<!Fill range field
  377.   SET(%PrimaryKey,%PrimaryKey)                 #<!Set to keyed order
  378.   #ELSE
  379.   SET(%PrimaryKey)                             #<!Set to keyed order
  380.   #ENDIF
  381.   #IF(%ShowProg)                                #!If showing the progress
  382.   VEW::ProgString = ALL(%ProgChar)             #<!Fill the progress string
  383.   #ENDIF
  384.   LOOP                                           !Get all selected records
  385.   #IF(%RecordOrder)
  386.     NEXT(%Primary)                             #<! Get the next record.
  387.   #ELSIF(%ReverseOrder)
  388.     PREVIOUS(%Primary)                         #<! Get the previous record
  389.   #ELSE
  390.     NEXT(%Primary)                             #<! Get the next record.
  391.   #ENDIF
  392.     IF ERRORCODE() THEN BREAK.                   ! Quit if an error occurs
  393.   #FIX(%File,%Primary)
  394.   #FIX(%Key,%PrimaryKey)
  395.   #IF(%KeyRangeField)                           #!If using a Range
  396.     #IF(%KeyNoCase)                             #!  Key is not case sensitive
  397.     IF (UPPER(%KeyRangeField) <> UPPER(%RangeValue)) #<! If not in Range
  398.     #ELSE
  399.     IF (%KeyRangeField <> %RangeValue)         #<! If not in Range
  400.     #ENDIF
  401.       BREAK                                    #<!  Break out of the Loop
  402.     END                                          ! End IF
  403.   #ENDIF
  404.   #IF(%RecordFilter)
  405.     IF ~(%RecordFilter)                        #<! If Filter condition not met
  406.       CYCLE                                      !  Try another record
  407.     END                                          ! End IF
  408.   #ELSE
  409.     #FOR(%Formula)
  410.       #IF(UPPER(%FormulaClass) = 'FILTER')
  411.         #IF(%FormulaType <> 'COMPUTED')
  412.     IF ~(%FormulaCondition)                    #<! If Filter condition not met
  413.       CYCLE                                      !  Try another record
  414.     END                                          ! End IF
  415.         #ELSE
  416.     IF ~(%FormulaComputation)                  #<! If Filter condition not met
  417.       CYCLE                                      !  Try another record
  418.     END                                          ! End IF
  419.         #ENDIF
  420.       #ENDIF
  421.     #ENDFOR
  422.   #ENDIF
  423.   #INSERT(%GetSecondaryRecords)
  424.   #FOR(%Formula)
  425.     #IF(UPPER(%FormulaClass) = 'LIST')
  426.     #INSERT(%GenerateFormula)
  427.     #ENDIF
  428.   #ENDFOR
  429.     #EMBED('LIST Class formula')
  430.   #IF(%ShowProg)                                #!If showing the progress
  431.     #INSERT(%ShowFileProgress)                  #!Insert the progress code
  432.   #ENDIF
  433.   #FIX(%ScreenField,'?LIST')
  434.     Line = %ScreenFieldExpression              #<! Fill the QUEUE line
  435.     FilePointer = POINTER(%Primary)            #<! Fill the file pointer
  436.   #FOR(%KeyField)
  437.     QUE::%KeyField =%KeyField                  #<! Fill the key field
  438.   #ENDFOR
  439.     ADD(Queue %SortString)                     #<! Add to the QUEUE
  440.     IF ERRORCODE() THEN BREAK.                   ! Quit out if error
  441.     IF FirstPage                                 ! If page 1
  442.       IF RECORDS(Queue) = ROWS(?List)            !  If we have a full screen
  443.         FirstPage = 0                            !   turn off the page flag
  444.       END                                        !  End IF
  445.       DISPLAY(?List)                             !  Display page 1
  446.     END                                          ! End IF
  447.     LOOP WHILE KEYBOARD()                        ! While Keyboard Input
  448.       SELECT(?List)                              !  Select the List box
  449.       ACCEPT                                     !  Accept a Key
  450.       IF KEYCODE() = EscKey                      !  If the Escape key
  451.         DO ProcedureReturn
  452.       END                                        !  End IF
  453.       DISPLAY(?List)                             !  Redisplay the list box
  454.     END                                          ! End LOOP
  455.   END                                            !End LOOP
  456.   #IF(%ShowProg)                                #!If showing the progress
  457.   CLEAR(StatusLine)
  458.   DISPLAY(?StatusLine)
  459.   #ENDIF
  460.   EXIT
  461.  
  462. #IF(%UpdateProc)
  463. UpdateProcedure  ROUTINE
  464.   #EMBED('Prior to Update Procedure')
  465.   %UpdateProc
  466.   #EMBED('After Update Procedure')
  467. #ENDIF
  468. #!
  469. !─────────────────────────────────────────────────────────────────────────────
  470. ProcedureReturn ROUTINE
  471.   #IF(%ShowProg)                                #!If showing the progress
  472.   ERASE(?StatusLine)                             !Clear the StatusLine
  473.   #ENDIF
  474.   DISPLAY                                        !Redisplay the screen
  475.   FREE(Queue)                                    !Free the Queue memory
  476.   #IF(%Pulldown)                                #!If a Pulldown exists
  477.   CLOSE(%Pulldown)                             #<!Close the Pulldown
  478.   #ENDIF
  479.   CLOSE(%Screen)
  480.   #INSERT(%FileControl)
  481.   DO EndOfProcedureEmbed
  482.   RETURN
  483. !─────────────────────────────────────────────────────────────────────────────
  484. EndOfProcedureEmbed ROUTINE
  485. #EMBED('End of Procedure')
  486. #EMBED('Custom Routines')
  487. #!***************************************************************************
  488. #GROUP(%ShowFileProgress)
  489. VEW::Length += 1
  490. StatusLine = ' Reading File: ' & SUB(VEW::ProgString,1,VEW::Length)
  491. IF VEW::Length = LEN(StatusLine) - 15
  492.   VEW::Length = 1
  493.   StatusLine = ' Reading File: ' & ' {65}'
  494. END
  495. Display(?StatusLine)
  496. #!
  497. #!***************************************************************************
  498. #GROUP(%ListErrorCheck)
  499. #!
  500. #IF(%Primary = %Null)
  501.   #SET(%ErrorMessage, (%Procedure & ' ERROR: No file has been chosen for this procedure.'))
  502.   #ERROR(%ErrorMessage)
  503.   #SET(%ErrorMessage, '  A file must be identified on the File Schematic.')
  504.   #ERROR(%ErrorMessage)
  505. #ENDIF
  506. #IF(%KeyRangeField)
  507.   #IF(UPPER(%KeyRangeField) = UPPER(%RangeValue))
  508.     #SET(%ErrorMessage, (%Procedure & ' ERROR: Range Limit Field and Range Value fields must'))
  509.     #ERROR(%ErrorMessage)
  510.     #SET(%ErrorMessage, '   be separate fields.')
  511.     #ERROR(%ErrorMessage)
  512.   #ENDIF
  513.   #IF(%KeyRangeField <> %Null and %RecordOrder <> %Null)
  514.     #SET(%ErrorMessage, (%Procedure & ' ERROR: Range Limits may only be used with keyed order.'))
  515.     #ERROR(%ErrorMessage)
  516.     #SET(%ErrorMessage, '   Record order has been selected.')
  517.     #ERROR(%ErrorMessage)
  518.   #ENDIF
  519. #ENDIF
  520. #!
  521. #!***************************************************************************
  522. #GROUP(%BuildListIndex)
  523. #FIX(%File, %Primary)
  524. #FIX(%Key, %PrimaryKey)
  525. #IF(%KeyIndex)
  526. BUILD(%PrimaryKey)                           #<!Build the index
  527. #ENDIF
  528. #!
  529. #!***************************************************************************
  530. #CHAIN('LOOKUP.TPX')
  531.