Customer Table (SQL)
CICS - Read, Update or Insert a Row
  Table of Contents  v-16.01.01 - cq2upd01.htm 
  Introduction
  Inquiry Program, Customer Table
  Update Program, Customer Table
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Comments or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This transaction (CQU1) uses a suite of COBOL programs and BMS map sets that will provide relational data base inquiry or update functionality for a Customer Table. The programs use embedded EXEC SQL statements to access the Customer Table and display information to a 3270 terminal or terminal emulator. The programs originally ran on an IBM Mainframe System with CICS and DB/2. The programs now run on a Microsoft Windows System with SQL Server and Micro Focus Server, Enterprise Edition.


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

Table of Contents Previous Section Next Section Inquiry Program, Customer Table

The Customer Table Inquiry Screen contains a prompt for a new Customer Number and the customer information from a previous request. Once a new customer number is entered the Customer Table is accessed and the new information is displayed.

 CQ2UPD1                Relational Data Base Management              2009/08/03 
 STOA                Customer Table View and Update Option          14:32:51:92

      New Customer #: 000000001900

          Customer #: 000000001900
           Last Name: Smith
               First: Sammy                         Middle:

              Addr-1: 1919 Carnoustie Drive
              Addr-2:
                City: Novato
      State/Province: CA                       Postal Code: 94919

        *--------------------------Telephone Numbers--------------------------* 
        Home                   Work                  Cell

        Last Activity Date:              Time:               Token:




                 PF3=Menu                 F9=Updt                       F12=Esc

Once the information has been retrieved the customer information may be changed and Program Function Key (F9) may be used to update the customer table. If another customer needs to be viewed and updated simply position the cursor to the first position of the "New Customer #" field and enter a new customer number.

Note: PF3 will end this transaction and display the sub-Menu for "Relational Data Base Management". PF12 will end this session and return to the CICS prompt screen.

Table of Contents Previous Section Next Section Update Program, Customer Table

