fhg
Volume 6, Number 35 -- September 27, 2006

Copy a Subset of Records from One System to Another

Published: September 27, 2006

by Ted Holt

Recently, I needed an easy way to refresh a development system with a subset of records from a file on a production system. I needed a method that I could run unattended, during off hours. FTP, the Save-Restore commands, and the third-party file transfer utilities available to me are good tools, but they have their drawbacks. All of them require me to transfer complete files, even if I only want to transfer a subset of records. And it is difficult to determine whether FTP succeeds or fails in a batch job. I found an easy way to accomplish my goal.

First I created a DDM file on the production system to point to the target system.

CRTDDMF FILE(MYLIB/MYDATA) RMTFILE(MYLIB/MYDATA) +
   RMTLOCNAME(DEVELOP *SNA)

I chose to give the DDM file the same name as the production file. In this example, I use the file name MYDATA. So, DDM file MYLIB/MYDATA on the production system points to file MYLIB/MYDATA on system DEVELOP.

To refresh the file on the development system requires me to run a simple Copy File (CPYF) command on the production system. Here I copy from the production database to the DDM file, selecting records in batch 151 only.

CPYF FROMFILE(PRODUCTION/MYDATA) TOFILE(MYLIB/MYDATA) +
   MBROPT(*REPLACE) INCREL((*IF BATCH *EQ 151))

Or, I can use the Copy from Query File (CPYFRMQRFY) command.

OPNQRYF FILE((PRODUCTION/MYDATA)) QRYSLT('batch=170')   
CPYFRMQRYF FROMOPNID(MYDATA) TOFILE(MYLIB/MYDATA) MBROPT(*REPLACE)
CLOF OPNID(MYDATA)

RELATED STORIES

The Save-Restore Commands

More About the SAVRSTxxx Commands



Sponsored By
T.L. ASHFORD

BARCODE400 by T.L. Ashford is the easiest, fastest way to create and print Compliance Labels directly from the AS/400 and iSeries.

Ashford's comprehensive library of Compliance formats is available to Barcode400 users. AIAG labels for Ford and Motorcraft, GM, and many more are available.

BARCODE400 is backed by the best Technical Support Team in the industry.

FREE Guide to Bar Code Labeling
www.tlashford.com
or call 800.541.4893



Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

nuBridges:  Leading provider of secure FTP on the iSeries
New Generation Software:  Leading provider of iSeries BI and financial management software
COMMON:  Join us at the Spring 2007 conference, April 29 – May 3, in Anaheim, California

 


 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement