File Merge or Concatenate
Files with Different Record Lengths
  Table of Contents  v-24.01.01 - mrgcpy01.htm 
  Introduction
  JCL Members
  Append Files using IEBGENER
  Append Files using IDCAMS
  Append Files using SORT
  Merge Files using ICETOOL
  Preparation
  Create Three Test Files
  Diagnostic Aids
  Hex-Dump for IEBGENER File
  Hex-Dump, JCL Member
  Hex-Dump, Sample Output
  Hex-Dump for IDCAMS File
  Hex-Dump, JCL Member
  Hex-Dump, Sample Output
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This suite of programs will describe and demonstrate how to merge or append (concatenate) multiple files of various record lengths into a single file. For example, the first file is a sequential file with fixed-length records of 80 bytes. The second file is a sequential file with fixed-length records of 60 bytes. The third file is a sequential file with fixed-length records of 40 bytes.

This package includes a job (JCL Member) that will create the test files. The techniques for merging or appending the files will use IEBGENER, IDCAMS, ICETOOL, ICEMAN, DFSORT or SORT.

Note:  The jobs in this suite of programs would be much simpler if all the input files had the same characteristics (i.e. the same file type with the same record length).

Within the scope of this document we will use the term "merge" when the task will actually merge the files and intersperse the individual records of the files based on the content of a user-defined field within each record. This approach requires the input files to be sorted into sequence based on the content of the user-defined field.

Within the scope of this document we will use the term "append" when the task simply copies the first file to a new file and then appends the second and third file to the end of the new file. The sequence of the records will be the same as the sequence within the original files. The technique may be referred to as file concatenation.

The process of merging or appending files is fairly simple when all the input files have the same characteristics or properties such as file type and record length. It does require extra consideration if the file properties or record lengths are different. This document uses files with different record lengths.

1. MRGCPYJ1 - this job will use IEBGENER to append the three files together into one file.
2. MRGCPYJ2 - this job will use the REPRO function of IDCAMS to concatenate the three files into one file.
3. MRGCPYJ3 - this job will use SORT with concatenated SORTIN files to copy the three files into one file.
4. MRGCPYJ4 - this job will use ICETOOL/ICEMAN with multiple SORTIN01, SORTIN02 and SORTIN03 to merge the three files into one file.
5. MRGCPYJ8 - this job will use IEBGENER to create the three files to be used as input for the merge jobs.

 


We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.

Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section JCL Members

This section describes the JCL Members included with this suite of programs.

Table of Contents Previous Section Next Section Append Files using IEBGENER

This batch job (MRGCPYJ1) uses a single JCL member (MRGCPYJ1,jcl) with multiple job steps to merge the records from three (3) input file with different record lengths into a single file with a record length that is equal-to the largest record size of the input files.

The following is a description for each job step following by a listing of the JCL Member.

1. JOBSETUP, this job step will delete any previously created files.
1.1. Executes IEFBR14 program.
1.2. Uses a disposition of (MOD,DELETE,DELETE) to delete a file.
2. CREATES1, this job step will create a new file using IEBGENER.
2.1. Execute IEBGENER to copy 80-byte file to new 80-byte output file.
2.2. Use DISP=(NEW,KEEP,KEEP) to create a new output file with 80-byte fixed-length records.
3. APPENDS2, this job step will append to a file using IEBGENER.
3.1. Execute IEBGENER to append 60-byte file to the new 80-byte file.
3.2. Use DISP=(MOD,KEEP,KEEP) to append records to the existing 80-byte file.
3.3. Pad remainder of output record (61-80) with spaces.
4. APPENDS3, this job step will append to a file using IEBGENER.
4.1. Execute IEBGENER to append 40-byte file to the new 80-byte file.
4.2. Use DISP=(MOD,KEEP,KEEP) to append records to the existing 80-byte file.
4.3. Pad remainder of output record (41-80) with spaces.

 

 

The following (MRGCPYJ1.jcl) is the JCL Member.

//MRGCPYJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       MRGCPYJ1.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Merge three files into one file using IEBGENER.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously created files.
//* Step 2, CREATES1 will create a new file using IEBGENER.
//* Step 3, APPENDS2 will append to a file using IEBGENER.
//* Step 4, APPENDS3 will append to a file using IEBGENER.
//*
//* This job will run on a Mainframe System under ZOS or a Linux,
//* UNIX or Windows System and Micro Focus Enterprise Developer.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to use JCL and IEBGENER to copy/create
//*    a file with 80-byte fixed length records.
//* 3. Demonstrate how to use JCL and IEBGENER to append records to a
//*    sequential file with 80-byte, fixed-length records. The input
//*    file is a sequential file with 60-byte fixed-length records.
//* 4. Demonstrate how to use JCL and IEBGENER to append records to a
//*    sequential file with 80-byte, fixed-length records. The input
//*    file is a sequential file with 40-byte fixed-length records.
//*
//* *******************************************************************
//* Step 1 of 4, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//MRGOUTD1 DD  DSN=SIMOTIME.DATA.MRGOUTD1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//MRGOUTX1 DD  DSN=SIMOTIME.DATA.MRGOUTX1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 4, Copy 80-byte file to new 80-byte output file...
//*
//CREATES1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRG080D1,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRGOUTD1,
//             DISP=(NEW,KEEP,KEEP),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 3 of 4, Append 60-byte records to current 80-byte output file,
//*              pad remainder of output record with spaces.
//*
//APPENDS2 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 GENERATE MAXFLDS=2,MAXLITS=20
 RECORD FIELD=(60,1,,1),FIELD=(20,'                    ',,61)
