Tip

Merge two keyed physical files

I have created a utility that will merge any two keyed physical files on the AS/400 or iSeries. This is something that will get around copying together two files that are the same and have duplicate keys.

This utility uses a psuedo type of AI, as it figures out what the keys are for the file, creates an RPG program on the fly, compiles it and executes it to merge the two files. It has saved us many times when wanting to update a file with data but also save the old or new depending on which is the receiving library.

This utility uses a prompt screen that allows the user to only have to type in the file name and the From and To library name and press F6 to submit the job. Presto Mergeo -- and it is done.

Below are links for PDF documents for each source and one Word document needed for the Message file that needs to be set up.

The program MRGFILR1 is the Prompt screen program. This is where the user types in the file name and the From and To library. Most everything is self-explanatory on how to use it and what it does.

Just setup the source and compile, the MRGSKEL cannot be compiled, as it is what is used to create the program on the fly and it is commented to that fact.

Here is the PDM list of objects:

CMSGLE           CLLE        Merge 2 files: Clear MSGQ (Message Queue)     
MRGCKFLCL      CLP         Merge 2 files: Check if valid File/Library    
MRGCMPL        CLP         Merge 2 files: Compile created program        
MRGCRTCL       CLP         Merge 2 files: Create RPGLE program on the fly
MRGFILDF        DSPF        Merge 2 files: Display file                   
MRGFILECL       CLP         Merge 2 files: Run complete process           
MRGFILR1        RPGLE      Merge 2 files: Prompt                         
MRGGENPGM   RPGLE      Merge 2 files: Create RPGLE program from Skel 
MRGSKEL        RPGLE       Merge 2 files: Skeleton Merge program NO COMPILE
MRGSUBMIT    CLP          Merge 2 files: Submit Merge                      
SMSGLE          CLLE         Merge 2 files: Send message to (Message Queue)   
  

Have fun.

Source files and Word document

CMSGLE
MRGCKFLCL
MRGCMPL
MRGCRTCL
MRGFILDF
MRGFILECL
MRGFILR1
MRGGENPGM
MRGMSGF
MRGSKEL
MRGSUBMIT
SMSGLE


This was first published in January 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

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.