Home > AS/400 Tips > iSeries programmer tips > Dynamically change batch FTP script
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Dynamically change batch FTP script


baskar VISWANATHAN
03.19.2004
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


At my clients place, we FTP an e-mail file to a third-party vendor daily; this happens as a batch process. The vendor wants the file to be suffixed with the current date, so they can standardize the input. But, batch FTP needs the script in a PF member. To change the file name in the FTP input script (PF/Member), we used a FREEWARE-SQLSTM to update the statement in the script with the current date.

This below method can be used for changing the script dynamically -- if you are already using the batch FTP process.

CUSTLIB/INPUT - FTP INPUT file (File with SCRIPT)
CUSTLIB/EMAILPF -- E-mail file, that needs to be sent via FTP to the Client
Flmmddyy.txt - Filename on the Client side
SQLSTM - SQL command that runs in the CL. (There are several utilities which offer a way to execute SQL via a standard command interface)



Code

 
0146.00 /* SET THE OUT FILE ON CLIENT SIDE AS "FLmmddyy.txt" */             
0147.00            RTVJOBA    DATE(&DATE)

0148.00            CHGVAR   &VAR1 (&DATE *CAT '.TXT')

0149.00            CHGVAR     VAR(&STMT) VALUE('UPDATE CUSTLIB/INPUT + 
0150.00                         SET FTPINPUT = ''PUT CUSTLIB/EMAILPF +

0151.00                           FL' *CAT &VAR1 *TCAT ''' +           
0152.00                        WHERE SUBSTR(FTPINPUT,1,3) = ''PUT''  ')     
0153.00

0154.00              SQLSTM     CMD(&STMT)

0155.00

 


FTP INPUT File (Script for FTP)

Display Physical File Member  CUSTLIB/INPUT
FTPINPUT is the only field with 80 chars.
                        
 File . . . . . . :   INPUT              Library  . . . . :   SONOMA

 Member . . . . . :   INPUT              Record . . . . . :   1

 Control  . . . . .                       Column . . . . . :   1

 Find . . . . . . .

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7.
userid password

SENDPASV 0

PUT INPUT/CUSTLIB Flmmddyy.TXT                                       
QUIT

                           ****** END OF DATA ******

 

Note: Search the Search400.com tips section on how to FTP from iSeries. Interactively, batch, etc.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries CL programming
Taking advantage of CL advancements, starting with V5R3
Checking in on your IBM i authorization lists
Running PHP open source applications: NOBODY needs authority
Simplify the process of converting a spool file from iSeries into an Excel spreadsheet
CL program for daily backups
An automated CL method of moving a query from AS/400 to Excel
Changing user password expiration
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Advanced Job Scheduler help

iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

Application Development
iSeries calling an .exe
Top 10 programmer tips
Formatted work job scheduler
Convert system date and time
Mixing free format code with embedded SQL
SQL update a field in one file from a field in another file
Webcasts for iSeries programmers
Programming advice from the pros
Easy code copying via the drag and drop method
Setting FTP time-outs

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts