ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

FTP from CLLE IN *INPUT file

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

  • FTP from CLLE IN *INPUT file

    I need to FTP a file from the 400 to another box and I want to do it in a CLLE in a script fashion. I've done it before by creating a flat 80 character file with the FTP script code in it. Then by doing a ovrrdbf command to point to the file containing the script code. I forget the syntax of what needs to be in the *input file. I know username and password of the receiving maching and the FTP command, the IP address and the PUT statement. I'm looking for an example. God it's been years since I've done this, HELP!
    (*_*)

  • #2
    Re: FTP from CLLE IN *INPUT file

    Try something like the following for your INPUT file:

    PHP Code:
    user <userid> <password>
    verbose
    debug
    put 
    <FromFile> <ToFile>
    quit 
    Just create a blank Member file for your OUTPUT file. Then do something like this in your CLLE...

    PHP Code:
    ClrPfM     <SourcePF> <FTPOutput Member>
    OvrDbf     Input      <SourcePF> <FTPInput Member above>
    OvrDbf     Output     <SourcePF> <FTPOutput Member>
                                                    
    FTP        DNS <or IP>
                                                    
    DltOvr     *All 
    HTH

    -R

    Comment


    • #3
      Re: FTP from CLLE IN *INPUT file

      Thanks. I am trying the "*input" keyword on the override command because I need the ftp script file to be read but the editor doesn't like it so, maybe the iSeries won't let me do what I did on a 400 years ago. I'll keep trying.
      -Dan

      Comment


      • #4
        Re: FTP from CLLE IN *INPUT file

        There is no *INPUT keyword

        you just do the command as written above.

        ovrdbf INPUT (to file:whatever your script file is)
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: FTP from CLLE IN *INPUT file

          Dan,

          More than likely... you're not overriding to the correct location. Let me clarify a bit.
          1. Create a Source Physical File (CrtSrcPF MyLib/MySrc)
          2. Create a Source Member inside MySrc (StrSEU SrcFile(MyLib/MySrc) SrcMbr(FTPInput) Type(TXT))
          3. Edit the Source Member you just created (WrkMbrPDM Option 2)
          4. Enter the FTP commands you need to run to connect and do your job, then save (F3 <ENTER>) the Member
          5. In your CLLE program, you can now do the Override Command listed above with (OVRDBF MyLib/MySrc Mbr(FTPINPUT))
          6. Call the FTP <ftp address>
          7. Delete the Override (DltOvr *All)
          This will let you enter your FTP Commands into a Source file then run that source file as an INPUT file into your FTP command connecting to the FTP Address of your choice.

          As stated above, you can also Override to an FTPOUTPUT file (defined the same way as above) and this will catch all the Verbose/Debug and or log all your FTP commands so that you can trace your FTP job to validate completion and/or errors.

          Does this help?

          -Rick

          Comment


          • #6
            Re: FTP from CLLE IN *INPUT file

            Thank for you help!
            Yes there is no Asteric before the keyword INPUT, I found that out the hard way. I'm not sure why I thought there should be, brain fart MUCH!
            I remembered most of it but forgot some things. I actually found an example of code I wrote in 2000, the exact same thing. What are the odds that I would have saved that code.
            (*_*)
            Again thank you, you've been a big help, God bless.
            -Dan

            Comment


            • #7
              Re: FTP from CLLE IN *INPUT file

              Thanks I'm not sure why I thought there should be an "*", The last time I did this was 2000, I actually found that code. What are the odds.
              May all of your Camels have two humps 'k.
              (*_*)
              -Dan

              Comment


              • #8
                Re: FTP from CLLE IN *INPUT file

                Dan - glad I could help...but i think your last post cost me a bob cozzi book....

                I cant believe Im gonna support http://wwww.RPGIV.com

                and http://iseries.tv/

                I know now I may never see heaven

                take care

                hope to see many more post from you....

                jamie
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Re: FTP from CLLE IN *INPUT file

                  Comment


                  • #10
                    Re: FTP from CLLE IN *INPUT file

                    Originally posted by jamief View Post
                    Dan - glad I could help...but i think your last post cost me a bob cozzi book....

                    I cant believe Im gonna support http://wwww.RPGIV.com

                    and http://iseries.tv/

                    I know now I may never see heaven

                    take care

                    hope to see many more post from you....

                    jamie

                    Is there any way to trace if error happens in the FTP session, the CLLE retry every hour until it is succussfull transfered?

                    Thanks!

                    Comment


                    • #11
                      Re: FTP from CLLE IN *INPUT file

                      Originally posted by mapperkids View Post
                      Is there any way to trace if error happens in the FTP session, the CLLE retry every hour until it is succussfull transfered?

                      Thanks!
                      Well, you can try something like this:

                      PHP Code:
                                  PGM        PARM(&RETURN)                                       
                                                                                                  
                        
                      /*  &RETURN='Y' ==  TEXTSTRING '226 TRANSFER COMPLET'   */   
                                                                                                  
                                   
                      DCL        VAR(&MEMBERTYPE(*CHARLEN(10) +                  
                                                
                      VALUE(YOUR_OUTPUTFILE_OF_FTP)                                   
                                   
                      DCL        VAR(&RETURN) TYPE(*CHARLEN(1)                     
                                                                                                  
                                   
                      CHGVAR     VAR(&RETURN) VALUE(' ')                             
                        
                      /*  TXT-SOURCE OVERRIDE                                  */  
                                   
                      OVRDBF     FILE(MEMBERTOFILE(YOUR_SOURCEFILE_LIB/QCLSRC) +             
                                                
                      MBR(&MEMBER)                                      
                                   
                      CALL       PGM(CHECKFTPPARM(&RETURN)                         
                                   
                      DLTOVR     FILE(MEMBER)                                        
                                                                                                  
                                   IF         
                      COND(&RETURN *EQ 'N'THEN(DO)                      
                         
                      /*        SNDPGMMSG  MSG('whatever you want  +     */  
                         /*                     see LOG_File QCLSRC/YOUR_SOURCEFILE_LIB/' *CAT +   */  
                         /*                     &MEMBER *TCAT ' and so on +                        */  
                         /*                     blabla ') TOUSR(KUEMPI)                            */  
                                   
                      ENDDO                                                          
                                                                                                  
                                   ENDPGM 
                      and

                      PHP Code:
                           FMEMBER  IF  E                    DISK                                  
                           I            DS                                                         
                           I I            
                      '226 Transfer complet'    1  20 VERGL                    
                           I I            
                      '226 File receive OK.'   21  40 VERGL2                   
                           I I            
                      '226 File received ok'   41  60 VERGL3                   
                           I I            
                      '226 Closing data con'   61  80 VERGL4                   
                           I I            
                      '226-File succesfully'   81 100 VERGL5                   
                           C
                      *                                                                      
                           
                      C           *ENTRY    PLIST                                             
                           C                     PARM           PARA    1                          
                           C
                      *                                                                      
                           
                      C           *IN90     DOUEQ'1'                                          
                           
                      C                     READ MEMBER                   90                  
                           C   90                LEAVE                                             
                           C                     MOVELSRCDTA    VGLFLD 20                          
                           C           VERGL     IFEQ VGLFLD                     Transfer complet
                      ?
                           
                      C           VERGL2    OREQ VGLFLD                     File received?    
                           
                      C           VERGL3    OREQ VGLFLD                     File received?    
                           
                      C           VERGL4    OREQ VGLFLD                     Closing data..    
                           
                      C           VERGL5    OREQ VGLFLD                     Succesfully...  
                           
                      C                     MOVE 'Y'       PARA                YES!       
                           
                      C                     LEAVE                                        
                           C                     
                      ELSE                                         
                           
                      C                     MOVE 'N'       PARA                NONE!     
                           
                      C                     ENDIF                                        
                           
                      C                     ENDDO                                        
                           C
                      *                                                                 
                           
                      C                     MOVE *ON       *INLR                         
                           C
                      *                                                                 
                           
                      C                     RETRN 
                      Using is just as it is.
                      No support from my side...



                      kuempi

                      Comment


                      • #12
                        Re: FTP from CLLE IN *INPUT file

                        I got all the coding for the FTP done and done correctly, like I said I did this in 2000 and found that code. WOW!
                        Trial and error and I got it but it still didn't complete because of certification issues. Both the from and to machines did not have the same security protocols so once that was resolved it will work. I say it will work because I had to move on to another project. I'll get back to it once the user realizes the ball was dropped on this. Busy busy.
                        I was a consultant before hiring on with my current firm. I suggested, others did, it's ggod work if you can get it and now I have to code again and it's been a while. But I'm knocking the rust off and things are coming back. I've been at this for twenty years and one would think by now I would not have to code anymore, well you take the job, whatever it is cause there hasn't been very many AS/400 opportunites in Maryland and I mean for years so you got to do what you got to do right.
                        (*_*)
                        Thanks for all the responses.
                        -Dan

                        Comment

                        Working...
                        X