The following is the source code (CQ2UPD.cbl) for a CICS program that updates the Customer Table.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.  CQ2UPD.
       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       *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1989/02/27 Simmons, Created program.
      * 1997/03/17 Simmons, Updated for SYSID.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.

      *****************************************************************
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  VERSION-NUMBER       pic X(9)   value 'V01.00.00'.
       01  PF-ROW-23.
           05  filler           pic X(3)   value SPACES.
           05  PF-ROW-23-04     pic X(8)   value SPACES.
           05  PF-ROW-23-12     pic X(8)   value SPACES.
           05  PF-ROW-23-20     pic X(8)   value 'F3=Menu '.
           05  PF-ROW-23-28     pic X(8)   value SPACES.
           05  PF-ROW-23-36     pic X(8)   value SPACES.
           05  PF-ROW-23-44     pic X(8)   value SPACES.
           05  PF-ROW-23-52     pic X(8)   value SPACES.
           05  PF-ROW-23-60     pic X(8)   value SPACES.
           05  PF-ROW-23-68     pic X(8)   value 'F12=Esc '.
           05  filler           pic X(3)   value SPACES.

       01  EOJ-MESSAGE          pic X(50)
           value '     - Enter Tran ID . . .        completed CQ2UPD'.

       01  RECORD-LENGTH-512    pic S9(4)  comp    value 512.
       01  XCTL-RESP-CODE       pic 9(08)  comp.
       01  NUMBER-WORK-16       pic 9(16)  value 0.

       01  X-EIB-MESSAGE.
           05  filler           pic X(8)   value 'EIBRESP='.
           05  X-EIB-RESP       pic 9(10)  value 0.
           05  filler           pic X(11)  value ', EIBRESP2='.
           05  X-EIB-RESP2      pic 9(10)  value 0.
           05  filler           pic X      value SPACE.
           05  X-EIB-USER-MSG   pic X(38)  value SPACES.

       01  CUSTOMER-READ-KEY    pic X(12).
       01  MSG-LINE-1           pic X(78)  value LOW-VALUES.
       01  MSG-LINE-2           pic X(78)  value LOW-VALUES.

       01  SYS-ID               pic X(4).

       01  WORK-DATE.
           05  WORK-DATE-CC     pic X(02).
           05  WORK-DATE-YY     pic 9(02).
           05  WORK-DATE-MM     pic X(02).
           05  WORK-DATE-DD     pic 9(02).
       01  WORK-TIME.
           05  WORK-TIME-HH     pic X(02).
           05  WORK-TIME-NN     pic X(02).
           05  WORK-TIME-SS     pic X(02).
           05  WORK-TIME-TT     pic X(02).

       01  Z-WORK-12            pic X(12)   value SPACES.
       01  IX-12                pic 9(3)    value 0.

       01  PROGRAM-NAME         pic x(8)    value SPACES.

       01  WS-RESPONSE         pic S9(8) comp.
       01  WS-REASON-CODE      pic S9(8) comp.

       01  LOCAL-TRAN-ID        pic X(4)    value 'CQU1'.

       01  PROGRAM-FLAGS.
           05  P-FLAG-ANIM      pic X      value 'N'.
           05  P-FLAG-JOURNAL   pic X      value 'Y'.

       01  WORK-ITEMS.
           05  WS-ESD128-RIDFLD PIC S9(8)     COMP VALUE +0.
           05  WS-ESD01K-RIDFLD PIC S9(8)     COMP VALUE +0.
           05  WS-ESD350-RIDFLD PIC S9(8)     COMP VALUE +0.

       01  ESD128-RECORD.
           05  ESD128-DATA      pic X(128) value SPACES.
       01  ESD128-FILE          pic X(8)   value 'ESDSC128'.

       01  ESD01K-RECORD.
           05  ESD01K-DATA      pic X(128) value SPACES.
       01  ESD01K-FILE          pic X(8)   value 'ESDSC01K'.

       01  ESD350-RECORD.
           05  ESD350-DATA      pic X(350) value SPACES.
       01  ESD350-FILE          pic X(8)   value 'ESDSC350'.

       01  SQLCODE-ZD           pic S9(5)  SIGN TRAILING SEPARATE
                                           value 0.
       01  SQLCODE-ZD-GROUP     redefines  SQLCODE-ZD
                                pic X(6).

       01  PARAGRAPH-NAME       pic X(34)  value SPACES.
       01  CONNECT-FLAG         pic X      value 'N'.
       01  DBNAME               pic X(8)   value 'CHSTRDB1'.

          COPY CQ2UPD1.
          COPY DFHBMSCA.
          COPY DFHAID.
      *   COPY DFHEIBLK.

      *    ------------------------------------------------------------
           EXEC SQL INCLUDE SQLCA         END-EXEC.

           EXEC SQL BEGIN DECLARE SECTION END-EXEC.
       01  WS-SRV1-NAME                PIC  X(32) VALUE
           'ACC1DEVL                        '.
       01  WS-SRV1-USER-PSWD           PIC  X(32) VALUE
           'Larry.LRSPWD01                  '.
       01  WS-SRV2-NAME                PIC  X(32) VALUE
           'CHSTRDB1                        '.
       01  WS-SRV2-USER-PSWD           PIC  X(32) VALUE
           'Larry2.LRSPWD02                 '.
           EXEC SQL INCLUDE CUSTCQ01      END-EXEC.
           EXEC SQL end DECLARE SECTION   END-EXEC.

      *****************************************************************
       LINKAGE SECTION.
       01  DFHCOMMAREA.
           03  LS-CUSTNO         pic X(12).
           03  filler            pic X(4096).

      *****************************************************************
       PROCEDURE DIVISION.
           if  P-FLAG-ANIM = 'Y'
               CALL 'CBL_DEBUGBREAK'
           end-if.

           perform CLEAR-MESSAGES

           EXEC CICS HANDLE CONDITION
                ERROR   (GENERAL-ERROR-ROUTINE)
                MAPFAIL (MAP-FAIL-ROUTINE)
                NOTFND  (GENERAL-ERROR-ROUTINE)
                END-EXEC.

           evaluate TRUE
             when EIBCALEN = ZERO
                  perform SCREEN-IO-SEND-UPDATE
             when EIBAID   = DFHPF1
                  perform ACC1DEVL-SET-CONNECT
             when EIBAID   = DFHPF3
                  perform END-OF-PROGRAM-03
             when EIBAID   = DFHPF4
                  perform ACC1DEVL-CONNECT
             when EIBAID   = DFHPF5
                  perform ACC1DEVL-DISCONNECT
             when EIBAID   = DFHPF9
                  perform UPDATE-CUSTOMER-INFORMATION
             when EIBAID   = DFHPF12
                  perform END-OF-PROGRAM-12
             when EIBAID   = DFHENTER
                  perform GET-CUSTOMER-INFORMATION
             when other
                  move 'Type a new request and press the ENTER key'
                  to MSG-LINE-1
                  perform RECOVERY-ROUTINE
           end-evaluate.
      *    Should never get to here...
           perform END-OF-PROGRAM-12.

      *****************************************************************
       BUILD-HEADER-INFO.
           EXEC CICS ASSIGN
                SYSID(SYS-ID)
                END-EXEC.

           move 'CQ2UPD1 ' to SYSPAGEO
           move SYS-ID to SYS-IDO.
           perform Z-GET-DATE-AND-TIME.
           exit.

      *****************************************************************
       BUILD-MSG-LINE-2.
           move 'SQLCODE =  &&&&&&, SQLSTATE = &&&&&'
             to MSG-LINE-2
           add SQLCODE to ZERO giving SQLCODE-ZD
           inspect MSG-LINE-2 replacing first '&&&&&&'
                                           by SQLCODE-ZD-GROUP
           inspect MSG-LINE-2 replacing first '&&&&&'
                                           by SQLSTATE
           move PARAGRAPH-NAME to MSG-LINE-2(45:34)
           exit.

      *****************************************************************
       CUSTACC1-SELECT.
           EXEC SQL
                SELECT CUQ1_NUMBER,
                       CUQ1_STATUS,
                       CUQ1_LAST_NAME,
                       CUQ1_FIRST_NAME,
                       CUQ1_MID_NAME,
                       CUQ1_ADDRESS_1,
                       CUQ1_ADDRESS_2,
                       CUQ1_CITY,
                       CUQ1_STATE,
                       CUQ1_POSTAL_CODE,
                       CUQ1_PHONE_HOME,
                       CUQ1_PHONE_WORK,
                       CUQ1_PHONE_CELL,
                       CUQ1_LADATE,
                       CUQ1_LATIME,
                       CUQ1_TOKEN
                INTO :CUQ1-NUMBER,
                     :CUQ1-STATUS,
                     :CUQ1-LAST-NAME,
                     :CUQ1-FIRST-NAME,
                     :CUQ1-MID-NAME,
                     :CUQ1-ADDRESS-1,
                     :CUQ1-ADDRESS-2,
                     :CUQ1-CITY,
                     :CUQ1-STATE,
                     :CUQ1-POSTAL-CODE,
                     :CUQ1-PHONE-HOME,
                     :CUQ1-PHONE-WORK,
                     :CUQ1-PHONE-CELL,
                     :CUQ1-LADATE,
                     :CUQ1-LATIME,
                     :CUQ1-TOKEN
                FROM CUSTACC1
                WHERE CUQ1_NUMBER = :CUQ1-NUMBER
           END-EXEC

           if  SQLCODE NOT = ZERO
               initialize CUQ1-RECORD
           end-if
           exit.
      *---------------------------------------------------------------*
       CUSTACC1-INSERT.
           EXEC SQL
                INSERT into CUSTACC1
                 (
                  CUQ1_NUMBER,
                  CUQ1_STATUS,
                  CUQ1_LAST_NAME,
                  CUQ1_FIRST_NAME,
                  CUQ1_MID_NAME,
                  CUQ1_ADDRESS_1,
                  CUQ1_ADDRESS_2,
                  CUQ1_CITY,
                  CUQ1_STATE,
                  CUQ1_POSTAL_CODE,
                  CUQ1_PHONE_HOME,
                  CUQ1_PHONE_WORK,
                  CUQ1_PHONE_CELL,
                  CUQ1_LADATE,
                  CUQ1_LATIME,
                  CUQ1_TOKEN
                 )
                VALUES
                 (
                  :CUQ1-NUMBER,
                  :CUQ1-STATUS,
                  :CUQ1-LAST-NAME,
                  :CUQ1-FIRST-NAME,
                  :CUQ1-MID-NAME,
                  :CUQ1-ADDRESS-1,
                  :CUQ1-ADDRESS-2,
                  :CUQ1-CITY,
                  :CUQ1-STATE,
                  :CUQ1-POSTAL-CODE,
                  :CUQ1-PHONE-HOME,
                  :CUQ1-PHONE-WORK,
                  :CUQ1-PHONE-CELL,
                  :CUQ1-LADATE,
                  :CUQ1-LATIME,
                  :CUQ1-TOKEN
                 )
           END-EXEC

      *    if SQLCODE = 0
      *        if  DEBUG-FLAG = 'Y'
      *            display 'Complete, INSERT FOR CUSTACC1'
      *                    'SQLCODE = ' SQLCODE
      *                    ' Customer = ' CUQ1-NUMBER
      *        end-if
      *    else
      *       display 'ABENDING! INSERT FOR CUSTACC1'
      *               ' Customer = ' CUQ1-NUMBER
      *       perform Z-DISPLAY-SQL-CODE
      *       add 16 to ZERO giving RETURN-CODE
      *    end-if
           exit.
      *---------------------------------------------------------------*
       CUSTACC1-UPDATE.
           EXEC SQL
                UPDATE CUSTACC1
                SET CUQ1_NUMBER = :CUQ1-NUMBER,
                    CUQ1_STATUS = :CUQ1-STATUS,
                    CUQ1_LAST_NAME = :CUQ1-LAST-NAME,
                    CUQ1_FIRST_NAME = :CUQ1-FIRST-NAME,
                    CUQ1_MID_NAME = :CUQ1-MID-NAME,
                    CUQ1_ADDRESS_1 = :CUQ1-ADDRESS-1,
                    CUQ1_ADDRESS_2 = :CUQ1-ADDRESS-2,
                    CUQ1_CITY = :CUQ1-CITY,
                    CUQ1_STATE = :CUQ1-STATE,
                    CUQ1_POSTAL_CODE = :CUQ1-POSTAL-CODE,
                    CUQ1_PHONE_HOME = :CUQ1-PHONE-HOME,
                    CUQ1_PHONE_WORK = :CUQ1-PHONE-WORK,
                    CUQ1_PHONE_CELL = :CUQ1-PHONE-CELL,
                    CUQ1_LADATE = :CUQ1-LADATE,
                    CUQ1_LATIME = :CUQ1-LATIME,
                    CUQ1_TOKEN = :CUQ1-TOKEN
                WHERE CUQ1_NUMBER = :CUQ1-NUMBER
           END-EXEC.

      *    if  SQLCODE = 0
      *        if  DEBUG-FLAG = 'Y'
      *            display 'Complete, UPDATE FOR CUSTACC1'
      *                    CUQ1-NUMBER
      *        end-if
      *    else
      *        display 'ABENDING, UPDATE FOR CUSTACC1 '
      *                ' Customer = ' CUQ1-NUMBER
      *        perform Z-DISPLAY-SQL-CODE
      *        add 16 to ZERO giving RETURN-CODE
      *    end-if
           exit.

      *****************************************************************
       ACC1DEVL-CONNECT.
           EXEC SQL
                CONNECT TO :WS-SRV1-NAME AS 'SVR1'
                USER :WS-SRV1-USER-PSWD
           END-EXEC
           evaluate SQLCODE
             when 0
               move 'Y' to CONNECT-FLAG
               move 0 to RETURN-CODE
               move '* ACC1DEVL Data Base CONNECT is Successful'
                 to MSG-LINE-1
               EXEC SQL
                    DECLARE B DATABASE
               END-EXEC
               when OTHER
               move '* ACC1DEVL ABENDING! CONNECT Failed'
                 to MSG-LINE-1
           end-evaluate
           perform BUILD-MSG-LINE-2
           perform RECOVERY-ROUTINE
           exit.

      *****************************************************************
       ACC1DEVL-SET-CONNECT.
           EXEC SQL set connection 'SVR1' END-EXEC
           evaluate SQLCODE
             when 0
               move 'Y' to CONNECT-FLAG
               move 0 to RETURN-CODE
               move '* ACC1DEVL set CONNECT is Successful'
                 to MSG-LINE-1
             when OTHER
               move '* ACC1DEVL ABENDING! setCONNECT Failed'
                 to MSG-LINE-1
           end-evaluate
           perform BUILD-MSG-LINE-2
           perform RECOVERY-ROUTINE
           exit.

      *****************************************************************
       ACC1DEVL-DISCONNECT.
           EXEC SQL DISCONNECT 'SVR1' END-EXEC
           evaluate SQLCODE
             when 0
               move 'N' to CONNECT-FLAG
               move 0 to RETURN-CODE
               move '* ACC1DEVL Data Base DISCONNECT is Successful'
                 to MSG-LINE-1
             when OTHER
               move '* ACC1DEVL ABENDING! DISCONNECT Failed'
                 to MSG-LINE-1
           end-evaluate
           perform BUILD-MSG-LINE-2
           perform RECOVERY-ROUTINE
           exit.

      *****************************************************************
       CLEAR-MESSAGES.
           move SPACES to MSG-LINE-1
           move SPACES to MSG-LINE-2
           move SPACES to SYSMSG1O
           move SPACES to SYSMSG2O
           exit.

      *****************************************************************
       DATA-FILE-TO-SCREEN.
           move CUQ1-NUMBER      to REQNUMBO
           move CUQ1-NUMBER      to CUNUMBO
           move CUQ1-LAST-NAME   to CULNAMEO
           move CUQ1-FIRST-NAME  to CUFNAMEO
           move CUQ1-MID-NAME    to CUMNAMEO
           move CUQ1-ADDRESS-1   to CUADR1O
           move CUQ1-ADDRESS-2   to CUADR2O
           move CUQ1-CITY        to CUCITYO
           move CUQ1-STATE       to CUSTATEO
           move CUQ1-POSTAL-CODE to CUZIPO
           move CUQ1-PHONE-HOME  to CUPHONHO
           move CUQ1-PHONE-WORK  to CUPHONWO
           move CUQ1-PHONE-CELL  to CUPHONCO
           move CUQ1-LADATE      to CULDATEO
           move CUQ1-LATIME      to CULTIMEO
           if  CUQ1-TOKEN is NUMERIC
               move CUQ1-TOKEN       to CUTOKENO
           else
               move CUQ1-TOKEN       to CUTOKENO
           exit.

      *****************************************************************
       DATA-INITIALIZE-SCREEN-RECORD.
           move SPACES to REQNUMBO
                          CUNUMBO
                          CULNAMEO
                          CUFNAMEO
                          CUMNAMEO
                          CUADR1O
                          CUADR2O
                          CUCITYO
                          CUSTATEO
                          CUZIPO
                          CUPHONHO
                          CUPHONWO
                          CUPHONCO
                          CULDATEO
                          CULTIMEO
                          CUTOKENO
                          SYSMSG1O
                          SYSMSG2O
           exit.

      *****************************************************************
       DATA-SCREEN-TO-FILE.
      *    move REQNUMBI to CUST-NUMBER
           move CUNUMBI  to CUQ1-NUMBER
           move CULNAMEI to CUQ1-LAST-NAME
           move CUFNAMEI to CUQ1-FIRST-NAME
           move CUMNAMEI to CUQ1-MID-NAME
           move CUADR1I  to CUQ1-ADDRESS-1
           move CUADR2I  to CUQ1-ADDRESS-2
           move CUCITYI  to CUQ1-CITY
           move CUSTATEI to CUQ1-STATE
           move CUZIPI   to CUQ1-POSTAL-CODE
           move CUPHONHI to CUQ1-PHONE-HOME
           move CUPHONWI to CUQ1-PHONE-WORK
           move CUPHONCI to CUQ1-PHONE-CELL
           move CULDATEI to CUQ1-LADATE
           move CULTIMEI to CUQ1-LATIME
           move CUTOKENI to CUQ1-TOKEN
           exit.

      *****************************************************************
       END-OF-PROGRAM-03.
           move 'MN1SQL  ' to PROGRAM-NAME
           perform TRANSFER-CONTROL
      *    Should never get to here...
           exit.

      *****************************************************************
       END-OF-PROGRAM-12.
           EXEC CICS SEND
                FROM   (EOJ-MESSAGE)
                LENGTH (50)
                ERASE
                END-EXEC

           EXEC CICS SEND
                CONTROL FREEKB
                END-EXEC

           EXEC CICS RETURN
                END-EXEC
           exit.

      *****************************************************************
       GENERAL-ERROR-ROUTINE.
           move '                         General Error'
             to X-EIB-USER-MSG
           add EIBRESP  to ZERO giving X-EIB-RESP
           add EIBRESP2 to ZERO giving X-EIB-RESP2
           move X-EIB-MESSAGE to MSG-LINE-2.
           perform RECOVERY-ROUTINE
      *    Should never get to here...
           exit.

      *****************************************************************
       GET-CUSTOMER-INFORMATION.
           perform SCREEN-IO-GET-DATA-FOR-INQUIRY
           move LS-CUSTNO to CUQ1-NUMBER
           perform CUSTACC1-SELECT

           if  SQLCODE = ZEROS
               move 'F9=Updt ' to PF-ROW-23-44
               perform DATA-FILE-TO-SCREEN
           else
               perform DATA-INITIALIZE-SCREEN-RECORD
               perform Z-GET-DATE-AND-TIME
               move WORK-DATE   to CUQ1-LADATE
               move WORK-TIME   to CUQ1-LATIME
               move 999         to CUQ1-TOKEN
               move LS-CUSTNO   to REQNUMBO
               move LS-CUSTNO   to CUNUMBO
               move CUQ1-LADATE to CULDATEO
               move CUQ1-LATIME to CULTIMEO
               move CUQ1-TOKEN  to CUTOKENO

               move 'F9=Add  '  to PF-ROW-23-44
               move LS-CUSTNO to MSG-LINE-1
               move '* Row not found, try again or Insert New Row... '
                 to MSG-LINE-1(14:48)
               add SQLCODE to ZERO giving X-EIB-RESP2

               perform RECOVERY-ROUTINE
           end-if.

           perform SCREEN-IO-SEND-UPDATE
      *    Should never get to here...
           exit.

      *****************************************************************
       MAP-FAIL-ROUTINE.
           move '                           Map Failure'
             to X-EIB-USER-MSG
           add EIBRESP  to ZERO giving X-EIB-RESP
           add EIBRESP2 to ZERO giving X-EIB-RESP2
           move X-EIB-MESSAGE to MSG-LINE-2.
           perform RECOVERY-ROUTINE
      *    Should never get to here...
           exit.

      *****************************************************************
       POST-MSG-2-EIBRESP.
           if  X-EIB-USER-MSG = SPACES
               move '                          EIB Response'
                 to X-EIB-USER-MSG
           end-if
           add EIBRESP  to ZERO giving X-EIB-RESP
           add EIBRESP2 to ZERO giving X-EIB-RESP2
           move X-EIB-MESSAGE to MSG-LINE-2.

           exit.

      *****************************************************************
       RECOVERY-ROUTINE.
           move MSG-LINE-1 to SYSMSG1O.
           move MSG-LINE-2 to SYSMSG2O.
           move -1 to REQNUMBL
           perform SCREEN-IO-SEND-UPDATE
      *    Should never get to here...
           exit.

      *****************************************************************
       SCREEN-IO-GET-DATA-FOR-INQUIRY.
           EXEC CICS RECEIVE
                MAP    ('CQ2UPD1')
                MAPSET ('CQ2UPD1')
                RESP(WS-RESPONSE)
                RESP2(WS-REASON-CODE)
                END-EXEC.
      *        Field Length > zero...
           if  REQNUMBL > ZERO
               move REQNUMBI to Z-WORK-12
               perform Z-RIGHT-ADJUST-Z-WORK-12
               move Z-WORK-12 to REQNUMBI
               move REQNUMBI to LS-CUSTNO
           else
               move 'Please enter a 12 digit customer number...'
                 to MSG-LINE-1
               perform RECOVERY-ROUTINE
           end-if.
           exit.

      *****************************************************************
       SCREEN-IO-GET-DATA-FOR-UPDATE.
           EXEC CICS RECEIVE
                MAP    ('CQ2UPD1')
                MAPSET ('CQ2UPD1')
                RESP(WS-RESPONSE)
                RESP2(WS-REASON-CODE)
                END-EXEC.
           if  REQNUMBL > ZERO
               move REQNUMBI to Z-WORK-12
               perform Z-RIGHT-ADJUST-Z-WORK-12
               move Z-WORK-12 to REQNUMBI
               move REQNUMBI to LS-CUSTNO
           end-if.
           exit.

      *****************************************************************
       SCREEN-IO-SEND-UPDATE.
           perform BUILD-HEADER-INFO
           move PF-ROW-23 to PFROW23O
           EXEC CICS SEND
                MAP    ('CQ2UPD1')
                MAPSET ('CQ2UPD1')
                ERASE
                END-EXEC
           move LOW-VALUES to CQ2UPD1O
           EXEC CICS RETURN
                TRANSID (LOCAL-TRAN-ID)
                COMMAREA (CQ2UPD1O)
                LENGTH    (4096)
                END-EXEC

      *    Should never get to here...
           exit.

      *****************************************************************
       TRANSFER-CONTROL.
           EXEC CICS XCTL
                PROGRAM(PROGRAM-NAME)
                RESP(XCTL-RESP-CODE)
                END-EXEC

      *    Should never get to here...
           move 'Program not found, &&&&&&&&' to MSG-LINE-1.
           inspect MSG-LINE-1 replacing first '&&&&&&&&'
                                          by PROGRAM-NAME
           move -1 to REQNUMBL.
           perform RECOVERY-ROUTINE.
      *    exit.

      *****************************************************************
       UPDATE-CUSTOMER-INFORMATION.
           perform SCREEN-IO-GET-DATA-FOR-UPDATE

           if  CUTOKENI = 999
               perform UPDATE-CUSTOMER-INFORMATION-02
           else
               perform UPDATE-CUSTOMER-INFORMATION-01
           end-if
           exit.

      *****************************************************************
       UPDATE-CUSTOMER-INFORMATION-01.
      *    Attempt to update an existing row
           move CUNUMBI to CUQ1-NUMBER
           perform CUSTACC1-SELECT

           if  SQLCODE not = 0
               add SQLCODE to ZERO giving NUMBER-WORK-16
               move 'ReRead Failed,  ' to MSG-LINE-1(1:16)
               move CUNUMBI            to MSG-LINE-1(16:12)
               move CUQ1-NUMBER        to MSG-LINE-1(30:12)
               move VERSION-NUMBER     to MSG-LINE-1(70:9)
               perform GENERAL-ERROR-ROUTINE
           end-if.

           perform DATA-SCREEN-TO-FILE

           perform Z-GET-DATE-AND-TIME
           move WORK-DATE to CUQ1-LADATE
           move WORK-TIME to CUQ1-LATIME
           move ZEROES to CUQ1-TOKEN

           perform CUSTACC1-UPDATE
           if  SQLCODE = 0
               move
               'Update Completed, type new request and press ENTER key'
               to MSG-LINE-1(1:54)
               move MSG-LINE-1 to SYSMSG1O
               move '        ' to PF-ROW-23-44
               perform SCREEN-IO-SEND-UPDATE
           else
               add SQLCODE to ZERO giving NUMBER-WORK-16
               move 'Update Failed,  ' to MSG-LINE-1(1:16)
               move CUNUMBI            to MSG-LINE-1(16:12)
               move CUQ1-NUMBER        to MSG-LINE-1(30:12)
               move VERSION-NUMBER     to MSG-LINE-1(70:9)
               perform GENERAL-ERROR-ROUTINE
           end-if.

      *    Should never get to here...
           exit.

      *****************************************************************
       UPDATE-CUSTOMER-INFORMATION-02.
      *    Attempt to insert a new row
           move CUNUMBI to CUQ1-NUMBER
           perform DATA-SCREEN-TO-FILE

           perform Z-GET-DATE-AND-TIME
           move WORK-DATE to CUQ1-LADATE
           move WORK-TIME to CUQ1-LATIME
           move ZEROES to CUQ1-TOKEN

           perform CUSTACC1-INSERT

           if  SQLCODE = 0
               move
               'Insert Complete, type new request and press ENTER key '
               to MSG-LINE-1(1:54)
               move MSG-LINE-1 to SYSMSG1O
               move '        ' to PF-ROW-23-44
               perform SCREEN-IO-SEND-UPDATE
           else
               add SQLCODE to ZERO giving NUMBER-WORK-16
               move 'Insert Failed,  ' to MSG-LINE-1(1:16)
               move CUNUMBI            to MSG-LINE-1(16:12)
               move CUQ1-NUMBER        to MSG-LINE-1(30:12)
               move VERSION-NUMBER     to MSG-LINE-1(70:9)
               perform GENERAL-ERROR-ROUTINE
           end-if.

      *    Should never get to here...
           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.
           inspect Z-WORK-12
                   replacing CHARACTERS by ' ' after initial ' '
           perform until Z-WORK-12(12:1) not = SPACE
               if  Z-WORK-12(12:1) = SPACE
                   add 11 to ZERO giving IX-12
                   perform 11 times
                     move Z-WORK-12(IX-12:1) to Z-WORK-12(IX-12 + 1:1)
                     subtract 1 from IX-12
                   end-perform
                   move ZERO to Z-WORK-12(1:1)
               end-if
           end-perform
           exit.

      *****************************************************************
       Z-GET-DATE-AND-TIME.
           accept WORK-DATE from DATE YYYYMMDD
           accept WORK-TIME from TIME

           move 'ccyy/mm/dd'   to SYSDATEO
           move WORK-DATE(1:4) to SYSDATEO(1:4)
           move WORK-DATE(5:2) to SYSDATEO(6:2)
           move WORK-DATE(7:2) to SYSDATEO(9:2)

           move 'hh:mm:ss:dd'  to SYSTIMEO
           move WORK-TIME(1:2) to SYSTIMEO(1:2)
           move WORK-TIME(3:2) to SYSTIMEO(4:2)
           move WORK-TIME(5:2) to SYSTIMEO(7:2)
           move WORK-TIME(7:2) to SYSTIMEO(10:2)

           exit.


Table of Contents Previous Section Next Section Summary

The purpose of this suite of programs is to provide examples that use command level CICS and EXEC SQL statements in COBOL programs to access a Customer Data Base and display the information using standard BMS screen definitions to a 3270 terminal or terminal emulator. This document may be used 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 document and the links to other documents are intended to provide a greater awareness of the Data Management and Application Processing alternatives.

The 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 send an e-mail to: helpdesk@simotime.com or call 415 883-6565. We appreciate hearing from you.

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 CICS Connection for more examples of mainframe CICS coding techniques and sample code.

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 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 to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

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

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

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

Table of Contents Previous Section Next Section Glossary of Terms

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

Table of Contents Previous Section Next Section Comments or Feedback

This document was created and is copyrighted and maintained by SimoTime Technologies.

If you have any questions, suggestions, comments or feedback please call at 1 415 827-7045 or send an e-mail to: helpdesk@simotime.com

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 at 1 415 827-7045 or send an e-mail to: helpdesk@simotime.com

Also, check the web site at http://www.simotime.com


Return-to-Top
Customer Table (SQL), CICS Applications that Read, Update or Insert a Row
Copyright © 1987-2019
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com