• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Copy a Subset of Records from One System to Another

    September 27, 2006 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

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Midrange Dynamics North America

    Want to deliver DevOps on IBM i?

    DevOps enables your IBM i development teams to shorten the software development lifecycle while delivering features, fixes, and frequent updates that are closely aligned with business objectives. Flexible configuration options within MDChange make it easy to adapt to new workflow strategies and policies as you adopt DevOps practices across your organization.

    Learn More.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    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

    The Web, the Workplace, and IBM’s Updated Content Management Software Bang for the Buck: Big Iron Boxes, Even Bigger Bucks

    Leave a Reply Cancel reply

Volume 6, Number 35 -- September 27, 2006
THIS ISSUE SPONSORED BY:

T.L. Ashford
WorksRight Software
Asymex

Table of Contents

  • Copy a Subset of Records from One System to Another
  • Stuffing Five Digits Into Four
  • Admin Alert: Setting the Record Straight on iSeries Access and ODBC Freeware

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • The Power11 Transistor Count Discrepancies Explained – Sort Of
  • Is Your IBM i HA/DR Actually Tested – Or Just Installed?
  • Big Blue Delivers IBM i Customer Requests In ACS Update
  • New DbToo SDK Hooks RPG And Db2 For i To External Services
  • IBM i PTF Guide, Volume 27, Number 33
  • Tool Aims To Streamline Git Integration For Old School IBM i Devs
  • IBM To Add Full System Replication And FlashCopy To PowerHA
  • Guru: Decoding Base64 ASCII
  • The Price Tweaking Continues For Power Systems
  • IBM i PTF Guide, Volume 27, Numbers 31 And 32

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle