CL program for submitting the Batch FTP job in IBM i(AS400)

CL program for submitting the Batch FTP job in IBM i(AS400)
CL program for submitting the Batch FTP job in IBM i(AS400), ftp, file transfer protocol, batch ftp, batch ftp in ibmi, batch ftp in as400, sbmjob, cl command, schedule a batch ftp job in as400 ibmi, CL progam using SBMJOb command to submit FTP bacth job in batch in ibmi as400, wrkusrjob, call, SCDDATE,SCDTIME,CL program for submitting batch FTP job,CL program that submits the
FTP BATCH job,To schedule the file transfers and run them in unattended mode,ibmi, as400, as400 tutorial, ibmi tutorial, as400 and sql tricks, ftp tutorial, cl tutorial, cl programming, using cl commands
CL program for submitting the Batch FTP job in IBM i(AS400)

We can submit the batch FTP job in Batch using CL command SBMJOB. Also, we can schedule the FTP job to run on some particular day and time.

Let's schedule the FTP job on Sunday morning at 06 AM 30 mins 20 sec IST.

CL program for submiiting the batch FTP job

             PGM                                                        
             SBMJOB     CMD(CALL PGM(FTP_BCH)) JOB(FTP_SCHDUL) +        
                          JOBQ(QBATCH) SCDDATE(*SUN) SCDTIME(063020)    
             ENDPGM

The program FTP_BCH being called using SBMJOB comamnd in above program can be seen in this article Batch FTP in IBM i.

Compile the batch program

Compile the program either using option 14 on source member or using CL command CRTBNDCL.

Run the batch program

Execute the batch program from IBM i command line using command CALL FTP_BCH_SB. Here,FTP_BCH_SB is the name of the program.

Check the Submitted Job

Check the Submitted Job using CL command WRKUSRJOB.

                             Work with User Jobs                     
                                                        05/12/22  04:
Type options, press Enter.                                           
  2=Change   3=Hold   4=End   5=Work with   6=Release   7=Display mes
  8=Work with spooled files   13=Disconnect                          
                                                                     
                                                                     
Opt  Job         User        Type     -----Status-----  Function     
     FTP_SCHDUL  EASYCLASS   BATCH    SCD                            
     QPAD033953  EASYCLASS   INTER    ACTIVE            CMD-WRKUSRJOB

Take option 5 on the scheduled job FTP_SCHDUL to work with the job.Then, take option 1 to display the Job status attributes.

                                 Work with Job                 
                                                             Sy
 Job:   FTP_SCHDUL     User:   EASYCLASS      Number:   304481 
                                                               
 Select one of the following:                                  
                                                               
      1. Display job status attributes                         
      2. Display job definition attributes                     
      3. Display job run attributes, if active                 
      4. Work with spooled files                               
                                                               
     10. Display job log, if active, on job queue, or pending  
     11. Display call stack, if active                         
     12. Work with locks, if active                            
     13. Display library list, if active                       
     14. Display open files, if active                         
     15. Display file overrides, if active                     
     16. Display commitment control status, if active          
                                                               
 Selection or command                                          
 ===> 1                                                        

Display job status attributes

                        Display Job Status Attributes        
                                                            S
Job:   FTP_SCHDUL     User:   EASYCLASS      Number:   304481
                                                             
Status of job . . . . . . . . . . . . . . . :   SCD          
Current user profile  . . . . . . . . . . . :                
Job user identity . . . . . . . . . . . . . :   EASYCLASS    
  Set by  . . . . . . . . . . . . . . . . . :     *DEFAULT   
Entered system:                                              
  Date  . . . . . . . . . . . . . . . . . . :   05/12/22     
  Time  . . . . . . . . . . . . . . . . . . :   04:37:56     
Scheduled:                                                   
  Date  . . . . . . . . . . . . . . . . . . :   05/15/22     
  Time  . . . . . . . . . . . . . . . . . . :   06:30:20     
Started:                                                     
  Date  . . . . . . . . . . . . . . . . . . :                
  Time  . . . . . . . . . . . . . . . . . . :                
Subsystem . . . . . . . . . . . . . . . . . :                
  Subsystem pool ID . . . . . . . . . . . . :                
                                                             
Press Enter to continue.                                     

Batch program Output

Once the scheduled job got executed on its allotted date and time. The ftp log output will be logged to OUTPUT ftp message file and the source member will be ftped to the respective location if no error occurs and ftp is successful.

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain