Item Master File Create and Update in Batch Mode |
The SimoTime Home Page |
Many of the sample programs provided by SimoTime use an "Item Master File" to get data that is used to demonstrate various processing or data accessing techniques. This suite of sample programs describes how to create this "Item Master File". On the mainframe the Item Master File will be a VSAM, Key-Sequenced-Data-Set (or VSAM, KSDS. In the Micro Focus environment the Item Master File will be an Indexed or Key-Sequenced file. The record length is 512 bytes. The key length is 12 bytes starting in position 1 of each record.
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
This suite of programs illustrates the following functions.
| ||||||||||||||
Programming Objectives and Functions |
This suite of sample programs will run on the following platforms
| ||||||
Platform or System Requirements |
The following describes the process flow for the jobs to be submitted to create an Item Master File.
| ||||||||
Create and Populate an Item Master File |
The record structure for the Item 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 lengths 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.
The following (ITEMCB01.cpy) shows the content of the COPY File.
***************************************************************** * ITEMCB01.CPY - a COBOL Copy File * * An Item Master File used by the Demo programs. * * This is a VSAM Keyed-Sequential-Data-Set or Key-Indexed File. * * Copyright (C) 1987-2019 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 * ***************************************************************** * 01 ITEM-RECORD. 05 ITEM-NUMBER PIC 9(12). COL-A 05 ITEM-DATA. 10 ITEM-DESCRIPTION PIC X(48). COL-B 10 ITEM-QTY-ONHAND PIC 9(7) COMP. COL-C 10 ITEM-QTY-ALLOCATED PIC 9(7) COMP. COL-D 10 ITEM-UNIT-OF-MEASURE PIC X(16). COL-E 10 ITEM-COST PIC S9(7)V9(2) COMP-3. COL-F 10 ITEM-PRICE PIC S9(7)V9(2) COMP-3. COL-G 10 ITEM-LADATE PIC X(8). COL-H 10 ITEM-LATIME PIC X(8). COL-I 10 ITEM-TOKEN PIC X(3). 10 ITEM-DISCOUNT OCCURS 3 TIMES. 15 ITEM-D-CODE PIC X. 15 ITEM-D-PERCENT PIC S9(3)V9(4). 10 FILLER PIC X(375). * *** ITEMCB01 - End-of-Copy File - - - - - - - - - - - ITEMCB01 * ***************************************************************** *
The Record Structure for the Item 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.
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.
| ||||||||
Systems and sub-Systems |
The following (ITCRTJ01.jcl) is a listing of the job needed to create the Item Master File.
//ITCRTJ01 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program 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. The key is twelve //* characters starting at the first position in the record. //* The record length is 512 characters. //* //* This set of programs will run on a mainframe under MVS or on a //* Personal Computer with Windows and Micro Focus Mainframe Express. //* //* ******************************************************************* //* Step 1 This is a single step job. //* //ITCRTS01 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER (NAME(SIMOTIME.DATA.ITEMMAST) - TRACKS(45 15) - RECORDSIZE(512 512) - FREESPACE(10 15) - KEYS(12 0) - INDEXED) - DATA (NAME(SIMOTIME.DATA.ITEMMAST.DAT) - CISZ(8192)) - INDEX (NAME(SIMOTIME.DATA.ITEMMAST.IDX)) /* //*
The following (ITCSQJ01.jcl) is a listing of the job needed to create a sequential file containing customer data
//ITCSQJ01 JOB SIMOTIME,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program 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 (ITCSQS01) 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. //* //* ************ //* * ITCSQJ01 * //* ********jcl* //* * //* * //* ************ ************ //* * IEFBR14 ******* ITEMSQ01 * //* ********utl* ***delete*** //* * //* * //* ************ ************ ************ //* * SYSUT2 ******* IEBGENER ******* ITEMSQ01 * //* ********jcl* ********utl* *******qsam* //* * //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 of 2 Delete any previously created file... //* //SQ01DELT EXEC PGM=IEFBR14 //ITEMSQ01 DD DSN=SIMOTIME.DATA.ITEMSQ01,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... //* //ITCSQS01 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //* :....1....:....2....:....3....:....4....:....5....:....6....:....7....:....8 //SYSUT1 DD * /DE000000000001Distributor Cap /OH00000000000100006 /UM000000000001Each /PR0000000000016.98 /CS0000000000013.29 /DE000000000002Rotor /OH00000000000200018 /UM000000000002Each /PR0000000000022.95 /CS0000000000020.98 /DE000000000091Head Light /OH00000000009100003 /UM000000000091Each /PR00000000009114.79 /CS00000000009108.15 /DE000000000092Tail Light (12 Volt) /UM000000000092Pair /PR0000000000921.98 /CS00000000009200.79 /DE000000000093Dome Light (12 Volt) /UM000000000093Each /PR0000000000930.98 /CS00000000009300.49 /DE000000000101Spark Plug 6AG7 /UM000000000101Each /PR0000000001012.49 /CS00000000010100.98 /DE000000000201Lug Nut 1/2" /UM000000000201Each /PR0000000002010.98 /CS00000000020100.39 /* //SYSUT2 DD DSN=SIMOTIME.DATA.ITEMSQ01,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS) //
The following (ITUPDJ01.jcl) is a listing of the job needed to update the Item Master File.
//ITUPDJ01 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program 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. //* //* ************ //* * ITUPDJ01 * //* ********jcl* //* * //* * //* ************ ************ ************ //* * ITEMSQ01 *-----* ITUPDC01 *-----* ITEMMAST * //* *******qsam* ********cbl* *******vsam* //* * //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 This is a single step job. //* //ITUPDS01 EXEC PGM=ITUPDC01 //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //ITEMSQ01 DD DSN=SIMOTIME.DATA.ITEMSQ01,DISP=SHR //ITEMMAST DD DSN=SIMOTIME.DATA.ITEMMAST,DISP=SHR //*
The following (ITEXTJ01.jcl) is a listing of the batch job needed to extract data from the Item Master File.
//ITEXTJ01 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This program 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 Item 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 * //* ************ ************ //* * * //* ************ ************ //* * ITEXTJ01 * * ITEXTJ01 * //* ********jcl* ********cmd* //* * * //* ************ * //* * IEFBR14 * * //* ********utl* * //* * * //* ********************************* //* * //* * //* ************ ************ ************ //* * ITEMMAST *----* ITMEXTC1 *----* ITEMRCSV * //* ************ ********cbl* ********dat* //* * * //* * * //* * *---CALL----* //* * * //* * * //* * ************ //* * * ITMEXTR1 * //* * ********cbl* //* * //* ************ //* * EOJ * //* ************ //* //* ******************************************************************* //* Step 1 of 2 This job step will delete a previously created file. //* //DELTSEQ1 EXEC PGM=IEFBR14 //ITEMRCSV DD DSN=SIMOTIME.DATA.ITEMRCSV,DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=256,DSORG=PS) //* ******************************************************************* //* Step 2 of 2 Execute the Sample programs.... //* //CBLEXTS1 EXEC PGM=ITMEXTC1 //STEPLIB DD DSN=MFI01.SIMOPROD.LOADLIB,DISP=SHR //ITEMMAST DD DSN=SIMOTIME.DATA.ITEMMAST,DISP=SHR //ITEMRCSV DD DSN=SIMOTIME.DATA.ITEMRCSV,DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=256,DSORG=PS) //SYSOUT DD * //*
This section includes a listing of the source code for the COBOL programs used to create, maintain and access the Item Master File.
The following (ITUPDC01.cbl) is a sample COBOL demonstration program. This program will "read from" a sequential file and "update records or add records" to the Item Master File. The program will compile and run in a Mainframe-oriented environment using an EBCDIC or ASCII encoded format.
IDENTIFICATION DIVISION. PROGRAM-ID. ITUPDC01. 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 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. * * * * 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. * * * * 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: ITUPDC01.CBL * Copy Files: QQSMREC1.CPY * ITEMCB01 ***************************************************************** * * ITUPDC01 - Execute ITUPDC01 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. * * ************ * * ITUPDJ01 * * ********jcl* * * * * * ************ ************ ************ * * ITEMSQ01 *-----* ITUPDC01 *-----* ITEMMAST * * *******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 * /DE Item Description change or correction * /UM Unit of Measure * /CS Cost * /PR Price * 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 ITEMSQ01-FILE ASSIGN to ITEMSQ01 ORGANIZATION is SEQUENTIAL ACCESS MODE is SEQUENTIAL FILE STATUS is ITEMSQ01-STATUS. SELECT ITEMMAST-FILE ASSIGN to ITEMMAST ORGANIZATION is indexed ACCESS MODE is RANDOM RECORD KEY is ITEM-NUMBER FILE STATUS is ITEMMAST-STATUS. ***************************************************************** DATA DIVISION. FILE SECTION. ***************************************************************** FD ITEMSQ01-FILE RECORD CONTAINS 80 CHARACTERS. COPY QSMCPYB2. FD ITEMMAST-FILE. COPY ITEMCB01. WORKING-STORAGE SECTION. ***************************************************************** * Data-structure for Title and Copyright... ***************************************************************** 01 SIM-TITLE. 05 T1 pic X(11) value '* ITUPDC01 '. 05 T2 pic X(34) value 'Read ITEMSQ01, Update ITEMMAST '. 05 T3 pic X(10) value ' v07.04.18'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* ITUPDC01 '. 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 '* ITUPDC01 '. 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 '* ITUPDC01 '. 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 ITEMMAST-STATUS. 05 ITEMMAST-STAT1 pic X. 05 ITEMMAST-STAT2 pic X. 01 ITEMSQ01-STATUS. 05 ITEMSQ01-STAT1 pic X. 05 ITEMSQ01-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 '* ITUPDC01 '. 05 MESSAGE-TEXT. 10 MESSAGE-TEXT-1 pic X(68) value SPACES. 10 MESSAGE-TEXT-2 pic X(188) value SPACES. 01 ITEMSQ01-FLAG pic X value 'N'. 01 APPL-RESULT pic S9(9) comp. 88 APPL-AOK value 0. 88 APPL-EOF value 16. 01 NBR-S09V2-SLS pic S9(9)V9(2) value 0 SIGN LEADING SEPARATE. 01 NBR-S09V2-SLS-X redefines NBR-S09V2-SLS pic X(12). 01 NBR-U05 pic 9(5) value 0. 01 PT-1 pic 9(3) value 0. 01 PT-2 pic 9(3) value 0. ***************************************************************** * Working Storage items for the Z-ROUTINES... * -----------------------------------------------------------* 01 Z-DATE-01. 05 Z-DATE-01-CC pic 9(02). 05 Z-DATE-01-YY pic 9(02). 05 Z-DATE-01-MM pic 9(02). 05 Z-DATE-01-DD pic 9(02). 01 Z-TIME-01. 05 Z-TIME-01-HH pic X(02). 05 Z-TIME-01-NN pic X(02). 05 Z-TIME-01-SS pic X(02). 05 Z-TIME-01-TT pic X(02). 01 Z-DATE-02. 05 Z-DATE-02-CC pic 9(02). 05 Z-DATE-02-YY pic 9(02). 05 FILLER pic X value '/'. 05 Z-DATE-02-MM pic 9(02). 05 FILLER pic X value '/'. 05 Z-DATE-02-DD pic 9(02). 01 Z-TIME-02. 05 Z-TIME-02-HH pic X(02). 05 FILLER pic X value ':'. 05 Z-TIME-02-NN pic X(02). 05 FILLER pic X value ':'. 05 Z-TIME-02-SS pic X(02). 05 FILLER pic X value ':'. 05 Z-TIME-02-TT pic X(02). 01 Z-X12 pic 9(3) value 0. 01 Z-WORK-12 pic X(12) value SPACES. ***************************************************************** PROCEDURE DIVISION. perform Z-POST-COPYRIGHT. move ZERO to RETURN-CODE perform ITEMSQ01-OPEN. perform ITEMMAST-OPEN. perform until END-OF-FILE = 'YES' if END-OF-FILE = 'NO ' perform ITEMSQ01-GET if END-OF-FILE = 'NO ' move QSAM-B2-RECORD to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move QSAM-B2-KEY to ITEM-NUMBER perform ITEMMAST-GET if ITEMMAST-STATUS = 23 initialize ITEM-DATA end-if perform MOVE-QSAM-FIELD-TO-KSDS-RECORD if ITEMSQ01-FLAG = 'Y' if APPL-AOK perform DATE-TIME-TOKEN-STAMP perform ITEMMAST-REWRITE else perform DATE-TIME-TOKEN-STAMP perform ITEMMAST-WRITE end-if end-if end-if end-if end-perform. perform ITEMMAST-CLOSE. perform ITEMSQ01-CLOSE. display 'ITUPDC01 ITEMMAST-HAS-BEEN-UPDATED' upon console display 'ITUPDC01 NORMAL-END-OF-JOB...' upon console perform Z-THANK-YOU. GOBACK. ***************************************************************** * The following routines are in alphabetic sequence. * ***************************************************************** ***************************************************************** DATE-TIME-TOKEN-STAMP. perform Z-GET-DATE-AND-TIME move Z-DATE-01 to ITEM-LADATE move Z-TIME-01 to ITEM-LATIME move '000' to ITEM-TOKEN exit. ***************************************************************** MOVE-QSAM-FIELD-TO-KSDS-RECORD. move 'Y' to ITEMSQ01-FLAG evaluate QSAM-B2-ID when '/DE' move QSAM-B2-DATA to ITEM-DESCRIPTION when '/UM' move QSAM-B2-DATA to ITEM-UNIT-OF-MEASURE when '/CS' perform UPDATE-COST when '/PR' perform UPDATE-PRICE when '/OH' perform UPDATE-ONHAND when other move 'N' to ITEMSQ01-FLAG end-evaluate exit. ***************************************************************** UPDATE-COST. move QSAM-B2-DATA to Z-WORK-12 perform Z-RIGHT-ADJUST-Z-WORK-12 * ITEM-COST move Z-WORK-12(11:2) to NBR-S09V2-SLS-X(11:2) move Z-WORK-12(1:9) to NBR-S09V2-SLS-X(2:9) move '+' to NBR-S09V2-SLS-X(1:1) add NBR-S09V2-SLS to ZERO giving ITEM-COST exit. ***************************************************************** UPDATE-PRICE. move QSAM-B2-DATA to Z-WORK-12 perform Z-RIGHT-ADJUST-Z-WORK-12 * ITEM-PRICE move Z-WORK-12(11:2) to NBR-S09V2-SLS-X(11:2) move Z-WORK-12(1:9) to NBR-S09V2-SLS-X(2:9) move '+' to NBR-S09V2-SLS-X(1:1) add NBR-S09V2-SLS to ZERO giving ITEM-PRICE exit. ***************************************************************** UPDATE-ONHAND. move QSAM-B2-DATA to Z-WORK-12 perform Z-RIGHT-ADJUST-Z-WORK-12 * ITEM-ONHAND move Z-WORK-12(8:5) to NBR-U05 add NBR-U05 to ZERO giving ITEM-QTY-ONHAND exit. ***************************************************************** * Routines to do a sequential read of the QSAM file. * ***************************************************************** ITEMSQ01-GET. read ITEMSQ01-FILE if ITEMSQ01-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if ITEMSQ01-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 'ITUPDC01 ITEMSQ01-FAILURE-GET...' to MESSAGE-TEXT move ITEMSQ01-STATUS to IO-STATUS perform Z-DISPLAY-MESSAGE-TEXT perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if exit. *---------------------------------------------------------------* ITEMSQ01-OPEN. add 8 to ZERO giving APPL-RESULT. open input ITEMSQ01-FILE if ITEMSQ01-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'ITUPDC01 ITEMSQ01-FAILURE-OPEN...' to MESSAGE-TEXT move ITEMSQ01-STATUS to IO-STATUS perform Z-DISPLAY-MESSAGE-TEXT perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* ITEMSQ01-CLOSE. add 8 to ZERO giving APPL-RESULT. close ITEMSQ01-FILE if ITEMSQ01-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'ITUPDC01, ITEMSQ01, FAILURE, CLOSE...' to MESSAGE-TEXT move ITEMSQ01-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. * ***************************************************************** ITEMMAST-GET. read ITEMMAST-FILE if ITEMMAST-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if ITEMMAST-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. *---------------------------------------------------------------* ITEMMAST-WRITE. write ITEM-RECORD if ITEMMAST-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if ITEMMAST-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 'ITUPDC01 ITEMMAST-FAILURE-WRITE...' to MESSAGE-TEXT move ITEMMAST-STATUS to IO-STATUS perform Z-DISPLAY-MESSAGE-TEXT perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if exit. *---------------------------------------------------------------* ITEMMAST-REWRITE. REWRITE ITEM-RECORD if ITEMMAST-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else if ITEMMAST-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 'ITUPDC01 ITEMMAST-FAILURE-REWRITE...' to MESSAGE-TEXT move ITEMMAST-STATUS to IO-STATUS perform Z-DISPLAY-MESSAGE-TEXT perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if end-if exit. *---------------------------------------------------------------* ITEMMAST-OPEN. add 8 to ZERO giving APPL-RESULT. open I-O ITEMMAST-FILE if ITEMMAST-STATUS = '35' move 'ITUPDC01 ITEMMAST-FAILURE-OPEN-IO...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT move ITEMMAST-STATUS to IO-STATUS perform Z-DISPLAY-IO-STATUS move 'ITUPDC01 ITEMMAST-ATTEMPT-OPEN-OUTPUT...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT open output ITEMMAST-FILE end-if if ITEMMAST-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'ITUPDC01 ITEMMAST-FAILURE-OPEN...' to MESSAGE-TEXT move ITEMMAST-STATUS to IO-STATUS perform Z-DISPLAY-MESSAGE-TEXT perform Z-DISPLAY-IO-STATUS perform Z-ABEND-PROGRAM end-if exit. *---------------------------------------------------------------* ITEMMAST-CLOSE. add 8 to ZERO giving APPL-RESULT. close ITEMMAST-FILE if ITEMMAST-STATUS = '00' subtract APPL-RESULT from APPL-RESULT else add 12 to ZERO giving APPL-RESULT end-if if APPL-AOK CONTINUE else move 'ITUPDC01 ITEMMAST-FAILURE-CLOSE...' to MESSAGE-TEXT move ITEMMAST-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 'ITUPDC01 PROGRAM-IS-ABENDING...' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT add 12 to ZERO giving RETURN-CODE STOP RUN. * exit. ***************************************************************** Z-GET-DATE-AND-TIME. * This routine requires COBOL for 390 dialect because of * the use of the YYYYMMDD on the ACCEPT statement. accept Z-DATE-01 from DATE YYYYMMDD accept Z-TIME-01 from TIME move 'ccyy/mm/dd' to Z-DATE-02 move Z-DATE-01(1:4) to Z-DATE-02(1:4) move Z-DATE-01(5:2) to Z-DATE-02(6:2) move Z-DATE-01(7:2) to Z-DATE-02(9:2) move 'hh:mm:ss:dd' to Z-TIME-02 move Z-TIME-01(1:2) to Z-TIME-02(1:2) move Z-TIME-01(3:2) to Z-TIME-02(4:2) move Z-TIME-01(5:2) to Z-TIME-02(7:2) move Z-TIME-01(7:2) to Z-TIME-02(10:2) exit. ***************************************************************** * 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 '* ITUPDC01 FILE-STATUS-' IO-STAT1 '/' TWO-BYTES-BINARY upon console display '* ITUPDC01 FILE-STATUS-' IO-STAT1 '/' TWO-BYTES-BINARY else display '* ITUPDC01 FILE-STATUS-' IO-STATUS upon console display '* ITUPDC01 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. ***************************************************************** * Delete all characters to the right of the first space then * right-adjust with zero fill. This routine works with a single, * twelve character field and does not require a work area. ***************************************************************** Z-RIGHT-ADJUST-Z-WORK-12. * The following INSPECT statement will erase to end-of-field * any characters after the first space character. inspect Z-WORK-12 replacing CHARACTERS by ' ' after initial ' ' * The following IF logic is for performance. It quickly * reduces the number of loops for the PERFORM logic. if Z-WORK-12(7:6) = SPACES if Z-WORK-12(4:3) = SPACES move Z-WORK-12(1:3) to Z-WORK-12(10:3) move all ZEROES to Z-WORK-12(1:9) else move Z-WORK-12(1:6) to Z-WORK-12(7:6) move all ZEROES to Z-WORK-12(1:6) end-if else if Z-WORK-12(10:3) = SPACES * The following three MOVE statements are used to * avoid a potential problem with an overlapping MOVE. move Z-WORK-12(7:3) to Z-WORK-12(10:3) move Z-WORK-12(4:3) to Z-WORK-12(7:3) move Z-WORK-12(1:3) to Z-WORK-12(4:3) move all ZEROES to Z-WORK-12(1:3) end-if end-if perform until Z-WORK-12(12:1) not = SPACE if Z-WORK-12(12:1) = SPACE add 11 to ZERO giving Z-X12 perform 11 times move Z-WORK-12(Z-X12:1) to Z-WORK-12(Z-X12 + 1:1) subtract 1 from Z-X12 end-perform move ZERO to Z-WORK-12(1:1) end-if end-perform 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 * *****************************************************************
This is actually two COBOL programs. The first program does the File I/O of reading the Item 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.
Explore How to Extract and Convert Information from an Item Master File and view or change the information from Excel or a text editor. This document describes how to read the Item Master File (VSAM/KSDS) that contains records with a fixed-field-length format and write to a sequential file with records in a Comma-Separated-Values (CSV) format.
The following will do a File Format or Record Content conversion of the Item File.
This is actually two COBOL programs. The first program does the File I/O of reading the Item 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.
Explore How to do Record Content Conversion of an Item Master File changing the encoding schema from EBCDIC to ASCII. This process does not change the original file, it creates a new file of converted data.
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).
Explore How to do File Format Conversion of a Record Sequential File to a Line Sequential File (or ASCII/Text File).
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.
Explore How to do File Format and Record Content Conversion of a Record Sequential File with EBCDIC encoded records to a Line Sequential File (or ASCII/Text File) with ASCII encoded records.
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 item (or product) information.
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 Item 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.
Explore How to Produce a Hex-Dump for a Record or group of records in an Item File that is a VSAM, KSDS. The Hex-Dump information will be written to an ASCII/Text File and may be easily viewed using a text editor such as NotePAD.
This suite of sample programs describes how to create an "Item 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.
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.
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.
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 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 icon.
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.
Explore the non-Relational Data Connection for more examples of accessing methodologies and coding techniques for Data Files and VSAM Data Sets.
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.
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.
Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an internet connect.
This suite of programs and documentation is available for download. 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 Glossary of Terms for a list of terms and definitions used in this suite of documents and white papers.
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.
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 |
Item Master File, Batch Create and Maintain |
Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |