Memory Dump Routine SIMOSNAP - The COBOL Source Code |
The SimoTime Home Page |
This document describes the function and usage of the SIMOSNAP module. A listing of the COBOL source code for the SIMOSNAP routine is included.
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-2024
SimoTime Technologies and Services
All Rights Reserved
The SIMOSNAP routine (or callable program) is a callable memory dump routine for a linear area of memory. Its primary purpose is to dump the working storage section of a program but may be used to dump other areas of memory or partial areas of working storage. A secondary purpose is to calculate the size of the memory area.
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. 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.
The coding to do the actual call to display and log the snap dump information is as follows.
***************************************************************** * The coding required to do the call to the File Status Routine. * ------------------------------------------------------------ call 'SIMOSNAP' using STSNAP-START STSNAP-CEASE
The SIMOSNAP program was created and tested on an intel system with Microsoft Windows/XP and Micro Focus Net Express. This packet uses members that are part of "The SIMOMODS Series" of callable programs. Therefore, the SIMOMODS packet should be installed prior to running programs that use SIMOSNAP.
Refer to the Download and Links section of this document for links to additional documents that discuss this topic.
The following (SIMOSNAP.cbl) is the COBOL Source Code.
*set dialect(MF) assign(external) nooptional-file IDENTIFICATION DIVISION. PROGRAM-ID. SIMOSNAP. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * SOURCE MODULE SIMOSNAP.CBL ***************************************************************** * SIMOSNAP - Displays a message and does a GOBACK. * * DESCRIPTION * ----------- * This program will display a message and force an ABEND with * a GOBACK or STOP RUN. The RETURN-CODE will be set to 16. * ***************************************************************** * MAINTENANCE * ----------- * 1999/03/89 Simmons, Created program. * 1999/03/89 Simmons, No changes to date. * ***************************************************************** DATA DIVISION. ***************************************************************** WORKING-STORAGE SECTION. * ***************************************************************** * Data-structure for Title and Copyright... * ------------------------------------------------------------ 01 SIM-TITLE. 05 T1 pic X(11) value '* SIMOSNAP '. 05 T2 pic X(34) value 'User callable memory dump routine' . 05 T3 pic X(10) value ' v10.06.08'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* SIMOSNAP '. 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 FLAGS-FOR-SNAPCALL. 05 FLAG-FOR-DISPLAY pic X value 'Y'. 05 FLAG-FOR-JOURNAL pic X value 'Y'. 05 FLAG-FOR-STACK pic X value 'N'. 05 FLAG-FOR-KEEP-OPEN pic X value 'Y'. * O=Offset * F-Flip * N=Native 05 FLAG-FOR-ADDR-FMT pic X value 'O'. * ------------------------------------------------------------ * Buffer used for posting dump information to the console. 01 DUMP-BUFFER. 05 DUMP-TEXT pic X(79). * ------------------------------------------------------------ * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine. 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(11) value '* SIMOSNAP '. 05 MESSAGE-TEXT. 10 MESSAGE-TEXT-1 pic X(68) value SPACES. 10 MESSAGE-TEXT-2 pic X(188) value SPACES. 01 SYSSNAP-OPEN-FLAG pic X value 'N'. 01 FIRST-TIME pic X value 'Y'. 01 MESSAGE-LENGTH pic 9(5) value 1024. 01 RMO-1 pic 9(7) value 0. 01 TWO-BYTES. 05 TWO-BYTES-01 pic X. 05 TWO-BYTES-02 pic X. 01 TWO-BYTES-BINARY redefines TWO-BYTES pic S9(3) comp. 01 IX-0 pic 9999 value 0. 01 IX-1 pic 9999 value 0. 01 IX-2 pic 9999 value 0. 01 IX-3 pic 9999 value 0. 01 IX-4 pic 9999 value 0. 01 IX-5 pic 9999 value 0. 01 PT-1 pic 9999 value 0. 01 PT-2 pic 9999 value 0. 01 MEM-ADDR-OFFSET pic 9(7) value 0. 01 WA-5 pic X(5) value is SPACES. 01 BUFFER-LENGTH pic 9999 value 0. 01 LINE-LENGTH pic 9999 value 0. 01 MEM-ADDRESS. 05 MEM-ADDRESS-PTR usage POINTER. 01 MEM-ADDR-G-OFFSET. 05 MEM-ADDR-V-OFFSET pic S9(9) comp value 0. 01 SNAP-LINE. 05 filler pic X(10) value '@SimoSNAP '. 05 filler pic X(24) value 'by SimoTime Technologies'. 05 filler pic X(45) value all '*'. 01 SNAP-LINE-02. 05 filler pic X(10) value '@SimoSNAP '. 05 filler pic X(20) value 'Dump Buffer Size is '. 05 WS-MEMORY-LENGTH pic 9(7) value 0. 01 DUMP-HEADER. 05 filler pic X value '@'. 05 H1 pic X(8) value 'Hex-Addr'. 05 filler pic X value ' '. 05 H2 pic X(35) value 'Hex..... ........ ........ ........'. 05 filler pic X value ' '. 05 H3 pic X(16) value 'ebcdic..........'. 05 filler pic X value ' '. 05 H4 pic X(16) value 'ascii...........'. 01 DUMP-LINE. 05 filler pic X value '@'. 05 D1 pic X(8) value 'aaaaaaaa'. 05 filler pic X value ' '. 05 D2 pic X(35) value 'xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx'. 05 filler pic X value ' '. 05 D3 pic X(16) value '................'. 05 filler pic X value ' '. 05 D4 pic X(16) value '................'. 01 X-DUMP-LINE. 05 filler pic X value '@'. 05 X1 pic X(8) value 'aaaaaaaa'. 05 filler pic X value ' '. 05 X2 pic X(35) value 'xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx'. 05 filler pic X value ' '. 05 X3 pic X(16) value '................'. 05 filler pic X value ' '. 05 X4 pic X(16) value '................'. COPY HEXTABLE. * ------------------------------------------------------------ * Uses COMP-5 for "Little Endian" format. 01 STSNAP-START-X. 05 STSNAP-START-PTR usage pointer. 01 STSNAP-START-5 redefines STSNAP-START-X. 05 STSNAP-START-CP5 pic S9(5) COMP-5. 01 STSNAP-CEASE-X. 05 STSNAP-CEASE-PTR usage pointer. 01 STSNAP-CEASE-5 redefines STSNAP-CEASE-X. 05 STSNAP-CEASE-CP5 pic S9(5) COMP-5. ***************************************************************** LINKAGE SECTION. 01 STSNAP-START pic X(16). 01 STSNAP-CEASE pic X(16). ***************************************************************** PROCEDURE DIVISION using STSNAP-START STSNAP-CEASE. move SIM-TITLE to MESSAGE-BUFFER perform Z-DISPLAY-MESSAGE-BUFFER move SIM-COPYRIGHT to MESSAGE-BUFFER perform Z-DISPLAY-MESSAGE-BUFFER evaluate FLAG-FOR-ADDR-FMT when 'F' move 'Hex-Addr' to H1 when 'O' move 'Hex-Disp' to H1 when 'N' move 'Hex-Addr' to H1 when other move 'Hex-Addr' to H1 end-evaluate move SNAP-LINE to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT-79. if STSNAP-START(1:16) not = 'STSNAP-START-TAG' or STSNAP-CEASE(1:16) not = 'STSNAP-CEASE-TAG' move '@SimoSNAP has received an invalid request' to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT-79 GOBACK end-if. set STSNAP-START-PTR to address of STSNAP-START set STSNAP-CEASE-PTR to address of STSNAP-CEASE subtract STSNAP-START-CP5 from STSNAP-CEASE-CP5 giving WS-MEMORY-LENGTH add 16 to WS-MEMORY-LENGTH move SNAP-LINE-02 to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT-79. move DUMP-HEADER to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT-79 perform DUMP-PROCESSING GOBACK. ***************************************************************** DUMP-PROCESSING. add 1 to ZERO giving IX-0 add 1 to ZERO giving IX-1 add 1 to ZERO giving IX-5 add WS-MEMORY-LENGTH to ZERO giving BUFFER-LENGTH if BUFFER-LENGTH greater than 15 add 16 to ZERO giving LINE-LENGTH else add BUFFER-LENGTH to ZERO giving LINE-LENGTH end-if set MEM-ADDRESS-PTR to address of STSNAP-START move ZERO to MEM-ADDR-V-OFFSET perform until BUFFER-LENGTH = 0 add 1 to ZERO giving PT-1 evaluate FLAG-FOR-ADDR-FMT when 'F' add 7 to ZERO giving PT-2 when 'O' add 1 to ZERO giving PT-2 when 'N' add 1 to ZERO giving PT-2 when other add 1 to ZERO giving PT-2 end-evaluate add 1 to ZERO giving IX-4 move X-DUMP-LINE to DUMP-LINE perform 4 times subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY evaluate FLAG-FOR-ADDR-FMT when 'F' move MEM-ADDRESS(PT-1:1) to TWO-BYTES-02 when 'O' move MEM-ADDR-G-OFFSET(PT-1:1) to TWO-BYTES-02 when 'N' move MEM-ADDRESS(PT-1:1) to TWO-BYTES-02 when other move MEM-ADDRESS(PT-1:1) to TWO-BYTES-02 end-evaluate add TWO-BYTES-BINARY to 1 giving IX-5 move TAB-X1(IX-5) to WA-5 move WA-5(1:2) to D1(PT-2:2) add 1 to PT-1 evaluate FLAG-FOR-ADDR-FMT when 'F' subtract 2 from PT-2 when 'O' add 2 to PT-2 when 'N' add 2 to PT-2 when other add 2 to PT-2 end-evaluate end-perform add 1 to ZERO giving IX-2 add 1 to ZERO giving IX-3 perform DUMP-SINGLE-LINE if BUFFER-LENGTH greater than 15 subtract 16 from BUFFER-LENGTH else subtract BUFFER-LENGTH from BUFFER-LENGTH end-if if BUFFER-LENGTH greater than 15 add 16 to ZERO giving LINE-LENGTH else add BUFFER-LENGTH to ZERO giving LINE-LENGTH end-if set MEM-ADDRESS-PTR up by 16 evaluate FLAG-FOR-ADDR-FMT when 'F' set MEM-ADDRESS-PTR up by 16 when 'O' add 16 to MEM-ADDR-V-OFFSET when 'N' set MEM-ADDRESS-PTR up by 16 when other set MEM-ADDRESS-PTR up by 16 end-evaluate end-perform exit. ***************************************************************** DUMP-SINGLE-LINE. perform until LINE-LENGTH = 0 * Get table element subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY move STSNAP-START(IX-1:1) to TWO-BYTES-02 add TWO-BYTES-BINARY to 1 giving IX-5 move TAB-X1(IX-5) to WA-5 move WA-5(1:2) to D2(IX-2:2) * Increment to next position in hex-dump area of buffer add 2 to IX-2 if IX-2 = 9 or IX-2 = 18 or IX-2 = 27 add 1 to IX-2 end-if * EBCDIC Print Character and increment to next position move WA-5(3:1) to D3(IX-3:1) add 1 to IX-3 * ASCII Print Character and increment to next position move WA-5(4:1) to D4(IX-4:1) add 1 to IX-4 * Increment pointer to next input buffer byte add 1 to IX-1 subtract 1 from LINE-LENGTH end-perform move DUMP-LINE to MESSAGE-TEXT perform Z-DISPLAY-MESSAGE-TEXT-79 exit. ***************************************************************** * Display CONSOLE messages... * ***************************************************************** Z-DISPLAY-MESSAGE-BUFFER. if MESSAGE-TEXT-2 = SPACES display MESSAGE-BUFFER(1:79) else display MESSAGE-BUFFER end-if move all SPACES to MESSAGE-TEXT exit. *---------------------------------------------------------------* Z-DISPLAY-MESSAGE-TEXT-79. display MESSAGE-TEXT(1:79) move all SPACES to MESSAGE-TEXT 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 document describes the function and usage of the SIMOSNAP module. 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, Comment 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.
Explore a Test Case for a Snap Dump suite of programs that will describe and demonstrate a method of dumping the working storage section of a COBOL program. This information could be very useful when determining the cause of a user-defined ABEND.
Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.
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.
Take a moment to check out a list of the SimoMODS Programs that are available for review and evaluation.
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 |
Memory Dump Routine |
Copyright © 1987-2024 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |