Partitioned Data Sets or Libraries
When technology complements business   Examples
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved http://www.simotime.com

 
Introduction Version 08.01.18
  Quick Start
  Create a Single Partitioned Data Set (PDS)
  Create Multiple PDS's
  Compress a PDS
  Delete a PDS and all the Members in the PDS
  Managing Members (PDSM) within a PDS
 
  Create a Sequential File of Eighty Byte Records
  Add a New Member (PDSM) to a PDS using a Sequential File as Input
  Copy a PDSM as a PDSM with a New Name
  Copy a PDSM to a QSAM (or Record Sequential) File
  Delete a PDSM in a PDS
  COBOL Program for 80/80 Copy
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Glossary of Terms
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

This suite of programs and documentation will describe how to create and manage a Partitioned Data Set (PDS). It is quite common to refer to a PDS as a Library. The following examples use the IEFBR14 program along with a DD statement in the JCL to create, compress or delete a PDS. Also, sample programs are provided to copy members into or from a PDS.

The source code, data sets and documentation are provided in a single zipped file called UTLDAT02.ZIP. This zipped file is referred to as a Z-Pack and may be downloaded from the SimoTime Web Site. The file names have file extensions. When uploaded to the mainframe from the PC the file extension is dropped. Refer to the Downloads and Links to Similar Pages section of this document for additional download information.

Quick Start
(Next) (Previous) (Table-of-Contents)

The following describes the sequence of events to create a Partitioned Data Set (PDS) and copy members (PDSM) into a PDS. The following will run on a ZOS Mainframe or Windows with Micro Focus Mainframe Express.

Step - JCL Member Description
1 - PDSDELJ1 This job will delete the PDS called SIMOTIME.PDS.TEMPLIB1. The job will do an EXEC of IEFBR14 with a DD statement with a DISP=(MOD,DELETE,DELETE).
2 - PDSCRTJ1 This job will create a PDS called SIMOTIME.PDS.TEMPLIB1. The job will do an EXEC of IEFBR14 and a DD statement with a DISP=(NEW,CATLG).
3 - PDSMWRK1 This job will create a record sequential file (SIMOTIME.DATA.FB80WRK1) of eighty (80) byte, fixed length records using IEBGENER.
4 - PDSMPUT1 This job will read the record sequential file created in the preceding step and write to a PDS Member (FB80MEM1) in the PDS (SIMOTIME.PDS.TEMPLIB1) created in a preceding step. This job uses a COBOL program to do the copy.
5 - PDSMCPY1 This job will copy a PDS member. It copies DSN=SIMOTIME.PDS.TEMPLIB1(FB80WRK1) to DSN=SIMOTIME.PDS.TEMPLIB1(FB80WRKX).
6 - PDSMGET1 This job will read a PDS Member (FB80MEM1) in the PDS (SIMOTIME.PDS.TEMPLIB1) created in a preceding step and write to a record sequential file (SIMOTIME.DATA.FB80WRK2). This job uses a COBOL program to do the copy.
7 - PDSMDEL1 This job will delete a PDS member (FB80MEM1) in the PDS (SIMOTIME.PDS.TEMPLIB1).

Create a Single PDS
(Next) (Previous) (Table-of-Contents)

The following mainframe JCL (PDSCRTJ1.JCL) is used to create a single PDS. The JOB statement and the DD statements will need to be changed for different mainframe environments.

//PDSCRTJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1,
//             COND=(0,LT)
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2006 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Subject: Define a PDS using the IEFBR14 with a DD Statement
//* Author:  SimoTime Enterprises
//* Date:    January 1,1998
//*
//* Technically speaking, IEFBR14 is not a utility program because it
//* does nothing. The name is derived from the fact that it contains
//* two assembler language instruction. The first instruction clears
//* register 15 (which sets the return code to zero) and the second
//* instruction is a BR 14 which performs an immediate return to the
//* operating system.
//*
//* IEFBR14's only purpose is to help meet the requirements that a
//* job must have at least one EXEC statement. The real purpose is to
//* allow the disposition of the DD statement to occur.
//*
//* For example, the following DISP=(NEW,CATLG) will cause the
//* specified DSN (i.e. PDS) to be allocated.
//* Note: a PDS may also be referred to as a library.
//*********************************************************************
//*
//IEFBR14  EXEC PGM=IEFBR14
//TEMPLIB1 DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.TEMPLIB1,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*

The preceding job may be executed on the mainframe as an MVS batch job. The JOB and DD statements will require modification prior to execution in different mainframe environments. It may also be executed on the PC running the Micro Focus Mainframe Express product.

