Memory Dump
When technology complements business   COBOL Working Storage
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved http://www.simotime.com

 
Introduction Version 06.12.11
  The Call Interface
  System Requirements and Prerequisites
  A CMD Member for the Windows Environment
  A JCL Member for the Mainframe Environment
  The COBOL Demonstration Program
  The COBOL Snap Dump (or Memory Dump) Routine
  The Copy Files to Define the Start/Cease of Working Storage
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Comments or Suggestions
  About SimoTime

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

This is an example of how to use a callable "Snap Dump" routine that will dump the content of the "WORKING-STORAGE SECTION" of the calling COBOL program.

The Call Interface
(Next) (Previous) (Table-of-Contents)

The callable interface requires two data structures to be defined in the Working Storage section of the calling program.

Two copy files are provided to define the "eye-catcher" fields in the COBOL Working Storage Section. The copy statements will create the fields that will be used by the SimoSNAP routine to determine the start and stop addresses for the memory dump.

The first copy statement (STSNAPB1.CPY) should be the first statement in the COBOL Working Storage Section. The second copy statement (STSNAPB2.CPY) should be the last statement in the COBOL Working Storage Section.

       WORKING STORAGE.
      *The following should be the first statement in Working Storage. 
       COPY STSNAPB1
      *...
      *The User's Working Storage Definitions go here...
      *...
      *The following should be the last statement in Working Storage.
       COPY STSNAPB2.

Note: The copy files insert sixteen (16) byte literals as the first and last fields in the Working Storage Section. The source code may be viewed in  The Copy File section  of this document.

The coding to do the actual call to display and/or log the file status information is as follows.

      *****************************************************************
      *    The coding required to do the call to the File Status Routine.
      *    ------------------------------------------------------------
           call 'SIMOSNAP' using STSNAP-START STSNAP-CEASE

System Requirements and Prerequisites
(Next) (Previous) (Table-of-Contents)

The programs in this packet were created and tested on an intel system with Microsoft Windows/XP and Micro Focus Net Express. The source code and executables are Windows Command files and COBOL programs.

This packet uses members that are part of  The SimoMODS Series  of callable programs. Therefore, the SimoMODS packet should be installed prior to running this packet of programs. The required prerequisite programs from the SimoMODS Series are SimoNOTE.CMD, SimoEXEC.EXE, SimoLOGS.DLL and SimoSNAP.DLL.

A CMD Member for the Windows Environment
(Next) (Previous) (Table-of-Contents)

The following is the Windows Command file (CBSNAPE1.CMD) that is required to run as a job on a PC using Micro Focus Net Express.

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2007 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text    - SimoSNAP, Sample use of a Callable Memory Dump Routine
rem  * Author  - SimoTime Enterprises
rem  * Date    - November 11, 2003
rem  * Version - 06.12.12
rem  *
rem  * This set of programs illustrate the use a COBOL program to do
rem  * a memory dump of Working Storage when an unexpected condition
rem  * is encountered.
rem  *
rem  * This technique provides for the use of a single COBOL source
rem  * program that will run in a Windows environment with Micro Focus
rem  * Net Express.
rem  *
rem  * This set of programs was tested on a Personal Computer with Windows
rem  * Windows and Micro Focus Net Express.
rem  *
rem  *   ************
rem  *   * CBSNAPE1 *
rem  *   ********cmd*
rem  *        *  *
rem  *        *  *        ************     ************
rem  *        *  ***call*** SIMONOTE ******* CONSOLE  *
rem  *        *           ********cmd*  *  ************
rem  *        *                         *
rem  *        *                         *  ************
rem  *        *                         ****  SYSLOG  *
rem  *        *                            *******data*
rem  *        *
rem  *   ************     ************     ************
rem  *   * SIMOEXEC ******* CBSNAPC1 ******* CONSOLE  *
rem  *   ********exe*     ********cbl*  *  ************
rem  *        *                *
rem  *        *                *
rem  *        *           ************
rem  *        *           * SIMOSNAP *
rem  *        *           ********cbl*
rem  *        *                *
rem  *        *                *
rem  *        *           ************     ************
rem  *        *           * SIMOLOGS ******* CONSOLE  *
rem  *        *           ********cbl*  *  ************
rem  *        *                         *
rem  *        *                         *  ************
rem  *        *                         ****  SYSLOG  *
rem  *        *                            *******data*
rem  *   ************
rem  *   *   EOJ    *
rem  *   ************
rem  *
rem  * ********************************************************************
rem  * Step   1 of 2  Set the global environment variables...
rem  *
     setlocal