/*
//*
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRG060D1,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRGOUTD1,
//             DISP=(MOD,KEEP,KEEP),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 4 of 4, Append 40-byte records to current 80-byte output file,
//*              pad remainder of output record with spaces.
//*
//APPENDS3 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 GENERATE MAXFLDS=2,MAXLITS=40
 RECORD FIELD=(40,1,,1),
        FIELD=(40,'                                        ',,41)
/*
//*
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRG040D1,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRGOUTD1,
//             DISP=(MOD,KEEP,KEEP),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//

Table of Contents Previous Section Next Section Append Files using IDCAMS

This batch job (MRGCPYJ2) uses a single JCL member (MRGCPYJ2.jcl) with multiple job steps to merge the records from three (3) input file with different record lengths into a single file with a record length that is equal-to the largest record size of the input files.

The following is a description for each job step following by a listing of the JCL Member.

1. JOBSETUP, this job step will delete any previously created files.
1.1. Executes IEFBR14 program.
1.2. Uses a disposition of (MOD,DELETE,DELETE) to delete a file.
2. UTCONVS2, this job step will create a new file using IEBGENER.
2.1. Execute IEBGENER to copy a 60-byte file to new 80-byte output file.
2.2. The output file is a Temporary Data Set and will only exist for the duration of the job.
2.3. Pad remainder of output record (61-80) with spaces.
3. UTCONVS3, this job step will create a new file using IEBGENER.
3.1. Execute IEBGENER to copy a 40-byte file to the new 80-byte file.
3.2. The output file is a Temporary Data Set and will only exist for the duration of the job.
3.3. Pad remainder of output record (41-80) with spaces.
4. APPEND03, this job step will concatenated three (3) files into a single file using IDCAMS.
4.1. Execute IDCAMS and perform the REPRO function
4.2. Concatenated DD statements are used for input.

 

 

The following (MRGCPYJ2.jcl) is the JCL Member.

//MRGCPYJ2 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       MRGCPYJ2.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Use IDCAMS to Merge Three Files into one file.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously created file.
//* Step 2, UTCONVS2 use IEBGENER to convert 60-byte file to 80-byte.
//* Step 3, UTCONVS3 use IEBGENER to convert 40-byte file to 80-byte.
//* Step 4, APPEND03 append or concatenate three (3) files into 1 file.
//*
//* This job will run on a Mainframe System under ZOS or a Linux,
//* UNIX or Windows System and Micro Focus Enterprise Developer.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to use IEBGENER to convert a file with 60-byte
//*    records to a file with 80-byte records. The output file is
//*    defined as a Temporary Data Set and will only exist for the
//*    duration of the job.
//* 2. Demonstrate how to use IEBGENER to convert a file with 40-byte
//*    records to a file with 80-byte records. The output file is
//*    defined as a Temporary Data Set and will only exist for the
//*    duration of the job.
//* 4. Demonstrate how to merge 3 files into 1 file, use concatenated
//*    data files and IDCAMS REPRO.
//*
//* *******************************************************************
//* Step 1 of 4, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//MRGOUTD2 DD  DSN=SIMOTIME.DATA.MRGOUTD2,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 4, Read a File with 60-byte records,
//*              write to file of 80-byte records...
//*
//UTCONVS2 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 GENERATE MAXFLDS=2,MAXLITS=20
 RECORD FIELD=(60,1,,1),FIELD=(20,'                    ',,61)
/*
//*
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRG060D1,DISP=SHR
//SYSUT2   DD  DSN=&&MRG060T1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 3 of 4, Read a File with 40-byte records,
//*              write to file of 80-byte records...
//*
//UTCONVS3 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 GENERATE MAXFLDS=2,MAXLITS=40
 RECORD FIELD=(40,1,,1),
        FIELD=(40,'                                        ',,41)
/*
//*
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRG040D1,DISP=SHR
//SYSUT2   DD  DSN=&&MRG040T1,
//             DISP=(NEW,CATLG,KEEP),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 4 of 4, Use the REPRO function of IDCAMS to merge three (3)
//*              files into one (1) file.
//*              Concatenated data files may be used as input since all
//*              the files to be merged are now the same record length.
//*
//APPEND03 EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRG080D1,DISP=SHR
//         DD  DSN=&&MRG060T1,DISP=SHR
//         DD  DSN=&&MRG040T1,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRGOUTD2,
//             DISP=(NEW,CATLG,KEEP),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//SYSIN DD *
 REPRO                 -
  INFILE(SYSUT1)       -
  OUTFILE(SYSUT2)
/*
//*
//

Table of Contents Previous Section Next Section Append Files using SORT

This example uses a single JCL member (MRGCPYJ3.jcl) to append (or concatenate) three (3) input files with different record lengths into a single file with a record length that is equal-to or greater-than the largest record size of the input files.

This batch job (MRGCPYJ3) uses a single JCL member (MRGCPYJ3.jcl) with multiple job steps to append (or concatenate) three (3) input files with different record lengths into a single file with a record length that is equal-to the largest record size of the input files.

The following is a description for each job step following by a listing of the JCL Member.

1. JOBSETUP, this job step will delete any previously created files.
1.1. Executes IEFBR14 program.
1.2. Uses a disposition of (MOD,DELETE,DELETE) to delete a file.
2. UTCONVS2, this job step will create a new file using SORT.
2.1. Execute SORT to copy a 60-byte file to new 80-byte output file.
2.2. The PAD Character for the remainder of output record (61-80) may be low-values or spaces depending on the System Configuration.
3. UTCONVS3, this job step will create a new file using IEBGENER.
3.1. Execute SORT to copy a 40-byte file to new 80-byte output file.
3.2. The PAD Character for the remainder of output record (61-80) may be low-values or spaces depending on the System Configuration.
4. APPEND03, this job step will concatenated three (3) files into a single file using SORT.
4.1. Execute SORT using the FIELDS=COPY function.
4.2. Concatenated DD statements are used for input.

 

 

The following (MRGCPYJ3.jcl) is the JCL Member.

//MRGCPYJ3 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       MRGCPYJ3.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Merge three files into one file using SORT.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously created file.
//* Step 2, UTCONVS2 will convert 60-byte LRECL to 80-byte LRECL.
//* Step 3, UTCONVS3 will convert 40-byte LRECL to 80-byte LRECL.
//* Step 4, APPEND03 will merge 3 files into one (1) using SORT.
//*
//* This job uses instream sorting specifications.
//*
//* This job will run on a Mainframe System under ZOS or a Linux,
//* UNIX or Windows System and Micro Focus Enterprise Developer.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to use JCL with the SORT program to convert
//*    a file with 60-byte fixed length records to a file with 80-byte
//*    fixed length records.
//* 3. Demonstrate how to use JCL with the SORT program to convert
//*    a file with 40-byte fixed length records to a file with 80-byte
//*    fixed length records.
//* 4. Demonstrate how to use JCL with the SORT program to append
//*    or concatenate three (3) files into a single file. The SORTIN
//*    will use concatenated DD statements.
//*
//* *******************************************************************
//* Step 1 of 4, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//MRGOUTD3 DD  DSN=SIMOTIME.DATA.MRGOUTD3,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//MRG060T1 DD  DSN=SIMOTIME.DATA.MRG060T1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//MRG040T1 DD  DSN=SIMOTIME.DATA.MRG040T1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 4, Convert Sequential file with 60-byte records
//*              to a Sequential file with 80-byte records...
//*
//UTCONVS2 EXEC PGM=SORT,
//             REGION=1024K
//SYSIN    DD  *
* ..:....1....:....2....:....3....:....4....:....5....:....6....:....7.
         SORT FIELDS=COPY
         INREC FIELDS=(1:1,60)
         OUTREC FIELDS=(1:1,60)
/*
//SORTIN   DD  DSN=SIMOTIME.DATA.MRG060D1,DISP=SHR
//SORTOUT  DD  DSN=SIMOTIME.DATA.MRG060T1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*
//* *******************************************************************
//* Step 3 of 4, Convert Sequential file with 40-byte records
//*              to a Sequential file with 80-byte records...
//*
//UTCONVS3 EXEC PGM=SORT,
//             REGION=1024K
//SYSIN    DD  *
* ..:....1....:....2....:....3....:....4....:....5....:....6....:....7.
         SORT FIELDS=COPY
         INREC FIELDS=(1:1,40)
         OUTREC FIELDS=(1:1,40)
/*
//SORTIN   DD  DSN=SIMOTIME.DATA.MRG040D1,DISP=SHR
//SORTOUT  DD  DSN=SIMOTIME.DATA.MRG040T1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*
//* *******************************************************************
//* Step 4 of 4, Merge the three (3) files into one (1) file,
//*              Concatenated data files may be used as input since all
//*              the files to be merged are now the same record length.
//*
//APPEND03 EXEC PGM=SORT,
//             REGION=1024K
//SYSIN    DD  *
* ..:....1....:....2....:....3....:....4....:....5....:....6....:....7.
         SORT FIELDS=COPY
         INREC FIELDS=(1:1,80)
         OUTREC FIELDS=(1:1,80)
/*
//SORTIN   DD  DSN=SIMOTIME.DATA.MRG080D1,DISP=SHR
//         DD  DSN=SIMOTIME.DATA.MRG060T1,DISP=SHR
//         DD  DSN=SIMOTIME.DATA.MRG040T1,DISP=SHR
//SORTOUT  DD  DSN=SIMOTIME.DATA.MRGOUTD3,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*
//

Table of Contents Previous Section Next Section Merge Files using ICETOOL

This batch job (MRGCPYJ4) uses a single JCL member (MRGCPYJ4.jcl) with multiple job steps to merge the records from three (3) input file with different record lengths into a single file with a record length that is equal-to the largest record size of the input files.

The following is a description for each job step following by a listing of the JCL Member.

1. JOBSETUP, this job step will delete any previously created files.
1.1. Executes IEFBR14 program.
1.2. Uses a disposition of (MOD,DELETE,DELETE) to delete a file.
2. UTCONVS2, this job step will create Temporary Data Sets using ICEMAN.
2.1. Execute ICEMAN with two copy statements.
2.1.1. Copy a 60-byte file to new 80-byteTemporary Data Set.
2.1.2. Copy a 40-byte file to new 80-byteTemporary Data Set.
2.2. The PAD Character for the remainder of output record (61-80) may be low-values or spaces depending on the System Configuration.
3. MERGES03, this job step will concatenated three (3) files into a single file using ICEMAN.
3.1. Execute ICEMAN and perform the MERGE function
3.2. Multiple DD statements are used for SORTIN01, SORTIN02 and SORTIN03.
3.3. SYSIN must contain the MERGE statement. For example: MERGE FIELDS=(7,8,CH,A)

 

 

The following (MRGCPYJ4.jcl) is the JCL Member.

//MRGCPYJ4 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       MRGCPYJ4.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Merge three files into one file using SORT.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously created file.
//* Step 2, UTCONVS2 will use SORT with multiple inputs.
//* Step 3, MERGES03 will use ICEMAN with multiple inputs.
//*
//* This job uses instream sorting specifications.
//*
//* This job will run on a Mainframe System under ZOS or a Linux,
//* UNIX or Windows System and Micro Focus Enterprise Developer.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to use JCL with the ICETOOL program to convert
//*    the  file with 60-byte fixed length records and the file with
//*    40-byte fixed length records into two Temporary Data Sets with
//*    80-byte fixed length records.
//* 3. Demonstrate how to use JCL with the ICEMAN program to merge
//*    three (3) files into one (1) file. This SORT step will use the
//*    multiple SORT input (SORTIN01, SORTIN02 and SORTIN03) function.
//*
//* *******************************************************************
//* Step 1 of 3, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//MRGOUTD4 DD  DSN=SIMOTIME.DATA.MRGOUTD4,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 3, Convert the file with 60-byte fixed length records and
//*              the file with 40-byte fixed length records into two
//*              Temporary Data Sets with 80-byte fixed length records.
//*
//UTCONVS2 EXEC PGM=ICETOOL
//TOOLMSG  DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN1      DD  DSN=SIMOTIME.DATA.MRG080D1,DISP=SHR
//IN2      DD  DSN=SIMOTIME.DATA.MRG060D1,DISP=SHR
//IN3      DD  DSN=SIMOTIME.DATA.MRG040D1,DISP=SHR
//T2       DD  DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T3       DD  DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN   DD  *
  COPY FROM(IN2) TO(T2) USING(CTL2)
  COPY FROM(IN3) TO(T3) USING(CTL3)
/*
//CTL2CNTL DD  *
  INREC FIELDS=(1:1,60)
/*
//CTL3CNTL DD  *
  INREC FIELDS=(1:1,40)
/*
//*
//* *******************************************************************
//* Step 3 of 3, Merge three (3) files into one (1) file. This SORT
//*              step will use the multiple SORT input (SORTIN01,
//*              SORTIN02 and SORTIN03) function.
//*
//MERGES03 EXEC PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SORTIN01 DD  DSN=SIMOTIME.DATA.MRG080D1,DISP=(OLD,PASS)
//SORTIN02 DD  DSN=&&T2,DISP=(OLD,PASS)
//SORTIN03 DD  DSN=&&T3,DISP=(OLD,PASS)
//SORTOUT  DD  DSN=SIMOTIME.DATA.MRGOUTD4,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//SYSIN    DD  *
* ..:....1....:....2....:....3....:....4....:....5....:....6....:....7.
  MERGE  FIELDS=(7,8,CH,A)
  INREC  FIELDS=(1,80)
  OUTREC FIELDS=(1,80)
/*
//*
//

Table of Contents Previous Section Next Section Preparation

The jobs included in this suite of programs will execute on an IBM Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Developer. Therefore, it will be necessary to have a properly configured system that is capable of executing JCL that use the standard data file utility programs. programs. The techniques for merging the files will use IEBGENER, IDCAMS, SORT, ICETOOL, ICEMAN and IEFBR14.

Next, a set of three test files will be necessary. The following sub-section describes a job for creating the test files.

Table of Contents Previous Section Next Section Create Three Test Files

This job uses a single JCL member (MRGCPYJ8.jcl) to create the three (3) test files with different record lengths to be used as input for the jobs that do the file merging.

//MRGCPYJ8 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       MRGCPYJ8.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create three Sequential Data Files on disk using IEBGENER.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously.
//* Step 2, CREATE80 will create a new file (80-Bytes) using IEBGENER.
//* Step 3, CREATE60 will create a new file (60-Bytes) using IEBGENER.
//* Step 4, CREATE40 will create a new file (40-Bytes) using IEBGENER.
//*
//* This set of programs will run on a mainframe under ZOS or on a
//* Windows System and Micro Focus Enterprise Server or Studio.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to use JCL with IEBGENER to copy/create
//*    a file with 80-byte fixed length records.
//* 3. Demonstrate how to use JCL with IEBGENER to copy/create
//*    a file with 60-byte fixed length records.
//* 4. Demonstrate how to use JCL with IEBGENER to copy/create
//*    a file with 40-byte fixed length records.
//*
//* This set of programs will run on a Mainframe System with ZOS
//* or a Linux, UNIX or Windows System with Micro Focus Developer.
//*
//* *******************************************************************
//* Step 1 of 4, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//MRG080D1 DD  DSN=SIMOTIME.DATA.MRG080D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//MRG060D1 DD  DSN=SIMOTIME.DATA.MRG060D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=60,DSORG=PS)
//MRG040D1 DD  DSN=SIMOTIME.DATA.MRG040D1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=40,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 4, Create and populate a new Record Sequential (QSAM)
//*              File with 80-byte, fixed-length records.
//*
//CREATE80 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
00011 File-001, Record-001                                                   80*
00021 File-001, Record-002                                                   80*
00031 File-001, Record-003                                                   80*
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRG080D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 3 of 4, Create and populate a new Record Sequential (QSAM)
//*              File with 60-byte, fixed-length records.
//*
//CREATE60 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 GENERATE MAXFLDS=1
 RECORD FIELD=(60,1)
/*
//*
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
00012 File-002, Record-001                               60*
00022 File-002, Record-002                               60*
00032 File-002, Record-003                               60*
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRG060D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=60,DSORG=PS)
//*
//* *******************************************************************
//* Step 4 of 4, Create and populate a new Record Sequential (QSAM)
//*              File with 40-byte, fixed-length records.
//*
//CREATE40 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 GENERATE MAXFLDS=1
 RECORD FIELD=(40,1)
/*
//*
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
00013 File-003, Record-001           40*
00023 File-003, Record-002           40*
00033 File-003, Record-003           40*
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRG040D1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=40,DSORG=PS)
//

Table of Contents Previous Section Next Section Diagnostic Aids

This section provides additional detail about the jobs and programs that are used to support this set of programs.

Table of Contents Previous Section Next Section Hex-Dump for IEBGENER File

A utility program (HX80DUMP.cbl) that was generated using SimoTime technology is used to create a HEX-dump file for the content of the merged file created by IEBGENER.

Table of Contents Previous Section Next Section Hex-Dump, JCL Member

The following is the JCL member (MRGDMPJ1.jcl) that is used to execute the program that creates a HEX-Dump file for the merged file that was created using IEBGENER.

//MRGDMPJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       MRGDMPJ1.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Merge three files into one file using IEBGENER.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously.
//* Step 2, HEXDUMP1 will produce a Hex-Dump of the merged file.
//*
//* This set of programs will run on a mainframe under ZOS or on a
//* Windows System and Micro Focus Enterprise Server or Studio.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to create a Hexadecimal Dump of the merged file.
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//MRGOUTX1 DD  DSN=SIMOTIME.DATA.MRGOUTX1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Produce a Hex-Dump of the Merged file...
//*
//HEXDUMP1 EXEC PGM=HX80DUMP
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRGOUTD1,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRGOUTX1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*
//

Table of Contents Previous Section Next Section Hex-Dump, Sample Output

The following is the output produced by the Hex-Dump program. The input file is the merged file that was created using IEBGENER.

00011 File-001, Record-001                                                   80*
33333246662333225666762333222222222222222222222222222222222222222222222222222332
00011069C5D001C0253F24D00100000000000000000000000000000000000000000000000000080A
........%..........?............................................................
*
00021 File-001, Record-002                                                   80*
33333246662333225666762333222222222222222222222222222222222222222222222222222332
00021069C5D001C0253F24D00200000000000000000000000000000000000000000000000000080A
........%..........?............................................................
*
00031 File-001, Record-003                                                   80*
33333246662333225666762333222222222222222222222222222222222222222222222222222332
00031069C5D001C0253F24D00300000000000000000000000000000000000000000000000000080A
........%..........?............................................................
*
00012 File-002, Record-001                               60*
33333246662333225666762333222222222222222222222222222222233222222222222222222222
00012069C5D002C0253F24D001000000000000000000000000000000060A00000000000000000000
........%..........?............................................................
*
00022 File-002, Record-002                               60*
33333246662333225666762333222222222222222222222222222222233222222222222222222222
00022069C5D002C0253F24D002000000000000000000000000000000060A00000000000000000000
........%..........?............................................................
*
00032 File-002, Record-003                               60*
33333246662333225666762333222222222222222222222222222222233222222222222222222222
00032069C5D002C0253F24D003000000000000000000000000000000060A00000000000000000000
........%..........?............................................................
*
00013 File-003, Record-001           40*
33333246662333225666762333222222222223322222222222222222222222222222222222222222
00013069C5D003C0253F24D0010000000000040A0000000000000000000000000000000000000000
........%..........?............................................................
*
00023 File-003, Record-002           40*
33333246662333225666762333222222222223322222222222222222222222222222222222222222
00023069C5D003C0253F24D0020000000000040A0000000000000000000000000000000000000000
........%..........?............................................................
*
00033 File-003, Record-003           40*
33333246662333225666762333222222222223322222222222222222222222222222222222222222
00033069C5D003C0253F24D0030000000000040A0000000000000000000000000000000000000000
........%..........?............................................................
*

Table of Contents Previous Section Next Section Hex-Dump for IDCAMS File

A utility program (HX80DUMP.cbl) that was generated using SimoTime technology is used to create a HEX-dump file for the content of the merged file created by IEBGENER.

Table of Contents Previous Section Next Section Hex-Dump, JCL Member

The following is the JCL member (MRGDMPJ2.jcl) that is used to execute the program that creates a HEX-Dump file for the merged file that was created using IDCAMS.

//MRGDMPJ2 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       MRGDMPJ2.jcl - a JCL Member for Batch Job Processing        *
//*       This JCL Member is provided by SimoTime Technologies        *
//*           (C) Copyright 1987-2019 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Merge three files into one file using IEBGENER.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* Step 1, JOBSETUP will delete any previously.
//* Step 2, HEXDUMP1 will produce a Hex-Dump of the merged file.
//*
//* This set of programs will run on a mainframe under ZOS or on a
//* Windows System and Micro Focus Enterprise Server or Studio.
//*
//* 1. Demonstrate how to use IEFBR14 with DD statements to delete
//*    files that have been created by a previous execution of this
//*    job.
//* 2. Demonstrate how to create a Hexadecimal Dump of the merged file.
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//JOBSETUP EXEC PGM=IEFBR14
//MRGOUTX2 DD  DSN=SIMOTIME.DATA.MRGOUTX2,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Produce a Hex-Dump of the Merged file...
//*
//HEXDUMP1 EXEC PGM=HX80DUMP
//SYSUT1   DD  DSN=SIMOTIME.DATA.MRGOUTD2,DISP=SHR
//SYSUT2   DD  DSN=SIMOTIME.DATA.MRGOUTX2,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*
//

Table of Contents Previous Section Next Section Hex-Dump, Sample Output

The following is the output produced by the Hex-Dump program. The input file is the merged file that was created using IDCAMS.

00011 File-001, Record-001                                                   80*
33333246662333225666762333222222222222222222222222222222222222222222222222222332
00011069C5D001C0253F24D00100000000000000000000000000000000000000000000000000080A
........%..........?............................................................
*
00021 File-001, Record-002                                                   80*
33333246662333225666762333222222222222222222222222222222222222222222222222222332
00021069C5D001C0253F24D00200000000000000000000000000000000000000000000000000080A
........%..........?............................................................
*
00031 File-001, Record-003                                                   80*
33333246662333225666762333222222222222222222222222222222222222222222222222222332
00031069C5D001C0253F24D00300000000000000000000000000000000000000000000000000080A
........%..........?............................................................
*
00012 File-002, Record-001                               60*
33333246662333225666762333222222222222222222222222222222233222222222222222222222
00012069C5D002C0253F24D001000000000000000000000000000000060A00000000000000000000
........%..........?............................................................
*
00022 File-002, Record-002                               60*
33333246662333225666762333222222222222222222222222222222233222222222222222222222
00022069C5D002C0253F24D002000000000000000000000000000000060A00000000000000000000
........%..........?............................................................
*
00032 File-002, Record-003                               60*
33333246662333225666762333222222222222222222222222222222233222222222222222222222
00032069C5D002C0253F24D003000000000000000000000000000000060A00000000000000000000
........%..........?............................................................
*
00013 File-003, Record-001           40*
33333246662333225666762333222222222223322222222222222222222222222222222222222222
00013069C5D003C0253F24D0010000000000040A0000000000000000000000000000000000000000
........%..........?............................................................
*
00023 File-003, Record-002           40*
33333246662333225666762333222222222223322222222222222222222222222222222222222222
00023069C5D003C0253F24D0020000000000040A0000000000000000000000000000000000000000
........%..........?............................................................
*
00033 File-003, Record-003           40*
33333246662333225666762333222222222223322222222222222222222222222222222222222222
00033069C5D003C0253F24D0030000000000040A0000000000000000000000000000000000000000
........%..........?............................................................
*

Table of Contents Previous Section Next Section Summary

This suite of programs will describe and demonstrate how to merge or append (concatenate) multiple files of various record lengths into a single file. This document may be used to assist as a tutorial for new programmers or as a quick reference for experienced programmers.

In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.

SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the  Contact or Feedback  section of this document.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the Link to Internet icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the Link to Server icon.

Link to Internet   Link to Server   Explore How to Create an Empty Key-Sequenced-Data-Set (or VSAM, KSDS) without using IDCAMS.

Link to Internet   Link to Server   Explore a detailed example of using data set concatenation that includes sample COBOL, JCL and Test Data.

Link to Internet   Link to Server   Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.

Link to Internet   Link to Server   Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.

Link to Internet   Link to Server   Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.

Link to Internet   Link to Server   Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

Link to Internet   Link to Server   Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

This suite of programs and documentation is available to download for review and evaluation purposes. Other uses will require a SimoTime Software License. Link to an Evaluation zPAK Option that includes the program members, documentation and control files.

A good place to start is The SimoTime Home Page for access to white papers, program examples and product information. This link requires an Internet Connection

Explore The Micro Focus Web Site for more information about products (including Micro Focus COBOL) and services available from Micro Focus. This link requires an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

Link to Internet   Link to Server   Explore the Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.

Table of Contents Previous Section Next Section Contact or Feedback

This document was created and is maintained by SimoTime Technologies. If you have any questions, suggestions, comments or feedback please use the following contact information.

1. Send an e-mail to our helpdesk.
1.1. helpdesk@simotime.com.
2. Our telephone numbers are as follows.
2.1. 1 415 763-9430 office-helpdesk
2.2. 1 415 827-7045 mobile

 

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Merge Files with Different Record Lengths
Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com