• 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

    Git up to speed with MDChange!

    Git can be lightning-fast when dealing with just a few hundred items in a repository. But when dealing with tens of thousands of items, transaction wait times can take minutes.

    MDChange offers an elegant solution that enables you to work efficiently any size Git repository while making your Git experience seamless and highly responsive.

    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

  • Public Preview For Watson Code Assistant for i Available Soon
  • COMMON Youth Movement Continues at POWERUp 2025
  • IBM Preserves Memory Investments Across Power10 And Power11
  • Eradani Uses AI For New EDI And API Service
  • Picking Apart IBM’s $150 Billion In US Manufacturing And R&D
  • FAX/400 And CICS For i Are Dead. What Will IBM Kill Next?
  • Fresche Overhauls X-Analysis With Web UI, AI Smarts
  • Is It Time To Add The Rust Programming Language To IBM i?
  • Is IBM Going To Raise Prices On Power10 Expert Care?
  • IBM i PTF Guide, Volume 27, Number 20

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