Create Multiple PDS's
(Next) (Previous) (Table-of-Contents)

Many of the sample programs provided by SimoTime assume the source code is stored in a set of Partitioned Data Sets (PDS's). The following mainframe JCL (PDSCRTJ2.JCL) is used to create the (PDS'S). The JOB statement and the DD statements will need to be changed for different mainframe environments.

//PDCRTSJ2 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2003 All Rights Reserved             *
//*                                                                   *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Subject: Define a PDS using the IEFBR14 with a DD Statement
//* Author:  SimoTime Enterprises
//* Date:    January 1,1998
//*
//* Technically speaking, IEFBR14 is not a utility program because it
//* does nothing. The name is derived from the fact that it contains
//* two assembler language instruction. The first instruction clears
//* register 15 (which sets the return code to zero) and the second
//* instruction is a BR 14 which performs an immediate return to the
//* operating system.
//*
//* IEFBR14's only purpose is to help meet the requirements that a
//* job must have at least one EXEC statement. The real purpose is to
//* allow the disposition of the DD statement to occur.
//*
//* For example, the following DISP=(NEW,CATLG) will cause the
//* specified DSN (i.e. PDS) to be allocated.
//* Note: a PDS may also be referred to as a library.
//*
//* The following Partitioned Data Sets are created.
//*
//* SIMOTIME.DEMO.CNTL
//* SIMOTIME.DEMO.COBOL
//* SIMOTIME.DEMO.COBCPY1
//* SIMOTIME.DEMO.ASM
//* SIMOTIME.DEMO.ASMCPY1
//* SIMOTIME.DEMO.ASMMAC1
//* SIMOTIME.DEMO.BMS
//* SIMOTIME.DEMO.MFS
//* SIMOTIME.DEMO.DBD
//* SIMOTIME.DEMO.PSB
//* SIMOTIME.DEMO.OBJECT
//* SIMOTIME.DEMO.LOADLIB1
//* SIMOTIME.DEMO.PROCLIB1
//*
//* The UNIT and VOL are not required for SMS managed data sets.
//* UNIT=SYSDA,VOL=SER=MFILB1,
//*
//CRTPDSX1 EXEC PGM=IEFBR14
//*
//*        The following is for JCL members and PROC library...
//*
//DD01     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.CNTL,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
//DD13     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.PROCLIB1,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
//*        The following is for COBOL members and Copybooks...
//*
//DD02     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.COBOL,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//DD03     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.COBCPY1,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
//*        The following is for Assembler, Copybooks & Macro files...
//*
//DD04     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.ASM,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//DD05     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.ASMCPY1,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//DD06     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.ASMMAC1,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
//*        The following is for CICS Basic Mapping Support...
//*
//DD07     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.BMS,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
//*        The following is for IMS members...
//*
//DD08     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.MFS,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//DD09     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.DBD,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//DD10     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.PSB,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
//*        The following is for OBJECT members...
//*
//DD11     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.OBJECT,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*
//*        The following is for LOAD members...
//*
//DD12     DD  DISP=(NEW,CATLG),DSN=SIMOTIME.DEMO.LOADLIB1,
//             STORCLAS=MFI,
//             SPACE=(TRK,(45,15,50)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
//*

The preceding job may be executed on the mainframe as an MVS batch job. The JOB and DD statements will require modification prior to execution in different mainframe environments. It may also be executed on the PC running the Micro Focus Mainframe Express product.

Compress a PDS
(Next) (Previous) (Table-of-Contents)

After a PDS has been subjected to a high volume of activity such as replacing members, adding new member and deleting members there may be unusable gaps or spaces between members stored within the PDS. A compress function using IEBCOPY is provided to compress the members and consolidate all the gaps or spaces into a single area within the PDS. The following mainframe JCL (PDSCOMJ1.JCL) is used to compress a single PDS. The JOB statement and the DD statements will need to be changed for different mainframe environments.

Note: When compressing the PDS will be allocated for exclusive use by the compression process.

//PDSCOMJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1,
//             COND=(0,LT)
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2006 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Subject: Compress a PDS using the IEBCOPY
//* Author:  SimoTime Enterprises
//* Date:    January 1,1998
//*
//* Note: a PDS may also be referred to as a library.
//*********************************************************************
//PDSCOMS1 EXEC PGM=IEBCOPY
//SYSPRINT DD  SYSOUT=A
//COMPRESS DD  DISP=SHR,DSN=MFI01.SIMOPROD.JCLPROC1
//SYSIN    DD  *
 COPY INDD=COMPRESS,OUTDD=COMPRESS
