• 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
    anta Technologies

    The Leader in IBM i Education!
    Need training on anything i?
    Manta is all you need.

    Back To School Sale: Save 20% off any Manta Combination Package, including the complete IBM i Training Library. Ends October 31.

    130 courses and competency exams on:
    · IBM i operations
    · System Management and Security
    · IBM i Programming Tools
    · Programming in RPG, COBOL, CL, Java
    · Web Development

    SQL, DB2, QueryProduct features:
    · Runs in every popular browser
    · Available 24/7/365
    · Free Student Reference Guides
    · Free Student Administration
    · Concurrent User License
    · Built-In IBM i Simulator

    You can download our 200-page catalog and take sample sessions at MantaTech.com

    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

  • AI Is Coming for ERP. How Will IBM i Respond?
  • The Power And Storage Price Wiggling Continues – Again
  • LaserVault Adds Multi-Path Support To ViTL
  • As I See It: Spacing Out
  • IBM i PTF Guide, Volume 27, Numbers 34, 35, And 36
  • 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

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