ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SCP - IFS file stopped working

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

  • SCP - IFS file stopped working

    I am SO confused! I have a CL program that was working fine. It copies a file to an IFS file named openpo.csv.
    The job is running under a special ID created just for this job. I originally was submitting that job with USER = my special ID and it worked. Today, I am signed on as that ID and it won't work. After some searching online (thank you, again, Mr. Scott Klement and Mr. Tom Liotta!) I found a way to see more in the error message than "it didn't work".

    It says it can't find my IFS file /home/userid/sharedfiles/openpo.csv

    I'm looking at it!

    Does anyone have any ideas on what I can check or change? We are in TESTING and this goes live on April 1!!! I am really worried. No one here has experience with this. I've been fortunate that I was able to find information on here and Google and that the receiving company's VENDOR for their SERVER had experience with this and was willing to help me.

    Can you say panic attack?

    Breathing.... breathing

    OK - Here is the code with the IP address changed, of course:


    PHP Code:
         CPYTOIMPF  FROMFILE(*LIBL/IRC006PF) +                         
                     
    TOSTMF('/home/user/sharedfiles/openpo.csv +     
                      '
    MBROPT(*REPLACESTMFCODPAG(*PCASCII) +       
                      
    RCDDLM(*CRLFDTAFMT(*DLMSTRDLM(*NONE) +       
                      
    NUMFLDPAD(*ZERO)                                 

     
    CHGVAR     VAR(&CMD) +                                        
                  
    VALUE('PATH=$PATH:/QOpenSys/usr/bin  &&  +       
                  scp -P 990 +                                     
                  "/home/user/sharedfiles/openpo.csv" +          
                  masterbrand@00.000.000.000:"in/openpo.csv"'
    )     

     
    ADDENVVAR  ENVVAR(QIBM_QSH_CMD_OUTPUTVALUE(NONE) +          
                  
    REPLACE(*YES)                                    
     
    ADDENVVAR  ENVVAR(QIBM_QSH_CMD_ESCAPE_MSGVALUE(Y) +         
                  
    REPLACE(*YES)                                    


      
    QSH CMD(&CMD

  • #2
    I'm guessing it has to be an authority issue. What does Work With Authority show you for home, user, and the file itself?

    Comment


    • #3
      Who would have guessed? UNIX apparently didn't like the ".csv" on my file name. I took that off, and it worked. <annoyed grunt> Thank you! I guess sometimes it helps to just spell it out to someone else and walk away for a while.

      Comment


      • #4
        Which one did you remove? It was in there twice. You may have fixed your problem but I don't think it was because of .csv - unless your target system has some custom code that precludes the use of file extensions.
        You migth want to look a bit deeper to fully understand the cause. Hopefully Scott or someone who understands Unix/Linux better than me can see something.

        scp is a standard copy command and there are some oddities in the way you've used it. For example the double-quotes don't appear to be needed as there are no embedded blanks in the string.

        Comment


        • #5
          Why wouldn't it like a name ending in .csv? I've used that thousands of times from IBM i to Unix machines, it has never minded.

          Your example has a hard coded path of /home/user/sharedfiles -- this makes zero sense to me. Do you really have all of your users log in under a single user profile named "user"?!

          Comment


          • #6
            Originally posted by Scott Klement View Post
            Why wouldn't it like a name ending in .csv? I've used that thousands of times from IBM i to Unix machines, it has never minded.

            Your example has a hard coded path of /home/user/sharedfiles -- this makes zero sense to me. Do you really have all of your users log in under a single user profile named "user"?!
            Scott -
            I don't know why. I just know when I dropped the .csv, it worked. As for "user", I just took out the actual user name for the post. We DO have a specific user ID for this process.

            I really have NO clue and have cobbled together something that works from various documents I've found - including your presentation.

            Now, I have to figure out how to delete a file after I pull it in to our system .


            What I have now is this:
            PHP Code:
                 CPYTOIMPF  FROMFILE(*LIBL/IRC006PF) +                         
                             
            TOSTMF('/home/user/sharedfiles/openpo +     
                              '
            MBROPT(*REPLACESTMFCODPAG(*PCASCII) +       
                              
            RCDDLM(*CRLFDTAFMT(*DLMSTRDLM(*NONE) +       
                              
            NUMFLDPAD(*ZERO)                                 

             
            CHGVAR     VAR(&CMD) +                                        
                          
            VALUE('PATH=$PATH:/QOpenSys/usr/bin  &&  +       
                          scp -P 990 +                                     
                          "/home/user/sharedfiles/openpo" +          
                          masterbrand@00.000.000.000:"in/openpo"'
            )     

             
            ADDENVVAR  ENVVAR(QIBM_QSH_CMD_OUTPUTVALUE(NONE) +          
                          
            REPLACE(*YES)                                    
             
            ADDENVVAR  ENVVAR(QIBM_QSH_CMD_ESCAPE_MSGVALUE(Y) +         
                          
            REPLACE(*YES)                                    


              
            QSH CMD(&CMD
            I understand that this probably isn't the best way to do this. I'm in an environment that says things like: 'Marketing wants to do be able to go to Mars in a week - make it happen'. To top it off, our security is so tight, I can't get to your presentations except from home!

            I'm done whining now. Thank you for all your help and all your information!!

            Comment

            Working...
            X