/*

The preceding job may be executed on the mainframe as an MVS batch job. The JOB and DD statements will require modification prior to execution in different mainframe environments. It may also be executed on the PC running the Micro Focus Mainframe Express (MFE) product. The PDS's managed by MFE do not need to be compressed so the request is simply ignored and control is returned to the caller with a zero return code.

Delete a PDS and all the Members in the PDS
(Next) (Previous) (Table-of-Contents)

The following mainframe JCL (PDSDELJ1.JCL) is used to delete a single PDS. The JOB statement and the DD statements will need to be changed for different mainframe environments.

CAUTION ! ! ! - When deleting a PDS all members within the PDS are also deleted.

//PDSDELJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1,
//             COND=(0,LT)
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2003 All Rights Reserved             *
//*                                                                   *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Subject: Delete a PDS using the IEFBR14 with a DD Statement
//* Author:  SimoTime Enterprises
//* Date:    January 1,1998
//*
//* Technically speaking, IEFBR14 is not a utility program because it
//* does nothing. The name is derived from the fact that it contains
//* two assembler language instruction. The first instruction clears
//* register 15 (which sets the return code to zero) and the second
//* instruction is a BR 14 which performs an immediate return to the
//* operating system.
//*
//* IEFBR14's only purpose is to help meet the requirements that a
//* job must have at least one EXEC statement. The real purpose is to
//* allow the disposition of the DD statement to occur.
//*
//* For example, the following DISP=(OLD,DELETE) will cause the
//* specified DSN (i.e. PDS) to be deleted.
//* Note: a PDS may also be referred to as a library.
//*********************************************************************
//PDSDELS1 EXEC PGM=IEFBR14
//TEMPLIB1 DD  DISP=(OLD,DELETE),DSORG=PO,DSN=SIMOTIME.DEMO.TEMPLIB1
//*

The preceding job may be executed on the mainframe as an MVS batch job. The JOB and DD statements will require modification prior to execution in different mainframe environments. It may also be executed on the PC running the Micro Focus Mainframe Express product.

Managing Members within a PDS
(Next) (Previous) (Table-of-Contents)

This section describes some of the functions for managing Partitioned Data Set Members (or PDSM's).

PDSM, Create a Sequential File of Eighty Byte Records
(Next) (Previous) (Table-of-Contents)

WIP...

//PDSMWRK1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* The first job step (QSAMDELT) will delete any previously created
//* file. The second job step (QCRTDIN1) will create a new file.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step   1   Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//SYSUT2   DD  DSN=SIMOTIME.DATA.FB80WRK1,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   2   Create and populate a new QSAM file...
//*
//QCRTDIN1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7.
//SYSUT1   DD  *
RECORD 001
RECORD 002
RECORD 003
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.FB80WRK1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//

PDSM, Add a New Member to a PDS using a Sequential File as Input
(Next) (Previous) (Table-of-Contents)

WIP...

The following job will execute a COBOL program that will read a record sequential file and write a new member into an existing Partitioned Data Set (PDS).

//PDSMPUT1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//*            RESTART=COPY8080
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Copy a Sequential File into a New PDS Member.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step   1   Read Sequntial File, Create New PDS Member...
//*
//COPY8080 EXEC PGM=FBFB80C1
//FB80GET  DD  DSN=SIMOTIME.DATA.FB80WRK1,DISP=SHR
//FB80PUT  DD  DSN=SIMOTIME.PDS.TEMPLIB1(FB80MEM1),
//             DISP=SHR
//SYSOUT   DD  SYSOUT=*
//*

PDSM, Copy a PDSM as a PDSM with a New Name
(Next) (Previous) (Table-of-Contents)

WIP...

//PDSMCPY1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//*            RESTART=COPY8080
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Copy a PDS Member using IDCAMS with REPRO.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step   1   Delete any previously created file...
//*
//*
//PDSCOPY  EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//PDSMEM1  DD DSN=SIMOTIME.PDS.TEMPLIB1(FB80MEM1),DISP=SHR
//PDSMEM2  DD DSN=SIMOTIME.PDS.TEMPLIB1(FB80MEMX),DISP=SHR
//SYSIN    DD *
 REPRO -
  INFILE(PDSMEM1) -
  OUTFILE(PDSMEM2)
/*

PDSM, Copy a PDSM to a QSAM (or Record Sequential) File
(Next) (Previous) (Table-of-Contents)

WIP...

This job will copy a PDS Member to a Record Sequential file.

//PDSMGET1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//*            RESTART=COPY8080
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Create a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* The first job step (QSAMDELT) will delete any previously created
//* file. The second job step (QCRTDIN1) will create a new record
//* sequential file by copying a PDS member.
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step   1   Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//FB80PUT  DD  DSN=SIMOTIME.DATA.FB80WRK2,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step   2   Get a PDS Member...
//*
//COPY8080 EXEC PGM=FBFB80C1
//FB80GET  DD  DSN=SIMOTIME.PDS.TEMPLIB1(FB80MEM1),DISP=SHR
//FB80PUT  DD  DSN=SIMOTIME.DATA.FB80WRK2,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*

PDSM, Delete a PDSM in a PDS
(Next) (Previous) (Table-of-Contents)

WIP...

//PDSMDEL1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//*            RESTART=COPY8080
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2008 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   - Delete a member in a PDS using IDCAMS.
//* Author - SimoTime Enterprises
//* Date   - January 24, 1996
//*
//* This set of programs will run on a mainframe under MVS or on a
//* Personal Computer with Windows and Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step   1   Delete aMember in a PDS...
//*
//PS010  EXEC  PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
 DELETE SIMOTIME.PDS.TEMPLIB1(FB80MEM1)
/*
//*

COBOL Program for an 80/80 Copy
(Next) (Previous) (Table-of-Contents)

The following is a sample program that copies a file of eighty-byte, fixed-length records to a file of eighty-byte, fixed-length records. Depending on the DD Ststement in the JCL the inout and/or output file may be a QSAM file or a PDS Member (PDSM).

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    FBFB80C1.
       AUTHOR.        SIMOTIME ENTERPRISES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2008-01-18  Generation Time: 11:19:00:59    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  INPUT     FB80GET  SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  OUTPUT    FB80PUT  SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *                                                               *
      *                Translation Mode is UNKNOWN                    *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT FB80GET-FILE  ASSIGN TO       FB80GET
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS FB80GET-STATUS.
           SELECT FB80PUT-FILE  ASSIGN TO       FB80PUT
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS FB80PUT-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  FB80GET-FILE
           DATA RECORD    IS FB80GET-REC
           .
       01  FB80GET-REC.
           05  FB80GET-DATA-01 PIC X(00080).

       FD  FB80PUT-FILE
           DATA RECORD    IS FB80PUT-REC
           .
       01  FB80PUT-REC.
           05  FB80PUT-DATA-01 PIC X(00080).

      *****************************************************************
      * This program was created using the SYSMASK1.TXT file as input.*
      * The SYSMASK1 provides for the sequential reading of the input *
      * file and the sequential writing of the output file.           *
      *                                                               *
      * If the output file is indexed then the input file must be in  *
      * sequence by the field that will be used to provide the key    *
      * for the output file.                                          *
      *                                                               *
      * If the key field is not in sequence then refer to SYSMASK2    *
      * to provide for a random add or update of the indexed file.    *
      *                                                               *
      * This program mask will have the ASCII/EBCDIC table inserted   *
      * for use by the /TRANSLATE function of SimoZAPS.               *
      *                                                               *
      * For additional information contact SimoTime Enterprises.      *
      *                                                               *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* FBFB80C1 '.
           05  T2 pic X(34) value 'Copy File of Fixed 80 bytes LRECL '.
           05  T3 pic X(10) value ' v07.11.04'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* FBFB80C1 '.
           05  C2 pic X(20) value 'Created by SimoZAPS,'.
           05  C3 pic X(20) value '  a utility package '.
           05  C4 pic X(28) value 'of SimoTime Enterprises, LLC'.

       01  FB80GET-STATUS.
           05  FB80GET-STATUS-L     pic X.
           05  FB80GET-STATUS-R     pic X.
       01  FB80GET-EOF              pic X       value 'N'.
       01  FB80GET-OPEN-FLAG        pic X       value 'C'.

       01  FB80PUT-STATUS.
           05  FB80PUT-STATUS-L     pic X.
           05  FB80PUT-STATUS-R     pic X.
       01  FB80PUT-EOF              pic X       value 'N'.
       01  FB80PUT-OPEN-FLAG        pic X       value 'C'.

       01  FB80GET-LRECL    pic 9(5)    value 00080.
       01  FB80PUT-LRECL    pic 9(5)    value 00080.

      *****************************************************************
      * The following buffers are used to create a four-byte status   *
      * code that may be displayed.                                   *
      *****************************************************************
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  IO-STATUS-04.
           05  IO-STATUS-0401      pic 9     value 0.
           05  IO-STATUS-0403      pic 999   value 0.
       01  TWO-BYTES-BINARY        pic 9(4)  BINARY.
       01  TWO-BYTES-ALPHA         redefines TWO-BYTES-BINARY.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* FBFB80C1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  PROGRAM-NAME            pic X(8)     value 'FBFB80C1'.

       01  APPL-RESULT             pic S9(9)    comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       01  FB80GET-TOTAL.
           05  FB80GET-RDR  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for FB80GET '.
       01  FB80PUT-TOTAL.
           05  FB80PUT-ADD  pic 9(9)    value 0.
           05  filler      pic X(3)    value ' - '.
           05  filler      pic X(23)   value 'Line count for FB80PUT '.


      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT
           perform FB80GET-OPEN
           perform FB80PUT-OPEN

           perform until FB80GET-STATUS not = '00'
               perform FB80GET-READ
               if  FB80GET-STATUS = '00'
                   add 1 to FB80GET-RDR
                   perform BUILD-OUTPUT-RECORD
                   perform FB80PUT-WRITE
                   if  FB80PUT-STATUS = '00'
                       add 1 to FB80PUT-ADD
                   end-if
               end-if
           end-perform

           move FB80GET-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           move FB80PUT-TOTAL to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT

           if  APPL-EOF
               move 'is Complete...' to MESSAGE-TEXT
           else
               move 'is ABENDING...' to MESSAGE-TEXT
           end-if
           perform Z-DISPLAY-MESSAGE-TEXT

           perform FB80PUT-CLOSE
           perform FB80GET-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *>   TransCOPY...
           move FB80GET-REC(00001:00080) to FB80PUT-REC(00001:00080)
           exit.

      *****************************************************************
      * I/O Routines for the INPUT File...                            *
      *****************************************************************
       FB80GET-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close FB80GET-FILE
           if  FB80GET-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with FB80GET ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move FB80GET-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       FB80GET-READ.
           read FB80GET-FILE
           if  FB80GET-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  FB80GET-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if
           if  APPL-AOK
               CONTINUE
           else
               if  APPL-EOF
                   move 'Y' to FB80GET-EOF
               else
                   move 'READ Failure with FB80GET ' to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move FB80GET-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       FB80GET-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input FB80GET-FILE
           if  FB80GET-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to FB80GET-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with FB80GET ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move FB80GET-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       FB80PUT-WRITE.
           if  FB80PUT-OPEN-FLAG = 'C'
               perform FB80PUT-OPEN
           end-if
           write FB80PUT-REC
           if  FB80PUT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  FB80PUT-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'WRITE Failure with FB80PUT ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move FB80PUT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       FB80PUT-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT FB80PUT-FILE
           if  FB80PUT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to FB80PUT-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with FB80PUT ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move FB80PUT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       FB80PUT-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close FB80PUT-FILE
           if  FB80PUT-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to FB80PUT-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with FB80PUT ' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move FB80PUT-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-ROUTINES provide administrative functions     *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * four digits. If the full two byte file status is numeric it   *
      * will display as 00nn. If the 1st byte is a numeric nine (9)   *
      * the second byte will be treated as a binary number and will   *
      * display as 9nnn.                                              *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               move IO-STAT1 to IO-STATUS-04(1:1)
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           else
               move '0000' to IO-STATUS-04
               move IO-STATUS to IO-STATUS-04(3:2)
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           exit.

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2008-01-18  Generation Time: 11:19:00:59    *
      *****************************************************************

Summary
(Next) (Previous) (Table-of-Contents)

The purpose of this suite of programs is to provide examples for creating, populating, maintaining and deleting mainframe partitioned data sets (PDS's).

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

Permission to use, copy, modify and distribute this software for any non-commercial purpose and without fee is hereby granted, 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.

SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises 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.

Links to Similar Pages of Interest
(Next) (Previous) (Table-of-Contents)

You may download this example at http://www.simotime.com/sim4dzip.htm#PDSZip or view the complete list of SimoTime Examples at http://www.simotime.com/sim4dzip.htm .

Note: You must be attached to the Internet to download a Z-Pack or view the list.

This document provides a quick summary of the  File Status Key  for VSAM data sets and QSAM files.

To create the QSAM file used by this example refer to The VSAM-QSAM Connection, Common Utility Programs section.

Check out  The JCL Connection  for more mainframe JCL examples.

Check out  The SimoTime Library  for a wide range of topics for Programmers, Project Managers and Software Developers.

To review all the information available on this site start at  The SimoTime Home Page .

Glossary of Terms
(Next) (Previous) (Table-of-Contents)

Check out  The SimoTime Glossary  for a list of terms and definitions used in the documents provided by SimoTime.

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com

About SimoTime Enterprises, LLC
(Next) (Previous) (Table-of-Contents)

Founded in 1987, SimoTime Enterprises is a privately owned, Limited Liability Corporation located in Novato, California. 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. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. 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. 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
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved
When technology complements business