home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / clarion / ppstpx.zip / OM.TPL < prev    next >
Text File  |  1993-06-08  |  34KB  |  593 lines

  1. #!------------------------------------------------------------------------------
  2. #!
  3. #!                          The OM Template File
  4. #!
  5. #!    OM.TPL is the first of a chain of template files that contain the
  6. #!    standard Clarion procedure templates.  These templates generate CUA
  7. #!    compliant, text-based applications.  Other files in the template chain
  8. #!    are OM1.TPX, OM2.TPX, and so forth.
  9. #!
  10. #!    Initial screen, report, and action images are contained in corresponding
  11. #!    application files with an extension of .APP (e.g. OM.APP).
  12. #!
  13. #!    Template Directory
  14. #!
  15. #!      OM1.TPX    Batch        Sequential record processing of a file.
  16. #!      OM3.TPX    Browse       Browse records directly from a file
  17. #!      OM6.TPX    Child        Update a batch of Child records
  18. #!      OM1.TPX    External     Document external procedure call
  19. #!      OM8.TPX    File         Select a file from a directory listing
  20. #!      OM4.TPX    Form         Update a record with a form
  21. #!      OM3.TPX    List         List a file's records from a memory queue
  22. #!      OM3.TPX    Lookup       Setup procedure to lookup a field
  23. #!      OM2.TPX    Menu         Execute a procedure from a pop-up menu
  24. #!      OM.TPL     Module       Initialize a module
  25. #!      OM4.TPX    MultiPage    Update a file with a multiple page entry form
  26. #!      OM4.TPX    PageOf       Data entry 'Page' used with the MultiPage Form
  27. #!      OM1.TPX    Print        Print a report from memory
  28. #!      OM.TPL     Program      Initialize a program
  29. #!      OM2.TPX    Pulldown     Execute a procedure from a pulldown menu
  30. #!      OM8.TPX    Redirect     Select destination for a report
  31. #!      OM7.TPX    Report       Print a report
  32. #!      OM1.TPX    Screen       Process any screen
  33. #!      OM3.TPX    Select       Load a selected record into memory
  34. #!      OM1.TPX    Source       Process any source code
  35. #!      OM1.TPX    Todo         Undefined procedure code
  36. #!      OM3.TPX    Validate     Edit procedure to lookup a field
  37. #!      OM8.TPX    View         View a selected text file in a listbox
  38. #!      OM9.TPX    #GROUPs      Groups used by multiple templates
  39. #!
  40. #!------------------------------------------------------------------------------
  41. #PROGRAM
  42. #!------------------------------------------------------------------------------
  43. #!
  44. #!                           The Program Template
  45. #!
  46. #!    The Program template generates the PROGRAM statement, MAP structure,
  47. #!    FILE structures, and global declarations for a Clarion program.  This
  48. #!    template also blanks the screen and calls the first procedure.  There
  49. #!    is only one #PROGRAM segment in a template file chain.
  50. #!
  51. #!------------------------------------------------------------------------------
  52. #PROMPT('Enable &Shared Files',CHECK),%SharedFiles
  53. #PROMPT('Enable Mouse Support',CHECK),%MouseSupport
  54. #PROMPT('Enhanced Background?',CHECK),%EnhancedBackground
  55. #PROMPT('Thin Borders?',CHECK),%ThinBorders   #! Thin borders wanted ? PPS
  56. #PROMPT('Enable File Manager',CHECK),%FileMgr #! File Manager wanted ? PPS
  57. #PROMPT('If &File Not Found',OPTION),%FileNotFound
  58. #PROMPT('Create',RADIO)
  59. #PROMPT('Halt',RADIO)
  60. #PROMPT('Program &Author',@S30),%Author
  61. #!
  62. #IF(%SharedFiles)
  63.   #SET(%AccessMode,'42h')
  64. #ELSE
  65.   #SET(%AccessMode,'22h')
  66. #ENDIF
  67.                 TITLE('%Program')
  68. OMIT('╝')
  69. ╔════════════════════════════════════════════════════════════════════════════╗
  70. ║  Program - %Program                          #<!                           ║
  71. ║  Author  - %Author                           #<!                           ║
  72. ╚════════════════════════════════════════════════════════════════════════════╝
  73.                  PROGRAM
  74.  
  75.                  INCLUDE('KEYCODES.EQU')
  76.                  INCLUDE('CLARION.EQU')
  77.                  INCLUDE('ERRORS.EQU')
  78.  
  79.                  MAP
  80.                    CheckOpen(*FILE)
  81.                    #IF(%FileMgr)           #! If using File Manager then
  82.                    FileMgr(STRING,<STRING>,<*BYTE>,<*FILE>,<STRING>)
  83.                    #ENDIF                  #! declare it. PPS
  84.                    DiskError(<STRING>),BYTE
  85.                    ShowWarning
  86.                    %ModuleStructures
  87.                  END
  88.  
  89.                  EJECT('File Layouts')
  90.  
  91. %GlobalData
  92.  
  93. #!#FOR(%AppFiles)        Changed to put all files in dct in app. PPS
  94. #! #FIX(%File,%AppFiles)
  95. #FOR(%File)
  96. %FileStructure
  97.  
  98. #ENDFOR
  99.  
  100. AddRecord        EQUATE(1)                     #<!  Add a new record
  101. ChangeRecord     EQUATE(2)                     #<!  Change the current record
  102. DeleteRecord     EQUATE(3)                     #<!  Delete the current record
  103.  
  104. #IF(%FileMgr)
  105.                                                #<! Create Global File Manager
  106.                                                #<! variables - PPS
  107. #INSERT(%GlobalFileMgrVars)
  108. #ENDIF
  109.  
  110. #EMBED('Data Section')
  111.  
  112.   CODE
  113.   #EMBED('Setup Program')
  114.   LOADSYMBOLS                                  #<!Display graphic mouse
  115.   #IF(%ThinBorders)
  116.   LOADBORDER                                   #<!Display thin borders PPS
  117.   #ENDIF
  118.   #IF(%EnhancedBackground)
  119.   SETNOBLINK                                   #<!Enable enhanced colors
  120.   #ENDIF
  121.   #IF(%HelpFile)
  122.   HELP('%HelpFile')                            #<!Open the help file
  123.   #ENDIF
  124.   #IF(%StyleFile )
  125.   GETSTYLES('%StyleFile')                      #<!Open the style file
  126.   #ENDIF
  127.   #IF(%MouseSupport)
  128.   SETMOUSE(1,1)                                #<!Turn on mouse
  129.   #ENDIF
  130.   SETCOLOR(WhiteOnBlack)                       #<!Set white on black
  131.   BLANK                                        #<!Clear the screen
  132.   SETCOLOR                                     #<!Turn off override color
  133.  
  134.   %FirstProcedure                              #<!Call the first procedure
  135.  
  136.   #EMBED('Before return to DOS')
  137.   RETURN                                       #<!Return to DOS
  138.  
  139. OMIT('╝')
  140. ╔════════════════════════════════════════════════════════════════════════════╗
  141. ║  Check ERROR() function after opening a file                               ║
  142. ╚════════════════════════════════════════════════════════════════════════════╝
  143. CheckOpen         PROCEDURE(File)
  144.  
  145.   CODE
  146.   OPEN(File,%AccessMode)                       #<!Attempt to open the file
  147.   CASE ERRORCODE()                             #<! and check for errors
  148.   OF NoError                                   #<!Return if no error
  149.   OROF IsOpenErr                               #<! or if already open.
  150.     RETURN
  151.   #IF(%FileNotFound <> 'Halt')
  152.   OF NoFileErr                                 #<!If file was not found
  153.     CREATE(File)                               #<!Create the file
  154.     OPEN(File,%AccessMode)                     #<! then open it
  155.     IF ~ERRORCODE() THEN RETURN.               #<!  And return if it opened
  156.   #ENDIF
  157.   OF InvalidFileErr                            #<!Invalid Record Declaration
  158.     GLO:Message1 = 'Error accessing: '& NAME(File)
  159.     GLO:Message2 = 'Code: ' & ERRORCODE() & ' ' & ERROR()
  160.     GLO:Message3 = 'Press OK to return to DOS'
  161.     ShowWarning
  162.     HALT(InvalidFileErr)
  163.   OF BadKeyErr                                 #<!Key Files must be rebuilt
  164.     GLO:Message1 = NAME(File) & ' Key file is invalid'
  165.     GLO:Message3 = 'Press OK to rebuild keyfile'
  166.     ShowWarning
  167.     OPEN(File,12H)                             #<!Open for exclusive access
  168.     BUILD(File)                                #<!Rebuild the key files
  169.     IF ERRORCODE()
  170.       GLO:Message1 = NAME(File) & ' The file cannot be repaired'
  171.       GLO:Message2 = 'while other stations are using it'
  172.       GLO:Message3 = 'Press OK to return to DOS'
  173.       ShowWarning
  174.       HALT(BadKeyErr)
  175.     ELSE
  176.       CLOSE(File)                              #<!Close
  177.       OPEN(File,%AccessMode)                   #<! then open it
  178.     END
  179.   END                                          #<!End of Case Structure
  180.   IF DiskError(NAME(File) & ' File could not be opened') THEN HALT(0). #<!Cannot resume
  181.  
  182. OMIT('╝')
  183. ╔════════════════════════════════════════════════════════════════════════════╗
  184. ║  File manager procedure to only open files that are needed. It also has    ║
  185. ║  a table that can be called by any procedure via a CtrlGAst.               ║
  186. ║                                                                            ║
  187. ║  This procedure can be passed five parameters.  The do as follows:         ║
  188. ║                                                                            ║
  189. ║  1. LEVEL: This call needs to have the first parameter of LEVEL, the       ║
  190. ║  procedure name, and the file manager level variable that needs to be      ║
  191. ║  modified. The LEVEL parameter and the procedure name are passed by value  ║
  192. ║  and the file manager variable is passed by address. The procedure looks   ║
  193. ║  through the file manager Queue and finds all of the occurences of the     ║
  194. ║  procedure being called. It then gets the highest level of the procedure,  ║
  195. ║  puts that value into the file manager level variable that was passed by   ║
  196. ║  address and then increments it by one.                                    ║
  197. ║                                                                            ║
  198. ║  2. OPEN: This call needs to have first parameter as OPEN, the procedure   ║
  199. ║  name, the file manager level variable, the file, and the file name.       ║
  200. ║  The OPEN parameter, the procedure name, and the file name are all passed  ║
  201. ║  by value.  The file manager level variable and the file are passed by     ║
  202. ║  address.  This parameter causes the procedure to look through the file    ║
  203. ║  manager Queue and see if the requested file is open.  If it is it makes   ║
  204. ║  a note of it in the queue but does not try to open the file again.  If    ║
  205. ║  the file is not open it makes a note of it in the queue and opens the     ║
  206. ║  file with the standard CheckOpen.                                         ║
  207. ║                                                                            ║
  208. ║  3. CLOSE: This call needs to have the first parameter as CLOSE, the       ║
  209. ║  procedure name, the file manager level variable, the file, and the file   ║
  210. ║  name.  The CLOSE parameter, the procedure name, and the file name are     ║
  211. ║  all passed by value.  The file manager level variable and the file are    ║
  212. ║  passed by address.  This parameter causes the procedure to look through   ║
  213. ║  the file manager Queue and close the passed file.  It will only close the ║
  214. ║  passed file if it has not been opened by any other procedure.             ║
  215. ║                                                                            ║
  216. ║  4. EXIT: This call needs to have the first parameter as EXIT, the         ║
  217. ║  procedure name, and the file manager level variable.  The EXIT parameter  ║
  218. ║  and the procedure name are passed by value.  The file manager level       ║
  219. ║  variable is passed by address.  This parameter causes the procedure to    ║
  220. ║  look through the file manager queue and close every file for this         ║
  221. ║  procedure and level.  It will only close the file if no other procedure   ║
  222. ║  needs it to be open.                                                      ║
  223. ║                                                                            ║
  224. ║  5. VIEW: This call needs to have the first parameter as VIEW.  The VIEW   ║
  225. ║  parameter is passed by value.  This parameter causes the procedure to     ║
  226. ║  display a scrolling table with the file manager queue being used.  This   ║
  227. ║  will allow the user to see all files that should be opened.  This call    ║
  228. ║  has been placed in every templates keyboard control loop.  If the user    ║
  229. ║  hits ALT-MINUS (alt and the minus sign key) it will call this procedure   ║
  230. ║  with the VIEW parameter.                                                  ║
  231. ╚════════════════════════════════════════════════════════════════════════════╝
  232. FileMgr           PROCEDURE(OpenType,PassedProcName,FileMgrLvlVar,|
  233.                             PassedFile,PassedFileName)
  234.  
  235. MainFileQueuePtr  byte                           !File Manager Queue Pointer
  236. MainFileQueueTop  byte                           !File Manager Queue Top Ptr
  237. OpenFlag          byte                           !Flag to signal to open file
  238. Level             byte                           !File Manager level holder
  239. CurrentFile       string(8)                      !Current file to close holder
  240. FileViewQueuePtr  byte
  241. FileViewQueueTop  byte
  242.  
  243. FileViewQueue     QUEUE,pre(fvq)                 ! File Management View Queue
  244. display_string    string(78)
  245.                   .
  246.  
  247. QueueViewScr     SCREEN(22,80),SHADOW,ZOOM,CUA,COLOR(19)
  248.                    !dimensions=25,80,25,80
  249.                    ROW(1,1)    PAINT(1,25),COLOR(49)
  250.                    ROW(1,55)   PAINT(1,26),COLOR(49)
  251.                    ROW(1,26)   STRING('FILE MANAGER QUEUE VIEW TABLE'),COLOR(49)
  252.                    ROW(22,1)   STRING('╒╟{78}╨')
  253.                                REPEAT(20)
  254.                    ROW(2,1)      STRING('')
  255.                    ROW(2,80)     STRING('╥')
  256.                                .
  257.                    ROW(4,4)    LIST(15,74),FROM(FileViewQueue),VSCROLL,USE(?FileViewList),MSG('Up/Down arrow, PgUp/PgDwn, Enter to select'),HIDE,COLOR(112,143,120)
  258.                    ROW(20,38)  BUTTON('  E&xit  |'),SHADOW,USE(?EXIT),MSG('Return to previous screen'),COLOR(32,143,39,47,143)
  259.                  .
  260.  
  261.   CODE
  262.   case clip(left(upper(OpenType)))
  263.        of 'LEVEL'                                !File Manager to compute
  264.                                                  ! current file open level.
  265.           if records(FileManagerQueue)           !If records in file mgr queue
  266.              sort(FileManagerQueue,fmq:ProcName,|!Sort the File Manager queue
  267.                   fmq:FileMgrLvl)
  268.              Level = 0                           !Set the level holder to zero
  269.              MainFileQueuePtr = 1                !Set the queue ptr to 1
  270.              MainFileQueueTop = |                !Set the queue top ptr to
  271.                        records(FileManagerQueue) ! number of rec's in queue
  272.              loop                                !Start queue look loop
  273.                 get(FileManagerQueue,|           !Get the queue record for
  274.                     MainFileQueuePtr)            ! the queue pointer
  275.                 if fmq:ProcName = PassedProcName !If queue proc name equal
  276.                    Level = fmq:FileMgrLvl        ! to passed proc name then
  277.                                                  ! store the level for the
  278.                                                  ! proc in the level holder
  279.                 .                                !End if queue proc name equal
  280.                 MainFileQueuePtr += 1            !Increment queue pointer
  281.                 if MainFileQueuePtr > |          !If queue pointer is greater
  282.                                 MainFileQueueTop ! than the top ptr then
  283.                    break                         ! break.
  284.                 .                                !End if queue ptr greater
  285.              .                                   !End queue look loop
  286.              FileMgrLvlVar = Level + 1           !Increment file mgr lvl
  287.           else                                   !If no records in file mgr
  288.                                                  ! queue
  289.              FileMgrLvlVar = 1                   !Set file mgr lvl var to 1
  290.           .                                      !End if records in file mgr
  291.                                                  ! queue
  292.  
  293.        of 'OPEN'                                 !Request to open a file
  294.           OpenFlag = 1                           !Set OpenFlag to 1 (Open File)
  295.           if records(FileManagerQueue) then      !If records in file mgr queue
  296.              MainFileQueuePtr = 1                !Set queue ptr to one
  297.              MainFileQueueTop = |                !Set queue top ptr to number
  298.                      records(FileManagerQueue)   ! of records in queue
  299.              loop                                !Start queue look loop
  300.                 get(FileManagerQueue,|           !Get queue record for queue
  301.                     MainFileQueuePtr)            ! pointer
  302.                 if fmq:FileName = PassedFileName !If queue file file name equal
  303.                                                  ! to procedure name
  304.                    OpenFlag = 0                  !Set open flag to 0 (No Open)
  305.                    break                         !Break out of look loop
  306.                 .                                !End if queue file equal
  307.                 MainFileQueuePtr += 1            !Increment queue ptr
  308.                 if MainFileQueuePtr > |          !If queue ptr greater than
  309.                               MainFileQueueTop   ! queue top ptr
  310.                    break                         !Break out of look loop
  311.                 .                                !End if queue ptr greater
  312.              .                                   !End queue look loop
  313.              sort(FileManagerQueue,fmq:ProcName,|!Sort file mgr queue by proc
  314.                   fmq:FileName,fmq:FileMgrLvl)   ! name, file name, level
  315.              fmq:FileName = PassedFileName       !Set queue file name to passed
  316.              fmq:ProcName = PassedProcName       !Set queue proc name to passed
  317.              fmq:FileMgrLvl = FileMgrLvlVar      !Set queue level to passed
  318.              get(FileManagerQueue,fmq:ProcName,| !Get record in queue that
  319.                  fmq:FileName,fmq:FileMgrLvl)    ! matches passed values
  320.              if errorcode() = 30 then            !If queue rec not found
  321.                 clear(fmq:record)                !Clear the queue record
  322.                 fmq:FileName = PassedFileName    ! structure and add passed
  323.                 fmq:ProcName = PassedProcName    ! values to the queue
  324.                 fmq:FileMgrLvl = FileMgrLvlVar   !
  325.                 add(FileManagerQueue)            !
  326.                 if OpenFlag then                 !If open flag is set then
  327.                    CheckOpen(PassedFile)         ! call CheckOpen with file
  328.                 .                                !End if open flag set
  329.              .                                   !End if queue rec not found
  330.           else                                   !
  331.              clear(fmq:record)                   !If no records in queue then
  332.              fmq:FileName = PassedFileName       ! fill queue record structure
  333.              fmq:ProcName = PassedProcName       ! with the passed values and
  334.              fmq:FileMgrLvl = FileMgrLvlVar      ! add to the queue
  335.              add(FileManagerQueue)               !
  336.              CheckOpen(PassedFile)               !Call CheckOpen with file
  337.           .                                      !End if records in queue
  338.                                                  !
  339.        of 'CLOSE'                                !File close requested
  340.           MainFileQueuePtr = 1                   !Set queue ptr to 1
  341.           MainFileQueueTop = |                   !Set queue top ptr to number
  342.                   records(FileManagerQueue)      ! of records in queue
  343.           loop                                   !Start queue look loop
  344.              get(FileManagerQueue, |             !Get queue record for ptr
  345.                  MainFileQueuePtr)               !
  346.              if fmq:ProcName = PassedProcName|   !If the queue proc name,
  347.                 and fmq:FileMgrLvl = FileMgrLvlVar|
  348.                 and fmq:FileName = PassedFileName! queue level, and queue file
  349.                                                  ! match the passed values
  350.                    delete(FileManagerQueue)      !Delete the queue record
  351.                    if records(FileManagerQueue)  !If records are left in queue
  352.                       sort(FileManagerQueue,|    !Sort queue by file name
  353.                            fmq:FileName)         !
  354.                       fmq:FileName = |           !Fill queue file name with
  355.                              PassedFileName      ! passed value
  356.                       get(FileManagerQueue,|     !Check if file name is in
  357.                           fmq:FileName)          ! the queue
  358.                       if errorcode() = 30        !If file name is not in the
  359.                          case PassedFileName     ! queue then close the
  360.                                                  ! passed file.
  361.                          #FOR(%File)
  362.                               of '%File'
  363.                                  close(%File)
  364.  
  365.                          #ENDFOR
  366.                          .                       !End case CurrentFile
  367.                       .                          !End if file name not found
  368.                    else                          !
  369.                       case PassedFileName        !If no records in queue
  370.                                                  ! then close the passed
  371.                                                  ! file
  372.                       #FOR(%File)
  373.                            of '%File'
  374.                               close(%File)
  375.  
  376.                       #ENDFOR
  377.                       .                          !End case CurrentFile
  378.                    .                             !End if file name not found
  379.                    MainFileQueuePtr = 1          !Reset the queue ptr to 1
  380.                    MainFileQueueTop =|           !Reset the queue top ptr
  381.                         records(FileManagerQueue)! no of recs in queue
  382.                    if MainFileQueueTop = 0       !If queue top ptr is zero
  383.                       free(FileManagerQueue)     !Destroy the queue structure
  384.                       break                      ! break out of look loop
  385.                    .                             !End if queue top ptr zero
  386.                    cycle                         !Go to top of loop
  387.              .                                   !End if proc name equal passed
  388.              MainFileQueuePtr += 1               !Increment queue ptr
  389.              if MainFileQueuePtr >|              !If queue ptr greater than top
  390.                            MainFileQueueTop      ! ptr then break out of look
  391.                 break                            ! loop
  392.              .                                   !End if queue ptr greater
  393.           .                                      !End of look loop
  394.                                                  !
  395.        of 'EXIT'                                 !File mgr exit requested
  396.           MainFileQueuePtr = 1                   !Set queue ptr to 1
  397.           MainFileQueueTop =|                    !Set queue top ptr to number
  398.                   records(FileManagerQueue)      ! of records in queue
  399.           loop                                   !Start queue look loop
  400.              get(FileManagerQueue,|              !Get queue record for ptr
  401.                  MainFileQueuePtr)               !
  402.              if fmq:ProcName = PassedProcName|   !If the queue proc name,
  403.                  and fmq:FileMgrLvl = FileMgrLvlVar
  404.                                                  ! queue level, and queue file
  405.                                                  ! match the passed values
  406.                    CurrentFile = fmq:FileName    !Fill CurrentFile with que file
  407.                    delete(FileManagerQueue)      !Delete the queue records
  408.                    if records(FileManagerQueue)  !If records are left in queue
  409.                       sort(FileManagerQueue,|    !Sort queue by file name
  410.                            fmq:FileName)         !
  411.                       fmq:FileName = CurrentFile !Fill queue file name with
  412.                                                  ! the current file name
  413.                       get(FileManagerQueue,|     !Check if file name is in
  414.                           fmq:FileName)          ! the queue
  415.                       if errorcode() = 30        !If file name is not in the
  416.                          case CurrentFile        ! queue then close the
  417.                                                  ! passed file.
  418.                          #FOR(%File)
  419.                               of '%File'
  420.                                  close(%File)
  421.  
  422.                          #ENDFOR
  423.                          .                       !End case CurrentFile
  424.                       .                          !End if file name not found
  425.                    else                          !
  426.                       case CurrentFile           !If no records in queue
  427.                                                  ! then close the passed
  428.                                                  ! file
  429.                       #FOR(%File)
  430.                            of '%File'
  431.                               close(%File)
  432.  
  433.                       #ENDFOR
  434.                       .                          !End case CurrentFile
  435.                    .                             !End if file name not found
  436.                    MainFileQueuePtr = 1          !Reset the queue ptr to 1
  437.                    MainFileQueueTop =|           !Reset the queue top ptr
  438.                         records(FileManagerQueue)! no of recs in queue
  439.                    if MainFileQueueTop = 0       !If queue top ptr is zero
  440.                       free(FileManagerQueue)     !Destroy the queue structure
  441.                       break                      ! break out of look loop
  442.                    .                             !End if queue top ptr zero
  443.                    cycle                         !Go to top of loop
  444.              .                                   !End if proc name equal passed
  445.              MainFileQueuePtr += 1               !Increment queue ptr
  446.              if MainFileQueuePtr >|              !If queue ptr greater than top
  447.                              MainFileQueueTop    ! ptr then break out of look
  448.                 break                            ! loop
  449.              .                                   !End if queue ptr greater
  450.           .                                      !End of look loop
  451.                                                  !
  452.        of 'VIEW'                                 !File mgr view requested
  453.           if records(FileManagerQueue)           !If recs are in queue
  454.              sort(FileManagerQueue,fmq:ProcName,|!Sort file mgr queue by proc
  455.                   fmq:FileName,fmq:FileMgrLvl)   ! name, file name, level
  456.              MainFileQueuePtr = 1                !Set queue ptr to 1
  457.              MainFileQueueTop = |                !Reset the queue top ptr
  458.                        records(FileManagerQueue) ! no of recs in queue
  459.              loop                                !Start queue transfer loop
  460.                 get(FileManagerQueue,|           !Get the queue record for
  461.                     MainFileQueuePtr)            ! queue ptr
  462.                 fvq:display_string = ' ' &|      !Fill the display string
  463.                     left(fmq:ProcName,50) |      ! with the proc name, file
  464.                     & ' │ ' & |                  ! name, and file manager
  465.                     left(fmq:FileName) |         ! level
  466.                     & ' │ ' & |                  !
  467.                     fmq:FileMgrLvl               !
  468.                 add(FileViewQueue)               !Add record to view queue
  469.                 MainFileQueuePtr += 1            !Increment queue ptr
  470.                 if MainFileQueuePtr > |          !Increment queue ptr
  471.                        MainFileQueueTop          !If queue ptr greater than top
  472.                                                  ! ptr then break out of transfer
  473.                    break                         ! loop
  474.                 .                                !End if queue ptr greater
  475.              .                                   !End of transfer loop
  476.              open(QueueViewScr)                  !Open the view screen
  477.              loop                                !Start of keyboard loop
  478.                 accept                           !
  479.                 case field()                     !
  480.                     of ?EXIT                     !If EXIT button is hit then
  481.                        break                     ! break out of the loop
  482.                 .                                !
  483.                 case keycode()                   !
  484.                      of EscKey                   !If ESC is hit then break
  485.                         break                    ! out of the loop
  486.                 .                                !
  487.              .                                   !End keyboard loop
  488.              free(FileViewQueue)                 !Remove the view queue stru.
  489.              close(QueueViewScr)                 !Close the view screen
  490.           else                                   !
  491.              glo:message1 = |                    !If no files to be managed
  492.                       'No managed files to view' ! then warn the user with
  493.              showwarning                         ! showwarning
  494.              clear(glo:message1)                 !
  495.           .                                      !
  496.   .                                              !
  497.   return                                         !Return to the caller
  498.  
  499. OMIT('╝')
  500. ╔════════════════════════════════════════════════════════════════════════════╗
  501. ║  Check ERROR() function after a disk access                                ║
  502. ╚════════════════════════════════════════════════════════════════════════════╝
  503. DiskError        FUNCTION(Cause)
  504. StopMsg::        STRING(180)
  505.  
  506.   CODE
  507.   IF ~ERRORCODE() THEN RETURN(0).              #<!Return with no error
  508.   IF ~OMITTED(1)                               #<!If a cause was given
  509.     StopMsg:: = 'Cause: ' & Cause & LF:CR      #<!  Display it
  510.   END                                          #<!End IF
  511.   IF ERRORFILE()                               #<!If error involves a file
  512.     StopMsg:: = CLIP(StopMsg::) & 'File : '  | #<!  display the file
  513.               & ERRORFILE() & LF:CR
  514.   END                                          #<!End IF
  515.   StopMsg:: = CLIP(StopMsg::) & 'Error: '    | #<!Display the error code
  516.             & ERRORCODE() & ' - '            | #<!  and the error message
  517.             & ERROR() & LF:CR
  518.  
  519.   STOP(StopMsg::)                              #<!Stop with message
  520.   RETURN(1)                                    #<!Return with error
  521.  
  522. OMIT('╝')
  523. ╔════════════════════════════════════════════════════════════════════════════╗
  524. ║  Display a warning message using 3 Global message variables.               ║
  525. ╚════════════════════════════════════════════════════════════════════════════╝
  526. ShowWarning      PROCEDURE
  527.  
  528. SaveStyle        STRING(256)
  529. !
  530. !   COMMENTED OUT TO CHANGE TO FOLLOW THE PPS SCREEN CONVENTIONS
  531. !Screen           SCREEN(9,53),PRE(SCR),CENTER,SHADOW,CUA,COLOR(112)
  532. !                   ROW(1,1)    STRING('█▀{51}█'),COLOR(116)
  533. !                   ROW(9,1)    STRING('█▄{51}█'),COLOR(116)
  534. !                               REPEAT(7)
  535. !                   ROW(2,1)      STRING('█'),COLOR(116)
  536. !                   ROW(2,53)     STRING('█'),COLOR(116)
  537. !                               .
  538. !                   ROW(3,5)    ENTRY(@S45),USE(GLO:Message1),INS,SKIP,COLOR(112,112,112)
  539. !                   ROW(4,5)    ENTRY(@S45),USE(GLO:Message2),INS,SKIP,COLOR(112,112,112)
  540. !                   ROW(5,5)    ENTRY(@s45),USE(GLO:Message3),INS,SKIP,COLOR(112,112,112)
  541. !                   ROW(7,24)   BUTTON('  &Ok  |'),SHADOW,USE(?Ok),COLOR(23,71,24,31,79)
  542. !                 .
  543.  
  544. Screen           SCREEN(9,53),PRE(SCR),CENTER,SHADOW,ZOOM,CUA,COLOR(79)
  545.                    !dimensions=25,80,25,80
  546.                    ROW(1,1)    STRING('█{18}'),COLOR(207)
  547.                      COL(19)   STRING('USER MESSAGE FORM'),COLOR(241)
  548.                      COL(36)   STRING('█{18}'),COLOR(207)
  549.                    ROW(9,1)    STRING('╒╟{51}╨')
  550.                                REPEAT(7)
  551.                    ROW(2,1)      STRING('')
  552.                    ROW(2,53)     STRING('╥')
  553.                                .
  554.                    ROW(3,5)    ENTRY(@S45),USE(GLO:Message1),INS,SKIP,COLOR(112,112,112)
  555.                    ROW(4,5)    ENTRY(@S45),USE(GLO:Message2),INS,SKIP,COLOR(112,112,112)
  556.                    ROW(5,5)    ENTRY(@s45),USE(GLO:Message3),INS,SKIP,COLOR(112,112,112)
  557.                    ROW(7,24)   BUTTON('  &Ok  |'),SHADOW,USE(?Ok),COLOR(23,143,24,31,143)
  558.                  .
  559.  
  560.   CODE
  561.   SaveStyle = STYLES()                         #<!Save current style
  562.   GETSTYLES('')                                #<!Turn off Styles
  563.   GLO:Message1 = CENTER(GLO:Message1,SIZE(GLO:Message1))
  564.   GLO:Message2 = CENTER(GLO:Message2,SIZE(GLO:Message2))
  565.   GLO:Message3 = CENTER(GLO:Message3,SIZE(GLO:Message3))
  566.   OPEN(Screen)
  567.   DISPLAY
  568.   ACCEPT                                       #<!Enable keyboard and mouse
  569.   CLEAR(GLO:MessageGroup)                      #<!Blank out message fields
  570.   SETSTYLES(SaveStyle)                         #<!Restore user styles
  571.   RETURN
  572.  
  573. #!
  574. #MODULE
  575. #!------------------------------------------------------------------------------
  576. #!
  577. #!                            The Module Template
  578. #!
  579. #!    The Module template generates the MEMBER statement, and module
  580. #!    level data declarations for a source module of a Clarion program.
  581. #!    There is only one #MODULE segment in a template file chain.
  582. #!
  583. #!------------------------------------------------------------------------------
  584.                 MEMBER('%Program')
  585. OMIT('╝')
  586. ╔════════════════════════════════════════════════════════════════════════════╗
  587. ║   %Module - %ModuleDescription               #<!                           ║
  588. ╚════════════════════════════════════════════════════════════════════════════╝
  589. %ModuleData
  590. #EMBED('Data Section')
  591. #!
  592. #CHAIN('OM1.TPX')
  593.