rem  * The following call statement will set commonly used environment
rem  * variables. This call technique is used so the commonly used
rem  * variables may be stored in a single location. This makes it easier
rem  * to change when porting programs across systems with differing
rem  * configurations.
     call Env1PROD
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************CbSnapE1"
     call SimoNOTE "Starting JobName CbSnapE1"
rem  * ********************************************************************
rem  * Step   2 of 2  Execute the sample program...
rem  *
     SimoEXEC EXEC CbSnapC1
     if ERRORLEVEL = 0 goto :EojAOK
     set JobStatus=0010
     goto :EojNOK
:EojAOK
     call SimoNOTE "Finished JobName CbSnapE1, Job Status is %JobStatus%"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING JobName CbSnapE1, Job Status is %JobStatus%"
     echo CBSNAPC1 is ABENDING>>%BaseLib1%\LOGS\ABENDLOG.TXT
     goto :End
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause
     endlocal

The preceding command file makes a call to Env1PROD.CMD to set environment variables. This call technique is used so the commonly used variables may be stored in a single location. This makes it easier to change environment requirements when porting programs across systems with differing configurations. The following shows the content of the Env1PROD.CMD file.

@echo off
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2007 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Provide a single point to set common environment variables.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * Set the commonly used environment variables. This is used to provide
rem  * a single point for managing the commonly used environment variables.
rem  *
     set BaseLib1=c:\Assist01\WIN1
     set syslog=%BaseLib1%\LOGS\SpoolSimoNOTE.TXT
     set SimoNOTE=%BaseLib1%\LOGS\SpoolSimoNOTE.TXT
     call SimoNOTE "Starting JobName Env1PROD.CMD"
     set sysout=%BaseLib1%\LOGS\ApplSysOut.TXT
rem  * The following are for the SimoTRAKing
     set StTRAKJR=%BaseLib1%\LOGS\STTRAKJR.TXT
     set StTRAKDX=%BaseLib1%\LOGS\STTRAKDX.DAT
     set StTRAKEX=%BaseLib1%\LOGS\STTRAKEX.CSV
     set StTRAKTX=%BaseLib1%\DataTxt1\STTRAKTX.TXT
rem  *
     set path=C:\Program Files\Micro Focus\Net Express 5.0\Base;C:\Program Files\Micro Focus\Net Express 5.0\Base\bin;%path%
rem  *
     set JobStatus=0000
     call SimoNOTE "Finished JobName Env1PROD.CMD"

A JCL Member for the Mainframe Environment
(Next) (Previous) (Table-of-Contents)

The following (CBSNAPJ1.JCL) is a sample of the JCL needed to run this job with Micro Focus Enterprise Server.

//ABTESTJ1 JOB SIMOTIME,ACCOUNT,CLASS=A,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*                   This program is provided by:                    *
//*                    SimoTime Enterprises, LLC                      *
//*           (C) Copyright 1987-2007 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text    - ABEND Routine for the Micro Focus Environment.
//* Author  - SimoTime Enterprises
//* Date    - September 23, 2006
//* Version - 07.01.22
//*
//* This set of programs illustrate the use a callable COBOL program
//* that displays the call stack and issues a STOP RUN to terminate
//* the process.
//*
//* This ABEND routine is for use in a Micro Focus environment.
//*
//* *******************************************************************
//* Step   1 of 2  Test the ABEND Routine.
//*
//STEP0010 EXEC PGM=ABTESTC1
//SYSOUT   DD  SYSOUT=*
//*

The COBOL Demonstration Program
(Next) (Previous) (Table-of-Contents)

