locked
What is the right syntax for a simple open RRS feed

  • Question

  • User-1106011126 posted

    I am pasting the Three statement that are puzzeling me.

    FileOpen(3, "userstatus.RPT", mode = 2)
            FileOpen(4, "userxns.RPT", mode = OpenMode.Output)
            FileOpen(11, "permdb.out", mode = OpenMode.Random)

    I have declared mode as type openMode as     Dim mode As OpenMode = 2

    Both variations of the statements are acceptable as syntax, but an exception is thrown for every variation I've tried.  In 50 years of progranning in many languages,

    I've not seen as poor an explanation for a basic function as this provides.

    Can someone help me?

    Friday, June 13, 2014 2:25 PM

Answers

  • User-1360095595 posted

    Maybe this will help you guys help him: http://msdn.microsoft.com/en-us/library/afh37kh8(v=vs.90).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 12:49 PM
  • User-760709272 posted

    Ah, so it is a part of the compat library stuff then.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 12:55 PM
  • User281315223 posted

    Is there any particular reason that you are setting your OpenMode enumerable as an integer instead of using the actual Enum instead?

    Currently, you are using the following :

    ' Define your OpenMode as 2 (which corresponds to output) '
    Dim mode As OpenMode = 2
    ' Use that same approach '
    FileOpen(3, "userstatus.RPT", mode)

    which should be the same as using :

    FileOpen(3, "userstatus.RPT", OpenMode.Output)

    You shouldn't need to be explicitly setting the mode = x within your FileOpen function as it is expected as the third parameter so the following should be just fine :

    FileOpen(3, "userstatus.RPT", OpenMode.Output)
    FileOpen(4, "userxns.RPT", OpenMode.Output)
    FileOpen(11, "permdb.out", OpenMode.Random)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 12:57 PM
  • User753101303 posted

    Hi,

    If some help is still needed following previous responses please do tell us which exception you have. This is always from where you should start...

    Could it be that the file is not found ? In a web app I would suggest to use a full path for files as the current directory is likely not what you expect it to be...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 1:21 PM

All replies

  • User-760709272 posted

    You'll have to explain what FileOpen is and where it's coming from.

    Friday, June 13, 2014 4:11 PM
  • User-1106011126 posted

    This was the only answer I received.  Thru trial and error I answered thje question as the following which works. 

    FileOpen(3, "userstatus.RPT", OpenMode.Output)

    I guess the confusion was regarding the Fileopen statement i used.  It is a statement in the visual basic namespace and I thought that it was obvious that its function was to

    open a file  (in this case, an output file).

    Tuesday, June 17, 2014 12:10 PM
  • User281315223 posted

    FileOpen isn't a built-in method that I am aware of (you might try right-clicking on it and showing us what appears after clicking "Navigate to Definition").

    You may be confusing it with the File.Open() method available in the System.IO assembly, however the syntax is quite a bit different from the one you are using :

    File.Open("YourFileName", FileMode.YourFileMode)

    The above method is a fairly standard and commonly used way of opening files.

    Tuesday, June 17, 2014 12:16 PM
  • User-760709272 posted

    Maybe it's part of the compatability namespaces, dunno.  I googled but couldn't find any mention of it. *shrug*

    Tuesday, June 17, 2014 12:40 PM
  • User-1360095595 posted

    Maybe this will help you guys help him: http://msdn.microsoft.com/en-us/library/afh37kh8(v=vs.90).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 12:49 PM
  • User-760709272 posted

    Ah, so it is a part of the compat library stuff then.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 12:55 PM
  • User281315223 posted

    Is there any particular reason that you are setting your OpenMode enumerable as an integer instead of using the actual Enum instead?

    Currently, you are using the following :

    ' Define your OpenMode as 2 (which corresponds to output) '
    Dim mode As OpenMode = 2
    ' Use that same approach '
    FileOpen(3, "userstatus.RPT", mode)

    which should be the same as using :

    FileOpen(3, "userstatus.RPT", OpenMode.Output)

    You shouldn't need to be explicitly setting the mode = x within your FileOpen function as it is expected as the third parameter so the following should be just fine :

    FileOpen(3, "userstatus.RPT", OpenMode.Output)
    FileOpen(4, "userxns.RPT", OpenMode.Output)
    FileOpen(11, "permdb.out", OpenMode.Random)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 12:57 PM
  • User753101303 posted

    Hi,

    If some help is still needed following previous responses please do tell us which exception you have. This is always from where you should start...

    Could it be that the file is not found ? In a web app I would suggest to use a full path for files as the current directory is likely not what you expect it to be...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 17, 2014 1:21 PM