ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Reading in my stream file from IFS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading in my stream file from IFS

    I have a problem trying to read in my stream file and brain freeze on how to resolve it.

    In my RPG ILE program I am creating a stream file in the IFS using the CGIDEV2 procedure WrtHtmlToStmf. Not sure if that has any relevance here.
    In the same program I am then trying to read the same file using IFS_file2Var thanks to Aaron Bartell.

    When it gets to the open statement on the given stream file the handle returns -1. It is unable to open the file.
    I have looked at so many things including file permissions and code pages. It just won't open it.
    I have a mapped network drive from windows to the IFS. I can see the file but am unable to copy or open it.
    I have tried CPYFRMIMPF FROMSTMF and get "File system error occurred. Error number 3025."
    I am able to view and copy the file to my pc using iSeries Nav for some strange reason?
    I can also use WRKLNK and view the file that way.

    Now if I substitute the file path & name created in the program with a file I have created myself the IFS_file2Var procedure happily works, as does CPYFRMIMPF and any other way I wish to access it.

    What I thought may be the case is the file written using the CGIDEV2 proc was remaining open/locked? But if I sign off from the session which created it I am still unable to CPYFRMIMPF.

    Any more ideas of what I can look at? Thanks.
    the smoking gnu

  • #2
    Re: Reading in my stream file from IFS

    just a guess. but did you close the IFS file prior to trying to open for processing.
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: Reading in my stream file from IFS

      Also just a guess....
      ensure there are no leading/trailing blanks in the file name.

      Best of Luck
      GLS
      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

      Comment


      • #4
        Re: Reading in my stream file from IFS

        Originally posted by tomholden View Post
        just a guess. but did you close the IFS file prior to trying to open for processing.
        probably the dumbest question you'll read today, but how do i close it?
        the close procedure i use needs the file handle, i get the handle from the open procedure.. the open procedure is where i have the initial problem as it has return value of -1
        if this is the problem, why am i unable to do a CPYFRMIMPF on the file even after i end the job which created it?
        Originally posted by GLS400 View Post
        Also just a guess....
        ensure there are no leading/trailing blanks in the file name.

        Best of Luck
        GLS
        guesses are good gents, they're what i need but alas i am trimming my file name before using it
        the smoking gnu

        Comment


        • #5
          Re: Reading in my stream file from IFS

          Strange, I just found that if i use the REN rename command and rename the file to itself
          RNM OBJ('/tmp/pricing/price7463035827705407.xml') NEWOBJ(price7463035827705407.xml)
          I am then able to use
          CPYFRMIMPF FROMSTMF('/tmp/pricing/price7463035827705407.xml') TOFILE(MYLIB/MYFILE) RCDDLM(*ALL).
          Now to chuck this in to my RPG as a very dirty fix.
          the smoking gnu

          Comment


          • #6
            Re: Reading in my stream file from IFS

            Ok. Alright. Talking to myself I know but just in case I or someone else comes down this path looking for clues.
            RNM OBJ('/tmp/pricing/price7463035827705407.xml') NEWOBJ(price7463035827705407.xml) did not work!
            However
            RNM OBJ('/tmp/pricing/price7463035827705407.xml ') NEWOBJ(price7463035827705407.xml) does work.

            The clue is in the blank spaces included in the file naming.

            My RPG has a standalone variable declared called FileName with length 50. The procedure WrtHtmlToStmf is being passed this file name and creating the file with full 50 characters including any blank space. This in turn is causing havoc when I try to open it, copy it, do anything with it.

            I have to make sure the file is created with the correct name without any trailing spaces. GLS you had it, I just thought I'd got it done already.
            Last edited by chrisr; June 11, 2012, 09:22 PM.
            the smoking gnu

            Comment

            Working...
            X