Macro: API_OPEN

Module location: FMAC line 7871 (view source)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Command: OPEN {fileName AS} [logicalName|fileNum|] {MODE fileMode} index Description: Open a DataFile using the specified filename of filenumber. Parameters: fileName: A string containing the physical name of the file logicalName: The symbolic name used to find the .FD file. fileNum: A number which will be used to open the file. If using the "AS" form, fileNum may be a variable containing a 0. In that case, filelist will be searched for an entry with a logical name matching fileName; the number of the first entry matching will be used as the number to open the file and will be written back to the variable used for fileNum. fileMode: The mode to open the file in ( e.g., DF_EXCLUSIVE ). index: Index to buffer, may be either a number or an index symbol (INDEX.1) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  #IFSAME !2 AS
    //#IFSAME !3 |FS0,0& |FN0,0& |FD0,0&
    // This supports both Indirect_file and Indirect_file.Recnum -JJT
    #IFSAME !3.FILE_NUMBER |FS0,0& |FN0,0& |FD0,0& |FS0,0&.RECNUM
        #SET Q$ $516 // Open indirect
    #ELSE
        #SET Q$ $50d // Open normally
    #ENDIF
    #IFSAME !4 MODE
      #CHECK !5 _RLUG#
      !A [] $517 !5 !6
      VARIABLE_FILE_COMMAND !q !3 !1
    #ELSE
      !A [] $517 DF_SHARE !4
      VARIABLE_FILE_COMMAND !q !3 !1
    #ENDIF
  #ELSE
    //#IFSAME !1 |FS0,0& |FN0,0& |FD0,0&
    // This supports both Indirect_file and Indirect_file.Recnum -JJT
    #IFSAME !1.FILE_NUMBER |FS0,0& |FN0,0& |FD0,0& |FS0,0&.RECNUM
        #SET Q$ $516 // Open indirect
    #ELSE
        #SET Q$ $50d // Open normally
    #ENDIF
    #IFSAME !2 MODE
      #CHECK !3 _RLUG#
      !A [] $517 !3 !4
      VARIABLE_FILE_COMMAND !q !1 |CS""
    #ELSE
      !A [] $517 DF_SHARE !2
      VARIABLE_FILE_COMMAND !q !1  |CS""
    #ENDIF
  #ENDIF