Customer Master File
Create & Maintain a VSAM, KSDS
  Table of Contents  v-24.01.01 - cumast01.htm 
  Introduction
  Programming Objectives
  Programming Requirements
  Programming Overview
  JCL to Manage a Customer Master File
  The Record Structure
  The COBOL Copy File
  HTML Documentation
  JCL, Define the VSAM Cluster
  JCL, Load & Update Test Data Sets
  Small Data Set (Record Reformat)
  Create a Sequential File with Customer Data
  Update the Customer Master File
  Large Data Set (User Defines Size)
  Sequential Load, a New Customer File
  Random Update, Existing Customer File
  Update Fields within a Record
  Create a Sequential File with Customer Data
  Update the Customer Master File
  Extract Data, Customer Master File
  COBOL, the Customer File
  Reformat of the Record Structure
  Update at the Field Level
  Extract Data, Expand Numeric Fields
  Convert, EBCDIC to ASCII
  Convert File Format
  Convert File Format & Record Content
  Diagnostic Aids
  Hex-Dump of Customer Master
  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

Many of the programs provided by SimoTime Technologies use a "Customer Master File" to get data that is used to demonstrate various processing or data accessing techniques. This suite of programs describes how to create the "Customer Master File". On the IBM Mainframe the Customer Master File is an EBCDIC-encoded VSAM Keyed Sequential Data Set (referred to as KSDS). On a Windows or UNIX System using Micro Focus the Customer Master File is an Indexed File or Key Sequenced File. In the Micro Focus world on Linux, UNIX or Windows the file content may be EBCDIC or ASCII encoded.

The Customer Master file contains variable length records with the minimum and average record length being the same length of 512 bytes. The key starts in the first position of the record and is 12 bytes in length. The record layout is defined in a COBOL copy file and contains text strings and various numeric formats including zoned-decimal, packed and binary.


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-2025
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section Programming Objectives

This suite of programs will illustrate the following functions.

Item Objective
1 Demonstrate how to create (or define) a cluster for a VSAM, Key-Sequenced-Data-Set (or KSDS) using JCL and IDCAMS.
2 Demonstrate how to create a sequential file using the IEBGENER Utility program and JCL with instream data
3 Demonstrate how to read a record sequential file (or a Line Sequential file) and update existing records or add new records to a mainframe VSAM, KSDS or Micro Focus Indexed File.
4 Demonstrate how to use a COBOL copy file to define the record layout..
5 Demonstrate how to convert an EBCDIC-encoded Customer Master file to an ASCII-encoded Customer Master file.
6 Demonstrate how to extract data from the Customer Master file and create a Comma-Separated-Values (CSV) file for exporting data to be used in an Microsoft excel spread sheet. This will expand (or convert) packed and binary numeric fields.
  Programming Objectives

Table of Contents Previous Section Next Section Programming Requirements

This suite of sample programs will run on the following platforms.

Item Requirement
1 Executes on Windows/XP using Micro Focus Mainframe Express or Enterprise Server in both EBCDIC or ASCII encoded configurations.
2 May be ported to run on the UNIX platforms supported by Micro Focus Enterprise Server with ES/MTO and the Batch Facility.
  Programming Requirements

Table of Contents Previous Section Next Section Programming Overview

This suite of sample programs will run on the following platforms

Item Overview
1 Run the job that creates the Customer Master File without data.
2 Run the job that creates a Sequential file with customer information.
3 Run the job that loads records into the Customer Master File based on the information in the sequential file.
  Programming Overview

Table of Contents Previous Section Next Section JCL to Manage a Customer Master File

The JCL provided with this suite of programs will run in a Mainframe-Oriented Environment. The term "Mainframe-Oriented Environment" is used to refer to the following.

Item Description
1 An actual ZOS Mainframe System
2 A Micro Focus Mainframe Express sub-system running on a Windows System.
3 A Micro Focus Enterprise Server running on a Linux, UNIX or Windows System.
  Mainframe-Oriented Environments

Table of Contents Previous Section Next Section The Record Structure

The record structure for the Customer Master File is defined using a COBOL COPY File (or COPY Book). The COPY File provides the basic information for an application program. However, determining the position and physical length of the fields within a record would require some additional calculation. Therefore, we have included a link to a separate document that explicitly provides this information. The document is generated using the COBOL COPY File.

Table of Contents Previous Section Next Section The COBOL Copy File

The following (CUSTCB01.cpy) shows the content of the COPY File.

      *****************************************************************
      *               CUSTCB01.cpy - a COBOL Copy Member              *
      *    Customer Master File used for Quality Assurance Testing    *
      *       This is a VSAM Keyed-Sequential-Data-Set or KSDS        *
      *         Copyright (C) 1987-2020 SimoTime Technologies         *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *    CUST-RECORD size is 512 bytes.
      *    RMIN is 512    RMAX is 512
      *    KPOS is   1    KLEN is 012
      *
....:.*..1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
       01  CUST-RECORD.
           05  CUST-NUMBER             PIC X(12).                       col A
           05  CUST-DATA.
               10  CUST-STATUS         PIC X.                           col B
               10  CUST-NAME.
                   15  CUST-LAST-NAME  PIC X(28).                       col C
                   15  CUST-FIRST-NAME PIC X(20).                       col D
                   15  CUST-MID-NAME   PIC X(20).                       col E
               10  CUST-ADDRESS-1      PIC X(48).                       col F
               10  CUST-ADDRESS-2      PIC X(48).                       col G
               10  CUST-CITY           PIC X(28).                       col H
               10  CUST-STATE          PIC X(28).                       col I
               10  CUST-POSTAL-CODE    PIC X(12).                       col J
               10  CUST-PHONE-HOME     PIC X(18).                       col K
               10  CUST-PHONE-WORK     PIC X(18).                       col L
               10  CUST-PHONE-CELL     PIC X(18).                       col M
               10  CUST-CREDIT-LIMIT   PIC 9(7)        COMP-3.          col N
               10  CUST-DISCOUNT       OCCURS 3 TIMES.
                   15  CUST-DISCOUNT-CODE  PIC S9(3)   COMP.            col ORU
                   15  CUST-DISCOUNT-RATE  PIC S9(2)V999.               col PSV
                   15  CUST-DISCOUNT-DATE  PIC X(8).                    col QTW
               10  CUST-LADATE         PIC X(8).                        col X
               10  CUST-LATIME         PIC X(8).                        col Y
               10  CUST-TOKEN          PIC 9(3).                        col Z
               10  FILLER              PIC X(145).
      *
      ***  CUSTCB01 - End-of-Copy File - - - - - - - - - - - CUSTCB01 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section HTML Documentation

The Record Structure for the Customer Master file is defined in an HTML document that is generated using a COBOL copy file. The COBOL copy file provides information for an application program to build a data structure in Working Storage. However, the copy file does not provide explicit information about the start positions of fields within the records or the physical size of the various numeric formats. The HTML document provides this information.

Table of Contents Previous Section Next Section JCL, Define the VSAM Cluster

The following (CUSCRTJ1.jcl) is a listing of the JCL member that may be used to create the Customer Master File.

//CUSCRTJ1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CUSCRTJ1.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 an empty VSAM, KSDS data set using IDCAMS.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* This job will create a VSAM, KSDS data set. Refer to the INDEXED
//* parameter within the DEFINE CLUSTER.
//*
//* The key is twelve characters starting at the first position in
//* the record. Refer to the KEYS(12,0) parameter.
//*
//* The record length for the data set is 512 characters. Refer to
//* the RECORDIZE(512,512) where the first numeric value is the
//* AVERAGE and the second numeric value is the MAXIMUM length.
//*
//* This job script will run on an IBM Mainframe under ZOS or on a
//* Microsoft  Windows System under Micro Focus Mainframe Express.
//*
//* *******************************************************************
//* Step 1 of 1, this is a single step job.
//*
//KSDSMAKE EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
 DEFINE    CLUSTER  (NAME(SIMOTIME.DATA.CUSTMAST)             -
                    TRACKS(45,15)                             -
                    INDEXED)                                  -
           DATA     (NAME(SIMOTIME.DATA.CUSTMAST.DAT)         -
                    KEYS(12,0)                                -
                    RECORDSIZE(512,512)                       -
                    FREESPACE(10,15)                          -
                    CISZ(8192))                               -
           INDEX    (NAME(SIMOTIME.DATA.CUSTMAST.IDX))