This program (CBSNAPC1.CBL) was written to test the callable COBOL program (SIMOSNAP.CBL) that does the memory dump of the Working Storage Section.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CBSNAPC1.
       AUTHOR.        SIMOTIME ENTERPRISES.
      *****************************************************************
      *
      * SOURCE MODULE CBSNAPC1.CBL
      *
      *****************************************************************
      *
      * CBSNAPC1 - Memory Dump of COBOL's Working Storage.
      *
      *
      * DESCRIPTION
      * -----------
      * This program will display hexadecimal dump information to the
      * console and write the information to a log file. The dump is
      * of the COBOL Working Storage section.
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1999/03/89 Simmons, Created program.
      * 1999/03/89 Simmons, No changes to date.
      *
      *****************************************************************
      *
       ENVIRONMENT DIVISION.
      *****************************************************************
      *
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       COPY STSNAPB1.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CBSNAPC1 '.
           05  T2 pic X(34) value 'Sample, Dump of Working Storage   '.
           05  T3 pic X(10) value ' v06.12.12'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CBSNAPC1 '.
           05  C2 pic X(20) value 'Copyright 1987-2007 '.
           05  C3 pic X(28) value '  SimoTime Enterprises, LLC '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* CBSNAPC1 '.
           05  C2 pic X(32) value 'Thank you, this technology was p'.
           05  C3 pic X(32) value 'roduced by SimoTime Enterprises,'.
           05  C4 pic X(04) value ' LLC'.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* CBSNAPC1 '.
           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'.

      *****************************************************************
      *    Buffer used for posting messages to the console.
      *    ------------------------------------------------------------
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CBSNAPC1 '.
           05  MESSAGE-TEXT        pic X(68).

       01  TEST-FIELDS.
           05  PACKED-FIELD        pic S9(5)   comp-3  value 123.
           05  BINARY-FIELD        pic S9(5)   comp    value 123.
           05  SIGNED-ZONED        pic S9(5)   display value 123.

       COPY STSNAPB2.

      *****************************************************************
       PROCEDURE DIVISION.

           perform Z-POST-COPYRIGHT

           move 'Use SimoSNAP with explicit coding...' to MESSAGE-TEXT
           perform Z-POST-MESSAGE
           call 'SIMOSNAP' using STSNAP-START STSNAP-CEASE
           move 'Sample User Code...' to MESSAGE-TEXT
           perform Z-POST-MESSAGE

           perform Z-THANK-YOU

           GOBACK.

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

      *****************************************************************
       Z-POST-MESSAGE.
           display MESSAGE-BUFFER
           move SPACES to MESSAGE-TEXT
           exit.

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

The COBOL Snap Dump (or Memory Dump) Routine
(Next) (Previous) (Table-of-Contents)

This program (SIMOSNAP.CBL) was originally written to be used as a diagnostic aid for SimoTime consultants and programmers. Today, this program is used by a number of our customers as a diagnostic aid for programming debugging or for tracking the results of program behavior in both a development and production environment. The program has been tested on Windows/XP system with Net Express from Micro Focus.

You may  click here to view the source code  for the callable snap dump routine

The Copy Files to Define the Start/Cease of Working Storage
(Next) (Previous) (Table-of-Contents)

Two copy files are provided to define the "eye-catcher" fields in the COBOL Working Storage Section. The copy statements will create fields that will be used by the SimoSNAP routine to determine the start and stop addresses for the memory dump.

The first copy statement (STSNAPB1.CPY) should be the first statement in the COBOL Working Storage Section. This copy file will create a sixteen (16) byte literal that may be used as an eye-catcher when viewing the memory dump. This literal is used by the SimoSNAP routine to validate the start of the COBOL Working Storage Section.

      *****************************************************************
      *        Copy File for SnapDump Start of Working Storage.       *
      *****************************************************************
      *         Copyright (C) 1987-2007 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       01  STSNAP-START.
           05  FILLER      pic X(16)   value 'STSNAP-START-TAG'.
      *!   STSNAPB1 - End-of-Copy File...

The second copy statement (STSNAPB2.CPY) should be the last statement in the COBOL Working Storage Section. This copy file will create a sixteen (16) byte literal that may be used as an eye-catcher when viewing the memory dump. This literal is used by the SimoSNAP routine to validate the end (or cessation) of the COBOL Working Storage Section.

      *****************************************************************
      *        Copy File for SnapDump End of Working Storage.         *
      *****************************************************************
      *         Copyright (C) 1987-2007 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *****************************************************************
      *              Provided by SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
       01  STSNAP-CEASE.
           05  FILLER      pic X(16)   value 'STSNAP-CEASE-TAG'.
      *!   STSNAPB2 - End-of-Copy File...

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

The purpose of this document is 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 suite of programs is provided as a COBOL programming example of one of the many possible diagnostic aids for debugging a program or observing the results of program behavior.

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

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Enterprises. 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 Enterprises.

SimoTime Enterprises 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 express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.

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

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

You may download this example at  http://www.simotime.com/sim4dzip.htm#COBOLSnapDump  as a Z-Pack. The 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.

Please view the complete list of SimoTime Z-Pack Examples at  http://www.simotime.com/sim4dzip.htm .

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

The  hexadecimal dump  of the parameter-buffer uses the same technique as describe in another SimoTime example that describes the dumping of a data string using COBOL. The name of the member that does the actual hexadecimal dump is called SimoDUMP. A copy file (PASSDUMP.CPY) is provided for defining the pass area.

The  SimoZAPS Utility Program  has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.

Check out  The COBOL Connection  for more examples of mainframe COBOL coding techniques and sample code.

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

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

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

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

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

Founded in 1987, SimoTime Enterprises is a privately owned, Limited Liability Corporation located in Novato, California. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com.


Return-to-Top
Copyright © 1987-2008  SimoTime Enterprises, LLC  All Rights Reserved
When technology complements business
http://www.simotime.com