/*
//*

Table of Contents Previous Section Next Section JCL, Load & Update Test Data Sets

Once the VSAM Cluster has been defined it will be necessary to load data (i.e. add records to the file) into the data set. The following sub-sections will describe and demonstrate some of the alternatives available.

Table of Contents Previous Section Next Section Small Data Set (Record Reformat)

The following two JCL members will create a sequential file of eighty (80) byte records with each record containing a six (6) byte customer number and customer data. The sequential file will then be read and the information will be reformatted to a twelve (12) byte customer number with larger data fields. The reformatted data will then be used to update records in the Customer Master File.

Table of Contents Previous Section Next Section Create a Sequential File with Customer Data

The following (CUSC80J1.jcl) is a listing of the JCL member that may be used to create a sequential file using instream data. The sequential file may be used to update the Customer Master File.

//CUSC80J1 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CUSC80J1.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 a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The first job step (QSAMDELT) will delete any previously created
//* file. The second job step (QSAMCRT1) 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.
//*
//*                      ************
//*                      * QUSC80J1 *
//*                      ********jcl*
//*                           *
//*                           *
//*                      ************     ************
//*                      * IEFBR14  ******* CUST0080 *
//*                      ********utl*     ***delete***
//*                           *
//*                           *
//*     ************     ************     ************
//*     *  SYSIN   ******* IEBGENER ******* CUST0080 *
//*     ********jcl*     ********utl*     *******rseq*
//*                           *
//*                           *
//*                      ************
//*                      *   EOJ    *
//*                      ************
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//CUST0080 DD  DSN=SIMOTIME.DATA.CUST0080,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create and populate a new QSAM file...
//*
//QSAMCRT1 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7. ..:....8
//SYSUT1   DD  *
000100 Anderson       Adrian    1113 Peachtree Plaza    Atlanta        GA 26101
000200 Brown          Billie    224 Baker Boulevard     Baltimore      MD 35702
000300 Carson         Cameron   336 Crenshaw Blvd.      Cupertino      CA 96154
000400 Davidson       Dion      448 Main Street         Wilmington     DE 27323
000500 Everest        Evan      55 5TH Avenue           New York       NY 10341
000600 Franklin       Francis   6612 66TH Avenue        Bedrock        NY 11903
000700 Garfunkel      Gwen      777 77TH Street         New York       NY 16539
000800 Harrison       Hilary    888 88TH Street         Pocatello      ID 79684
000900 Isley          Isabel    999 99TH Avenue         Indianapolis   IN 38762
001000 Johnson        Jamie     1010 Paradise Drive     Larkspur       CA 90504
001100 Kemper         Kelly     1111 Oak Circle         Kansas City    KS 55651
001200 Lemond         Lesley    1212 Lockwood Road      Mohave Desert  AZ 80303
001300 Mitchell       Marlowe   1313 Miller Creek Road  Anywhere       TX 77123
001400 Newman         Noel      1414 Park Avenue        Santa Monica   CA 90210
001500 Osborn         Owen      1515 Center Stage       Rolling Rock   PA 36613
001600 Powell         Pierce    PO Box 1616             Ventura        CA 97712
001700 Quigley        Quincy    1717 Farm Hill Road     Oshkosh        WI 43389
001800 Ripley         Ray       1818 Alien Lane         Wayout         KS 55405
001900 Smith          Sammy     1919 Carnoustie Drive   Novato         CA 94919
002000 Tucker         Taylor    2020 Sanger Lane        St. Paul       MN 43998
002100 Underwood      Ulysses   2121 Wall Street        New York       NY 17623
002200 Van Etten      Valerie   2222 Vine Street        Hollywood      CA 98775
002300 Wilson         Wiley     2323 Main Street        Boston         MA 01472
002400 Xray           Xavier    2424 24TH Street        Nashville      TN 44190
002500 Young          Yanni     2525 Yonge Street       Toronto        ON 6B74A6
002600 Zenith         Zebulon   2626 26TH Street        Dallas         TX 71922
123456 Doe            John      123 Main Street         Anywhere       OR 88156
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.CUST0080,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//

Table of Contents Previous Section Next Section Update the Customer Master File

The following (CUSI80J1.jcl) is a listing of the JCL member that may be used to update the Customer Master File.

//CUSI80J1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=&SYSUID
//* *******************************************************************
//*       CUSI80J1.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    - Read 80-Byte input and populate a VSAM, KSDS.
//* Author  - SimoTime Technologies
//* Date    - November 24, 2004
//* Version - 07.01.22
//*
//* This job uses a COBOL program to read a sequential file. The
//* information is then used to add records to the KSDS. The records
//* must be in sequence determined by the key field.
//*
//* *******************************************************************
//* Step 1 of 1, Read Sequential File, add records to VSAM, KSDS.
//*
//STEP010  EXEC PGM=CUSI80C1
//STEPLIB  DD  DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR
//CUST0080 DD  DSN=SIMOTIME.DATA.CUST0080,
//             DISP=SHR
//CUSTMAST DD  DSN=SIMOTIME.DATA.CUSTMAST,
//             DISP=SHR
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section Large Data Set (User Defines Size)

The following two JCL members will do an initial load and a secondary update/add of records to the Customer Master File.

Check out  How to Create and Populate a Customer Master File for the Development and Testing environments.  This suite of programs will allow the user to determine the number of records to be added to the Customer Master File.

Table of Contents Previous Section Next Section Sequential Load, a New Customer File

The following is the mainframe JCL (OBFADDJ1.jcl) required to sequentially load (or add) records to a new Customer Master File.

//OBFADDJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       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   -   Execute a COBOL program to populate a Customer File.
//* Author -   SimoTime Technologies
//* Date   -   January 01, 1997
//*
//* This COBOL program will read a control file and access the various
//* name files to populate or update a customer master file.
//*
//* This program uses a Sequential ADD methodology. Therefore,
//* the records being added to the file need to be in sequence
//* by the record key. Since this does an OPEN for OUTPUT it is used
//* to create a new file.
//*
//*                     ************
//*                     * OBFADDJ1 *
//*                     ********jcl*
//*                          *
//*                          *
//*    ************     ************     ************
//*    * OBFCTL80 *--*--* OBFDATC2 *-----* OBF1CUST *
//*    *******rseq*  *  ********cbl*     *******ksds*
//*                  *       *
//*    ************  *       *
//*    * LASTNAME *--*       *
//*    *******rseq*  *       *
//*                  *       *
//*    ************  *       *
//*    * FNAMEF01 *--*       *
//*    *******rseq*  *       *
//*                  *       *
//*    ************  *       *
//*    * FNAMEM01 *--*       *
//*    *******rseq*  *       *
//*                  *       *
//*    ************  *       *
//*    * POSTCODE *--*       *
//*    *******rseq*  *       *
//*                  *       *
//*    ************  *       *
//*    * STREET01 *--*       *
//*    *******rseq*          *
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step   1   This is a single step job.
//*
//CUADDS01 EXEC PGM=OBFDATC2
//STEPLIB  DD  DISP=OLD,DSN=MFI01.SIMOPROD.LOADLIB1
//OBFCTL80 DD  DISP=OLD,DSN=SIMOTIME.DATA.OBFCTL80
//FNAMEF01 DD  DISP=OLD,DSN=SIMOTIME.DATA.FNAMEF01
//FNAMEM01 DD  DISP=OLD,DSN=SIMOTIME.DATA.FNAMEM01
//LASTNAME DD  DISP=OLD,DSN=SIMOTIME.DATA.LASTNAME
//POSTCODE DD  DISP=OLD,DSN=SIMOTIME.DATA.POSTCODE
//STREET01 DD  DISP=OLD,DSN=SIMOTIME.DATA.STREET01
//OBF1CUST DD  DISP=OLD,DSN=SIMOTIME.DATA.OBF1CUST
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section Random Update, Existing Customer File

The following is the mainframe JCL (OBFUPDJ1.jcl) required to add new records or update existing records for the Customer Master File.

//OBFUPDJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       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   -   Execute a COBOL program to update a Customer File.
//* Author -   SimoTime Technologies
//* Date   -   January 01, 1997
//*
//* This COBOL program will read a control file and access the various
//* name files to populate or update a customer master file.
//*
//* This program uses a Random, ADD/UPDATE methodology. Therefore,
//* the records being added to the file do not need to be in
//* sequence by the record key.
//*
//*                     ************
//*                     * OBFUPDJ1 *
//*                     ********jcl*
//*                          *
//*                          *
//*                     ************     ************
//*                     * OBFDATC1 *-----* OBF1CUST *
//*                     ********cbl*     *******ksds*
//*                          *
//*    ************     ************
//*    * OBFCTL80 *--*--* OBFCTLC1 *
//*    *******rseq*     ********cbl*
//*                          *
//*    ************     ************
//*    * LASTNAME *--*--* OBFDATR1 *
//*    *******rseq*  *  ********cbl*
//*                  *       *
//*    ************  *       *
//*    * FNAMEF01 *--*       *
//*    *******rseq*  *       *
//*                  *       *
//*    ************  *       *
//*    * FNAMEM01 *--*       *
//*    *******rseq*  *       *
//*                  *       *
//*    ************  *       *
//*    * POSTCODE *--*       *
//*    *******rseq*  *       *
//*                  *       *
//*    ************  *       *
//*    * STREET01 *--*       *
//*    *******rseq*          *
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step   1   This is a single step job.
//*
//CUUPDS01 EXEC PGM=OBFDATC1
//STEPLIB  DD  DISP=OLD,DSN=MFI01.SIMOPROD.LOADLIB1
//OBFCTL80 DD  DISP=OLD,DSN=SIMOTIME.DATA.OBFCTL80
//FNAMEF01 DD  DISP=OLD,DSN=SIMOTIME.DATA.FNAMEF01
//FNAMEM01 DD  DISP=OLD,DSN=SIMOTIME.DATA.FNAMEM01
//LASTNAME DD  DISP=OLD,DSN=SIMOTIME.DATA.LASTNAME
//POSTCODE DD  DISP=OLD,DSN=SIMOTIME.DATA.POSTCODE
//STREET01 DD  DISP=OLD,DSN=SIMOTIME.DATA.STREET01
//OBF1CUST DD  DISP=OLD,DSN=SIMOTIME.DATA.OBF1CUST
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section Update Fields within a Record

The following two JCL members will create a sequential file with each record containing a field identifier, a customer number and a string of data. The sequential file will then be read and the information will be used to update fields within records of the Customer Master File.

Table of Contents Previous Section Next Section Create a Sequential File with Customer Data

The following (CUCSQJ01.jcl) is a listing of the JCL member that may be used to create a sequential file using instream data. The sequential file may be used to update the Customer Master File.

//CUCSQJ01 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CUCSQJ01.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 a Sequential Data Set on disk using IEBGENER.
//* Author - SimoTime Technologies
//* Date   - January 24, 1996
//*
//* The first job step (SQ01DELT) will delete any previously created
//* file. The second job step (CUCSQS01) 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.
//*
//*                      ************
//*                      * CUCSQJ01 *
//*                      ********jcl*
//*                           *
//*                           *
//*                      ************     ************
//*                      * IEFBR14  ******* CUSTSQ01 *
//*                      ********utl*     ***delete***
//*                           *
//*                           *
//*     ************     ************     ************
//*     *  SYSUT2  ******* IEBGENER ******* CUSTSQ01 *
//*     ********jcl*     ********utl*     *******qsam*
//*                           *
//*                           *
//*                      ************
//*                      *   EOJ    *
//*                      ************
//*
//* *******************************************************************
//* Positions   Purpose/Description
//*   01-03     Control Information
//*   04-15     Key for KSDS Access
//*   15-71     Text string used for update
//*
//* ***   ************************
//* /NL   update CUST-LAST-NAME
//* /NF   update CUST-FIRST-NAME
//* /NM   update CUST-MIDDLE-NAME
//* /A1   update CUST-ADDRESS-1
//* /A2   update CUST-ADDRESS-2
//* /CT   update CUST-CITY
//* /ST   update CUST-STATE
//* /PC   update CUST-POSTAL-CODE
//* /CL   update CUST-CREDIT-LIMIT
//* /TH   update CUST-PHONE-HOME
//* /TO   update CUST-PHONE-OFFICE
//* /TM   update CUST-PHONE-MOBILE
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//SQ01DELT EXEC PGM=IEFBR14
//CUSTSQ01 DD  DSN=SIMOTIME.DATA.CUSTSQ01,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create and populate a new QSAM file...
//*
//CUCSQS01 EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//* :....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8
//SYSUT1   DD  *
/NL000000000001Anderson
/NF000000000001Adrian
/A1000000000001111 Peachtree Plaza
/CT000000000001Atlanta
/ST000000000001GA
/PC00000000000111033
/TO0000000000012651101234
/CL0000000000010025000
/NL000000000002Brown
/NF000000000002Billie
/A1000000000002222 Baker Boulevard
/A2000000000002Apartment 22B
/CT000000000002Baltimore
/ST000000000002MD
/PC00000000000221033
/CL0000000000020002500
/NL000000000003Carson
/NF000000000003Cameron
/A1000000000003333 Crenshaw Blvd.
/CT000000000003Cupertino
/ST000000000003CA
/PC00000000000394116
/NL000000000004Davidson
/NF000000000004Dion
/A1000000000004444 Main Street
/CT000000000004Wilmington
/ST000000000004DE
/PC00000000000410421-6767
/NL000000000005Everest
/NF000000000005Evan
/A1000000000005555 5TH Avenue
/CT000000000005New York
/ST000000000005NY
/PC00000000000512135
/NL000000000006Franklin
/NF000000000006Francis
/A1000000000006666 66TH Avenue
/CT000000000006Bedrock
/ST000000000006NY
/PC00000000000613897
/NL000000000007Garfunkel
/NF000000000007Gwen
/A1000000000007777 77TH Street
/CT000000000007New York
/ST000000000007NY
/PC00000000000711397
/NL000000000008Harrison
/NF000000000008Hilary
/A1000000000008888 88TH Street
/CT000000000008Pocatello
/ST000000000008ID
/PC00000000000878662
/NL000000000009Isley
/NF000000000009Isabel
/A1000000000009999 99TH Avenue
/CT000000000009Indianapolis
/ST000000000009IN
/PC00000000000937912
/NL000000000010Johnson
/NF000000000010Jamie
/A10000000000101010 Paradise Drive
/CT000000000010Larkspur
/ST000000000010CA
/PC00000000001097661
/NL000000000011Kemper
/NF000000000011Kelly
/A10000000000111111 Oak Circle
/CT000000000011Kansas City
/ST000000000011KS
/PC00000000001143077
/NL000000000012Lemond
/NF000000000012Lesley
/A10000000000121212 Lockwood Road
/A2000000000012Suite 12A
/CT000000000012Mohave Desert
/ST000000000012AZ
/PC00000000001287033
/NL000000000013Mitchell
/NF000000000013Marlow
/A10000000000131313 Miller Creek Road
/CT000000000013Anywhere
/ST000000000013TX
/PC00000000001361773
/NL000000000014Newman
/NF000000000014Noel
/A10000000000141414 Park Avenue
/CT000000000014Santa Monica
/ST000000000014CA
/PC00000000001490503
/NL000000000015Osborn
/NF000000000015Owen
/A10000000000151515 Center Stage
/CT000000000015Rolling Rock
/ST000000000015PA
/PC00000000001527113
/NL000000000016Powell
/NF000000000016Pierce
/A1000000000016PO Box 1616
/CT000000000016Ventura
/ST000000000016CA
/PC00000000001690507
/NL000000000017Quigley
/NF000000000017Quincy
/A10000000000171717 Farm Hill Road
/CT000000000017Oshkosh
/ST000000000017WI
/PC00000000001706112
/NL000000000018Ripley
/NF000000000018Ray
/A10000000000181818 Alien Lane
/CT000000000018Wayout
/ST000000000018KS
/PC00000000001804713
/NL000000000019Smith
/NF000000000019Sammy
/A10000000000191919 Carnoustie Drive
/CT000000000019Novato
/ST000000000019CA
/PC00000000001994949
/TO000000000019415 883-6565
/CL0000000000190010000
/NL000000000020Tucker
/NF000000000020Taylor
/A10000000000202020 Sanger Lane
/CT000000000020St. Paul
/ST000000000020MN
/PC00000000002006147
/CL0000000000201234567
/NL000000000021Underwood
/NF000000000021Ulysses
/A10000000000212121 Wall Street
/CT000000000021New York
/ST000000000021NY
/PC00000000002104001
/NL000000000022Van Etten
/NF000000000022Valerie
/A10000000000222222 Vine Street
/A200000000002216TH Floor
/CT000000000022Hollywood
/ST000000000022CA
/PC00000000002297163
/NL000000000023Wilson
/NF000000000023Wiley
/A10000000000232323 Main Street
/CT000000000023Boston
/ST000000000023MA
/PC00000000002327135
/NL000000000024Xray
/NF000000000024Xavier
/A10000000000242424 24TH Street
/CT000000000024Nashville
/ST000000000024TN
/PC00000000002450513
/NL000000000025Young
/NF000000000025Yanni
/A10000000000252525 Yonge Street
/CT000000000025Toronto
/ST000000000025ON
/PC0000000000251K3 B4R
/NL000000000026Zenith
/NF000000000026Zebulon
/A10000000000262626 26TH Street
/CT000000000026Dallas
/ST000000000026TX
/PC00000000002661735
/*
//SYSUT2   DD  DSN=SIMOTIME.DATA.CUSTSQ01,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//

Table of Contents Previous Section Next Section Update the Customer Master File

The following (CUUPDJ01.jcl) is a listing of the JCL member that may be used to update the Customer Master File.

//CUUPDJ01 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CUUPDJ01.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   -   Execute a COBOL program to read QSAM and write VSAM.
//* Author -   SimoTime Technologies
//* Date   -   January 01, 1997
//*
//* This COBOL program will read a QSAM, EBCDIC, 80-byte,
//* fixed-record-length file and update a KSDS, VSAM data set.
//*
//*                     ************
//*                     * CUUPDJ01 *
//*                     ********jcl*
//*                          *
//*                          *
//*    ************     ************     ************
//*    * CUSTSQ01 *-----* CUUPDC01 *-----* CUSTMAST *
//*    *******qsam*     ********cbl*     *******vsam*
//*                          *
//*                          *
//*                     ************
//*                     *   EOJ    *
//*                     ************
//*
//* *******************************************************************
//* Step 1 of 1, this is a single step job.
//*
//CUUPDS01 EXEC PGM=CUUPDC01
//STEPLIB  DD  DISP=SHR,DSN=MFI01.SIMOPROD.LOADLIB1
//CUSTSQ01 DD  DISP=SHR,DSN=SIMOTIME.DATA.CUSTSQ01
//CUSTMAST DD  DISP=SHR,DSN=SIMOTIME.DATA.CUSTMAST
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section Extract Data, Customer Master File

The following (CUSEXTJ1.jcl) is a listing of the JCL member that may be used to extract information from the Customer Master File and create a sequential file with the records formatted with the fields delimited by a comma.

//CUSEXTJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CUSEXTJ1.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   - Read Customer Master File, write to a sequential file
//* Author - SimoTime Technologies
//* Date   - January 01, 1989
//*
//* This set of programs will run on a mainframe under MVS or on
//* a Personal Computer running Windows and Mainframe Express by
//* Micro Focus.
//*
//*   ************                    ************
//*   *  Entry   *                    *  Entry   *
//*   *   MVS    *                    * Windows  *
//*   ************                    ************
//*        *                               *
//*   ************                    ************
//*   * CUSEXTJ1 *                    * CUSEXTE1 *
//*   ********jcl*                    ********cmd*
//*        *                               *
//*   ************                         *
//*   * IEFBR14  *                         *
//*   ********utl*                         *
//*        *                               *
//*        *********************************
//*                        *
//*                        *
//*   ************    ************    ************
//*   * CUSTMAST *----* CUSEXTC1 *----* CUSEXTSV *
//*   ************    ********cbl*    ********dat*
//*                        *   *
//*                        *   *
//*                        *   *---CALL----*
//*                        *               *
//*                        *               *
//*                        *          ************
//*                        *          * CUSEXTR1 *
//*                        *          ********cbl*
//*                        *
//*                   ************
//*                   *   EOJ    *
//*                   ************
//*
//* *******************************************************************
//* Step 1 of 2, This job step will delete a previously created file.
//*
//DELTSEQ1 EXEC PGM=IEFBR14
//CUSTRCSV DD  DSN=SIMOTIME.DATA.CUSTPHON,DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=256,DSORG=PS)
//* *******************************************************************
//* Step 2 of 2, Execute the Sample program.
//*              Read the customer file (KSDS) and write a record of
//*              selected fields to a sequential file. Truncate spaces
//*              from each field and separate the fields by a comma.
//*
//CBLEXTS1 EXEC PGM=CUSEXTC1
//STEPLIB  DD  DSN=MFI01.SIMOPROD.LOADLIB1,DISP=SHR
//CUSTMAST DD  DSN=SIMOTIME.DATA.CUSTMAST,DISP=SHR
//CUSTRCSV DD  DSN=SIMOTIME.DATA.CUSTPHON,DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=256,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section COBOL, the Customer File

This section includes a listing of the source code for the COBOL programs used to create, maintain and access the Customer Master File.

Table of Contents Previous Section Next Section Reformat of the Record Structure

The following (CUSI80C1.cbl) is a sample COBOL demonstration program. This program will "read from" a sequential file and "update records or add records" to the Customer Master File. The sequential input file is eighty (80) byte fixed length records with a six (6) byte customer number in positions 1-6. The Customer number will be expanded to twelve (12) bytes and the individual fields will be increased in size. The program will compile and run in a Mainframe-oriented environment using an EBCDIC or ASCII encoded format.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUSI80C1.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2018-10-10  Generation Time: 20:28:24:10    *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  PRIMARY   CUST0080 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *  SECONDARY CUSTMAST INDEXED       VARIABLE   00512    00001   *
      *                                              00012    00012   *
      *                                                               *
      *            Translation Mode is ASCII to ASCII                 *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT CUST0080-FILE  ASSIGN TO       CUST0080
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS CUST0080-STATUS.
           SELECT CUSTMAST-FILE  ASSIGN TO       CUSTMAST
                  ORGANIZATION  IS INDEXED
                  ACCESS MODE   IS SEQUENTIAL
                  RECORD KEY    IS CUSTMAST-PKEY-00001-00012
                  FILE STATUS   IS CUSTMAST-STATUS.

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

       FD  CUSTMAST-FILE
           DATA RECORD    IS CUSTMAST-REC
           .
       01  CUSTMAST-REC.
           05  CUSTMAST-PKEY-00001-00012        PIC X(00012).
           05  CUSTMAST-DATA-00013-00500        PIC X(00500).

      *****************************************************************
      * This program was created with 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. This is a sequential load process.       *
      *                                                               *
      * 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 more information or questions please contact SimoTime     *
      * Technologies. The version control number is 16.01.01          *
      *                                                               *
      *        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 '* CUSI80C1 '.
           05  T2 pic X(34) value 'Sequential, RSEQ-80 to KSEQ-512   '.
           05  T3 pic X(10) value ' v16.01.01'.
           05  T4 pic X(24) value '   helpdesk@simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CUSI80C1 '.
           05  C2 pic X(32) value 'This Data File Convert Member wa'.
           05  C3 pic X(32) value 's generated by SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

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

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

       01  CUST0080-LRECL            pic 9(5)    value 00080.
       01  CUSTMAST-LRECL            pic 9(5)    value 00512.
       01  CUST0080-LRECL-MAX        pic 9(5)    value 00080.
       01  CUSTMAST-LRECL-MAX        pic 9(5)    value 00512.

      *****************************************************************
      * 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(011)  value '* CUSI80C1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(068)  value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.
       01  MSG-LSB                 pic 9(5)    value 267.

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

       01  INFO-STATEMENT.
           05  INFO-SHORT.
               10  INFO-ID pic X(8)    value 'Starting'.
               10  filler  pic X(2)    value ', '.
               10  filler  pic X(34)
                   value   'Sequential, RSEQ-80 to KSEQ-512   '.
           05  filler      pic X(24)
               value ' http://www.SimoTime.com'.

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

       01  WRITE-FLAG      pic X       value 'Y'.

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

      *****************************************************************
       PROCEDURE DIVISION.
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move INFO-STATEMENT to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           move all '*' to MESSAGE-TEXT-1
           perform Z-DISPLAY-MESSAGE-TEXT
           perform Z-POST-COPYRIGHT
           perform CUST0080-OPEN
           perform CUSTMAST-OPEN

      *    USRSOJ Processing not specified...

           perform until CUST0080-STATUS not = '00'
               perform CUST0080-READ
               if  CUST0080-STATUS = '00'
                   add 1 to CUST0080-RDR
                   perform BUILD-OUTPUT-RECORD
                   if  WRITE-FLAG = 'Y'
                       perform CUSTMAST-WRITE
                       if  CUSTMAST-STATUS = '00'
                           add 1 to CUSTMAST-ADD
                       end-if
                   end-if
               end-if
           end-perform

      *    USREOJ Processing not specified...

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

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

           if  APPL-EOF
               move 'Complete' to INFO-ID
           else
               move 'ABENDING' to INFO-ID
           end-if
           move INFO-STATEMENT to MESSAGE-TEXT(1:79)
           perform Z-DISPLAY-MESSAGE-TEXT

           perform CUSTMAST-CLOSE
           perform CUST0080-CLOSE
           GOBACK.

      *****************************************************************
       BUILD-OUTPUT-RECORD.
      *    TransMODE is A2A...
      *    TransINIT process...
           move ALL SPACES      to CUSTMAST-REC
      *    TransCOPY...
           move CUST0080-REC(00001:00006) to CUSTMAST-REC(00007:00006)
      *    TransCOPY...
           move CUST0080-REC(00008:00015) to CUSTMAST-REC(00014:00015)
      *    TransCOPY...
           move CUST0080-REC(00023:00010) to CUSTMAST-REC(00042:00010)
      *    TransCOPY...
           move CUST0080-REC(00033:00024) to CUSTMAST-REC(00082:00024)
      *    TransCOPY...
           move CUST0080-REC(00057:00015) to CUSTMAST-REC(00178:00015)
      *    TransCOPY...
           move CUST0080-REC(00072:00003) to CUSTMAST-REC(00206:00003)
      *    TransCOPY...
           move CUST0080-REC(00075:00006) to CUSTMAST-REC(00234:00006)
      *    TransFILL...
           move
           '000000'
           to CUSTMAST-REC(00001:00006)
      *    TransFILL...
           move
           X'0000250F'
           to CUSTMAST-REC(00300:00004)
      *    TransFILL...
           move
           X'0000'
           to CUSTMAST-REC(00304:00002)
      *    TransFILL...
           move
           '00000'
           to CUSTMAST-REC(00306:00005)
      *    TransFILL...
           move
           '00000000'
           to CUSTMAST-REC(00311:00008)
      *    TransFILL...
           move
           X'0000'
           to CUSTMAST-REC(00319:00002)
      *    TransFILL...
           move
           '00000'
           to CUSTMAST-REC(00321:00005)
      *    TransFILL...
           move
           '00000000'
           to CUSTMAST-REC(00326:00008)
      *    TransFILL...
           move
           X'0000'
           to CUSTMAST-REC(00334:00002)
      *    TransFILL...
           move
           '00000'
           to CUSTMAST-REC(00336:00005)
      *    TransFILL...
           move
           '00000000'
           to CUSTMAST-REC(00341:00008)
      *    TransFILL...
           move
           '20080124'
           to CUSTMAST-REC(00349:00008)
      *    TransFILL...
           move
           '13053000'
           to CUSTMAST-REC(00357:00008)
      *    TransDATE...
           accept  CUSTMAST-REC(00349:00008)
             from  DATE YYYYMMDD
      *    TransTIME...
           accept  CUSTMAST-REC(00357:00008)
             from  TIME
      *    TransFILL...
           move
           '000'
           to CUSTMAST-REC(00365:00003)
           exit.

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

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

      *****************************************************************
       Z-CALCULATE-MESSAGE-LSB.
           add 267 to ZERO giving MSG-LSB
           perform until MSG-LSB < 80
                      or MESSAGE-BUFFER(MSG-LSB:1) not = SPACE
             if MESSAGE-BUFFER(MSG-LSB:1) = SPACE
                subtract 1 from MSG-LSB
             end-if
           end-perform
           exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           perform Z-CALCULATE-MESSAGE-LSB
           display MESSAGE-BUFFER(1:MSG-LSB)
           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 Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  Generation Date: 2018-10-10  Generation Time: 20:28:24:13    *
      *****************************************************************

Table of Contents Previous Section Next Section Update at the Field Level

The following (CUUPDC01.cbl) is a sample COBOL demonstration program. This program will "read from" a sequential file and "update records or add records" to the Customer Master File. The program will compile and run in a Mainframe-oriented environment using an EBCDIC or ASCII encoded format.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CUUPDC01.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2019 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software 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.                                                 *
      *                                                               *
      * Permission to use, copy and modify 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 without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software 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                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      * Source Member: CUUPDC01.CBL
      * Copy Files:    QQSMREC1.CPY
      *****************************************************************
      *
      * CUUPDC01 - Execute CUUPDC01 to read a QSAM file and  update
      * a VSAM Keyed Sequential Data Set (KSDS).
      *
      * EXECUTION or CALLING PROTOCOL
      * -----------------------------
      * Use standard JCL to EXECUTE or ANIMATE.
      *
      * DESCRIPTION
      * -----------
      * This single COBOL program will read an 80-byte, EBCDIC, QSAM
      * file an populate or update an empty or existing KSDS, VSAM
      * data set.
      *
      *                      ************
      *                      * KSDUPD *
      *                      ********jcl*
      *                           *
      *                           *
      *     ************     ************     ************
      *     * CUSTSQ01 *-----* CUUPDC01 *-----* CUSTMAST *
      *     *******qsam*     ********cbl*     *******vsam*
      *                           *
      *                           *
      *                      ************
      *                      *   EOJ    *
      *                      ************
      *
      *****************************************************************
      * This program will read the input file and update the master
      * file (SYSMLR2). The format of the input file (SYSMLR1) is
      * as follows.
      *
      * Position Length Description...
      *  ------   ----  -----------------------------------------------
      *    01      03   Record Idendifier
      *                 /N1 Name change or correction
      *                 /A1 Address change or correction (street)
      *                 /CT City
      *                 /ST State
      *                 /PC Postal Code
      *    04      12   The Key Field
      *    16      nn   Length based on Record Identifier
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1997/02/27 Simmons, Created program.
      * 1997/02/27 Simmons, No changes to date.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT   SECTION.
       FILE-CONTROL.

      *****************************************************************
           SELECT CUSTSQ01-FILE
               ASSIGN       to CUSTSQ01
               ORGANIZATION is SEQUENTIAL
               ACCESS MODE  is SEQUENTIAL
               FILE STATUS  is CUSTSQ01-STATUS.
           SELECT CUSTMAST-FILE
               ASSIGN       to CUSTMAST
               ORGANIZATION is indexed
               ACCESS MODE  is RANDOM
               RECORD KEY   is CUST-NUMBER
               FILE STATUS  is CUSTMAST-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.

      *****************************************************************
       FD   CUSTSQ01-FILE
            RECORD CONTAINS 80 CHARACTERS.
       COPY QSMCPYB2.

       FD  CUSTMAST-FILE.
       COPY CUSTCB01.

       WORKING-STORAGE SECTION.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *****************************************************************
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CUUPDC01 '.
           05  T2 pic X(34) value ' Read CUSTSQ01, Update CUSTMAST '.
           05  T3 pic X(10) value ' v07.02.21'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CUUPDC01 '.
           05  C2 pic X(20) value 'Copyright 1987-2019 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* CUUPDC01 '.
           05  C2 pic X(32) value 'Thank you for using this program'.
           05  C3 pic X(32) value ' provided from SimoTime Technolo'.
           05  C4 pic X(04) value 'gies'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* CUUPDC01 '.
           05  C2 pic X(32) value 'Please send all inquires or sugg'.
           05  C3 pic X(32) value 'estions to the helpdesk@simotime'.
           05  C4 pic X(04) value '.com'.

       01  CUSTMAST-STATUS.
           05  CUSTMAST-STAT1      pic X.
           05  CUSTMAST-STAT2      pic X.

       01  CUSTSQ01-STATUS.
           05  CUSTSQ01-STAT1      pic X.
           05  CUSTSQ01-STAT2      pic X.

       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  TWO-BYTES-BINARY        redefines TWO-BYTES pic 9(4) comp.

       01  END-OF-FILE             pic X(3)    value 'NO '.

      *****************************************************************
      *    Buffer used for posting messages to the console.
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CUUPDC01 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

       01  CUSTSQ01-FLAG           pic X       value 'N'.

       01  WORK-07.
           05  WORK-07-NUMB        pic 9(7)    value 0.
       01  WX-7                    pic 9(2)    value 0.

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

      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT.

           perform CUSTSQ01-OPEN.
           perform CUSTMAST-OPEN.

           perform until END-OF-FILE = 'YES'
               if  END-OF-FILE = 'NO '
                   perform CUSTSQ01-GET
                   if  END-OF-FILE = 'NO '
                       move QSAM-B2-RECORD to MESSAGE-TEXT
                       perform Z-DISPLAY-MESSAGE-TEXT
                       move QSAM-B2-KEY to CUST-NUMBER
                       perform CUSTMAST-GET
                       perform EVALUATE-FIELD-TYPE
                       if  CUSTSQ01-FLAG = 'Y'
                           if  APPL-AOK
                               perform MOVE-QSAM-FIELD-TO-KSDS-RECORD
                               perform CUSTMAST-REWRITE
                           else
                               perform INITIALIZE-CUSTOMER-RECORD
                               move QSAM-B2-KEY to CUST-NUMBER
                               perform MOVE-QSAM-FIELD-TO-KSDS-RECORD
                               perform CUSTMAST-WRITE
                           end-if
                       end-if
                   end-if
               end-if
           end-perform.

           perform CUSTMAST-CLOSE.
           perform CUSTSQ01-CLOSE.

           display 'CUUPDC01 CUSTMAST-HAS-BEEN-UPDATED'
           display 'CUUPDC01 NORMAL-END-OF-JOB...'

           perform Z-THANK-YOU.

           GOBACK.

      *****************************************************************
      * The following routines are in alphabetic sequence.            *
      *****************************************************************
       INITIALIZE-CUSTOMER-RECORD.
           move all SPACES to CUST-RECORD
           initialize CUST-RECORD
           exit.

      *****************************************************************
       EVALUATE-FIELD-TYPE.
           if  QSAM-B2-ID = '/NM'
           or  QSAM-B2-ID = '/NL'
           or  QSAM-B2-ID = '/NF'
           or  QSAM-B2-ID = '/A1'
           or  QSAM-B2-ID = '/A2'
           or  QSAM-B2-ID = '/CT'
           or  QSAM-B2-ID = '/ST'
           or  QSAM-B2-ID = '/PC'
           or  QSAM-B2-ID = '/CL'
           or  QSAM-B2-ID = '/TH'
           or  QSAM-B2-ID = '/TO'
           or  QSAM-B2-ID = '/TM'
               move 'Y' to CUSTSQ01-FLAG
           else
               move 'N' to CUSTSQ01-FLAG
           end-if
           exit.
      *****************************************************************
       MOVE-QSAM-FIELD-TO-KSDS-RECORD.
           move 'Y' to CUSTSQ01-FLAG
           evaluate QSAM-B2-ID
               when '/NL' move QSAM-B2-DATA to CUST-LAST-NAME
               when '/NF' move QSAM-B2-DATA to CUST-FIRST-NAME
               when '/NM' move QSAM-B2-DATA to CUST-MID-NAME
               when '/A1' move QSAM-B2-DATA to CUST-ADDRESS-1
               when '/A2' move QSAM-B2-DATA to CUST-ADDRESS-2
               when '/CT' move QSAM-B2-DATA to CUST-CITY
               when '/ST' move QSAM-B2-DATA to CUST-STATE
               when '/PC' move QSAM-B2-DATA to CUST-POSTAL-CODE
               when '/CL' perform MOVE-CUST-CREDIT-LIMIT
               when '/TH' move QSAM-B2-DATA to CUST-PHONE-HOME
               when '/TO' move QSAM-B2-DATA to CUST-PHONE-WORK
               when '/TM' move QSAM-B2-DATA to CUST-PHONE-CELL
               when other move 'N' to CUSTSQ01-FLAG
           end-evaluate

           exit.

      *****************************************************************
       MOVE-CUST-CREDIT-LIMIT.
           move QSAM-B2-DATA to WORK-07
           perform until WORK-07(7:1) not = SPACE
             perform varying WX-7 from 6 by -1 until WX-7 = 0
               move WORK-07(WX-7:1) to WORK-07(WX-7 + 1:1)
             end-perform
      *      move WORK-07(6:1) to WORK-07(7:1)
      *      move WORK-07(5:1) to WORK-07(6:1)
      *      move WORK-07(4:1) to WORK-07(5:1)
      *      move WORK-07(3:1) to WORK-07(4:1)
      *      move WORK-07(2:1) to WORK-07(3:1)
      *      move WORK-07(1:1) to WORK-07(2:1)
             move ZERO         to WORK-07(1:1)
           end-perform
           if  WORK-07-NUMB is NUMERIC
               add WORK-07-NUMB to ZERO giving CUST-CREDIT-LIMIT
           else
               move 'Credit Limit Update Error...' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           exit.

      *****************************************************************
      * Routines to do a sequential read of the QSAM file.            *
      *****************************************************************
       CUSTSQ01-GET.
           read CUSTSQ01-FILE
           if  CUSTSQ01-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  CUSTSQ01-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 'YES' to END-OF-FILE
               else
                   move 'CUUPDC01 CUSTSQ01-FAILURE-GET...'
                     to   MESSAGE-TEXT
                   move CUSTSQ01-STATUS to IO-STATUS
                   perform Z-DISPLAY-MESSAGE-TEXT
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTSQ01-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input CUSTSQ01-FILE
           if  CUSTSQ01-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CUUPDC01 CUSTSQ01-FAILURE-OPEN...'
                 to MESSAGE-TEXT
               move CUSTSQ01-STATUS to IO-STATUS
               perform Z-DISPLAY-MESSAGE-TEXT
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTSQ01-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close CUSTSQ01-FILE
           if  CUSTSQ01-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if

           if  APPL-AOK
               CONTINUE
           else
               move 'CUUPDC01, CUSTSQ01, FAILURE, CLOSE...'
                 to MESSAGE-TEXT
               move CUSTSQ01-STATUS to IO-STATUS
               perform Z-DISPLAY-MESSAGE-TEXT
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * Routines to do a read by KEY of the KSDS, VSAM Data Set. If   *
      * the read is successful then the record may be updated else a  *
      * new record may be added.                                      *
      *****************************************************************
       CUSTMAST-GET.
           read CUSTMAST-FILE
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  CUSTMAST-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 'YES' to END-OF-FILE
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-WRITE.
           write CUST-RECORD
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  CUSTMAST-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 'YES' to END-OF-FILE
               else
                   move 'CUUPDC01 CUSTMAST-FAILURE-WRITE...'
                     to   MESSAGE-TEXT
                   move CUSTMAST-STATUS to IO-STATUS
                   perform Z-DISPLAY-MESSAGE-TEXT
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-REWRITE.
           REWRITE CUST-RECORD
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  CUSTMAST-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 'YES' to END-OF-FILE
               else
                   move 'CUUPDC01 CUSTMAST-FAILURE-REWRITE...'
                     to   MESSAGE-TEXT
                   move CUSTMAST-STATUS to IO-STATUS
                   perform Z-DISPLAY-MESSAGE-TEXT
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open I-O CUSTMAST-FILE
           if  CUSTMAST-STATUS = '35'
               move 'CUUPDC01 CUSTMAST-FAILURE-OPEN-IO...'
                 to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               move 'CUUPDC01 CUSTMAST-ATTEMPT-OPEN-OUTPUT...'
                 to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               open output CUSTMAST-FILE
           end-if
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CUUPDC01 CUSTMAST-FAILURE-OPEN...'
                 to MESSAGE-TEXT
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-MESSAGE-TEXT
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTMAST-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close CUSTMAST-FILE
           if  CUSTMAST-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CUUPDC01 CUSTMAST-FAILURE-CLOSE...'
                 to   MESSAGE-TEXT
               move CUSTMAST-STATUS to IO-STATUS
               perform Z-DISPLAY-MESSAGE-TEXT
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * 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 'CUUPDC01 PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * two digits if the full two byte file status is numeric. If    *
      * second byte is non-numeric then it will be treated as a       *
      * binary number.                                                *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               display '* CUUPDC01 FILE-STATUS-' IO-STAT1 '/'
                       TWO-BYTES-BINARY
           else
               display '* CUUPDC01 FILE-STATUS-' IO-STATUS
           end-if
           exit.

      *****************************************************************
       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.

      *****************************************************************
       Z-POST-COPYRIGHT.
           display SIM-TITLE
           display SIM-COPYRIGHT
           exit.

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01
           display SIM-THANKS-02
           exit.
      *****************************************************************
      *      This example is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section Extract Data, Expand Numeric Fields

This is actually two COBOL programs. The first program does the File I/O of reading the Customer Master File and writing reformatted records to a sequential file. The File I/O program calls the second program to do the record formatting that expands the numeric fields and does blank truncation on the text fields and then places a comma between the fields as the field delimiter.

This link is provided to view the file extract programs that are provided in a separate document.

Table of Contents Previous Section Next Section Convert, EBCDIC to ASCII

This is actually two COBOL programs. The first program does the File I/O of reading the Customer Master File and writing reformatted records to a sequential file. The File I/O program calls the second program to do the record formatting that expands the numeric fields and does blank truncation on the text fields and then places a comma between the fields as the field delimiter.

This link is provided to view the file extract programs that are provided in a separate document.

Table of Contents Previous Section Next Section Convert File Format

This is a single COBOL program. The program does the File I/O of reading a record sequential file and writing to a line sequential file (Micro Focus terminology for an ASCII/Text file).

This link is provided to view the file extract programs that are provided in a separate document.

Table of Contents Previous Section Next Section Convert File Format & Record Content

This is actually two COBOL programs. The first program does the File I/O of reading a record sequential file and writing to a line sequential file (Micro Focus terminology for an ASCII/Text file). The File I/O program calls the second program to do the EBCDIC to ASCII conversion of the 256 byte record.

This link is provided to view the file extract programs that are provided in a separate document.

Table of Contents Previous Section Next Section Diagnostic Aids

This section provides access to documents with sample programs that will describe and demonstrate how to create and/or use tools that will assist in the validation and review of data structures that contain customer information.

Table of Contents Previous Section Next Section Hex-Dump of Customer Master

This is an interesting program that would have required an assembler routine prior to the introduction of COBOL/2 for the mainframe. This program reads the Customer Master File that is a VSAM, Keyed-Sequential-Data-Set (KSDS) and writes a variable-length, sequential file that contains hexadecimal information. Records to be written to the Hex-Dump file are selected based on a list of primary keys in a control file.

Link to Internet   Link to Server   Explore How to Create Hexadecimal Dump information for the records in a Customer Master file. The Customer Master file is a VSAM, KSDS. This document describes a process for generating a COBOL program that will read a VSAM/KSDS and write hexadecimal dump information to a sequential file. The user may define the records to be dumped by providing a list of primary keys in a control file. A second COBOL program is called to write the HEX-Dump information to a sequential file that contains variable length records.

Table of Contents Previous Section Next Section Summary

This suite of sample programs describes how to create a "Customer Master 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 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 How to Create and Populate a Customer Master File with generic test data. This document describes a simple process for creating test data for a customer master file. This simple process may be used with a traditional Record Sequential File, a VSAM Data Set or a Relational Data Base Table.

Link to Internet   Link to Server   Explore How to Create a New or Update an Existing Customer Data Set that is a VSAM Key-Sequenced-Data-Set (KSDS). This document will describe the jobs and programs that create and maintain a Customer Data Set. The program will run on an IBM Mainframe System or a Linux, UNIX or Windows System with Micro Focus COBOL Support.

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 connection.

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.

Explore the GnuCOBOL Technologies available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run time support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will require 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
Customer Master File, Creation and Maintenance of a VSAM, KSDS
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com