COBOL Data Structures Access Bytes and Words within Strings |
The SimoTime Home Page |
This document will describe various techniques for processing data structures in a COBOL program and the techniques the COBOL language provides for calculating or determining the length of a field (or text string) within a data structure.
When a data structure is defined as a group item consisting of elementary or detailed items it is difficult to determine the offset or position of a detailed item within a group while the program is executing. This document will describe and show by example how to determine the offset or starting position of a detailed item within a group.
In the world of programming there are many ways to solve a problem. This document shows some of the ways to address the challenges of processing fields or data strings within a data structure.
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-2018
SimoTime Technologies and Services
All Rights Reserved
The following sub-sections of this document will describe and optionally demonstrate the various processing techniques for COBL defined data structures. The first sub-section will describe how to build a test file that will be used to trigger the test scenarios and determine the sequencing of processing for the test scenarios.
WIP
The following is the JCL Member (DATSTRJ8.jcl) that will create a test file that will execute the COBOL Test Suites
//DATSTRJ8 JOB SIMOTIME,'CREATE DATSTR FILE',CLASS=1,MSGCLASS=0, // NOTIFY=CSIP1 //* ******************************************************************* //* DATSTRJ8.JCL - a JCL Member for Batch Job Processing * //* This JCL Member is provided by SimoTime Technologies * //* (C) Copyright 1987-2018 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Text - COBOL examples for Data Structure Processing //* Author - SimoTime Technologies //* Date - January 01, 1989 //* //* This set of programs will create a test file that is used to //* trigger various data string processing techniques using COBOL. //* //* ******************************************************************* //* Step 1 of 2, Delete any previously created files... //* //RSEQDELT EXEC PGM=IEFBR14 //SYSUT2 DD DSN=SIMOTIME.DATA.DATSTRD1,DISP=(MOD,DELETE,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=1024,DSORG=PS) //* //* ******************************************************************* //* Step 2 of 2, Create a Test File. //* //DATSTRS3 EXEC PGM=DATSTRC8 //* :....1....:....2....:....3....:....4....:....5....:....6....:....7. //SYSUT1 DD * R001 0000000000000000000000000000000000000000000000000000000000000000- R001 The quick brown fox jumped over the lazy dog's back. R008 0000000000000000000000000000000000000000000000000000000000000000- R008 AbCdEfGhIjKlMnOpQrStUvWxYz. /* //SYSUT2 DD DSN=SIMOTIME.DATA.DATSTRD1, // DISP=(NEW,CATLG,DELETE), // STORCLAS=MFI, // SPACE=(TRK,5), // DCB=(RECFM=FB,LRECL=1024,DSORG=PS) //SYSOUT DD SYSOUT=* //*
WIP
The following is the Windows Command file (AAA.cmd) that will WIP
This function is typically used with alpha-numeric text strings.
The following is the Windows Command file (AAA.cmd) that will WIP
The following is the Windows Command file (AAA.cmd) that will WIP
ATTENTION!!! - WIP... Insert user Include.
The following is the Windows Command file (AAA.cmd) that will WIP
ATTENTION!!! - WIP... Insert user Include.
WIP
WIP
WIP
WIP
WIP
Explore How to do Case Conversion using COBOL. The example shows a simple conversion between upper and lower case plus capitalization and editing of specific words within a text string. The mainline program will call the SIMOCASE module that is available from SimoTime as part of the SIMOMODS package.
This section provides additional detail about the secondary CMD files and programs that are used in this set of sample programs.
The following is a Windows CMD File (ENV1BASE.cmd) that is called to set the common or shared environment variables for a development environment.
@echo OFF rem * ******************************************************************* rem * ENV1BASE.cmd - a Windows Command File * rem * This program is provided by SimoTime Technologies * rem * (C) Copyright 1987-2018 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 Technologies 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 SimoLIBR=c:\SimoLIBR set BASELIB1=c:\SIMOSAM1\DEVL set BASELIB8=c:\SimoSAM8 set BaseWIP1=c:\SimoSAM1\WIP1 set DATAZERO=c:\SIMODATA\DEVL\DATA\ZERO set BASEAPP=%BaseLib1% set BASESYS=%BaseLib1%\SYS1 set BASECAT=%BaseLib1%\DATA set SYSLOG=%BASESYS%\LOGS\SYSLOG_USER.DAT set SYSOUT=%BASEAPP%\LOGS\SYSOUT_SIMSAM01.TXT set SLZMSG=%BASEAPP%\LOGS\SLZMSG_USER.TXT set PostNOTE=%BASEAPP%\LOGS\JOBLOG_SIMONOTE.TXT set SimoNOTE=%BASEAPP%\LOGS\JOBLOG_SIMONOTE.TXT call SIMONOTE "* SIMONOTE Job Log File is %SIMONOTE% " rem * set MQBASE=C:\Program Files\IBM\WebSphere MQ rem * rem * Set the location for the Apache-Tomcat Server... set CATALINA_HOME=C:\APACHETC\apache-tomcat-7.0.52 rem * rem * Set the Environment for the Java Environment... set JAVABASE=C:\Program Files (x86)\Java\jdk1.8.0_112 set JAVASDK="%JAVABASE%\bin" set JAVA_HOME=%JAVABASE% set JRE_HOME=%JAVABASE% rem * rem * Set the environment for the Micro Focus technology... set MIFOEDEV=C:\Program Files (x86)\Micro Focus\Enterprise Developer set MIFOVCBL=C:\Program Files (x86)\Micro Focus\Visual COBOL set MIFOESTU=C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0 set MIFOEMFE="C:\Program Files (x86)\Micro Focus\Mainframe Express" rem * rem * Large file support, performance tuning and record locking of the File Handler set EXTFH=%BASESYS%\CONFIG\EXTFHBIG.CFG rem * rem * For IMS Support set ES_IMSLIB=%BASEAPP%\IMSLIB set ES_ACBLIB=%BASEAPP%\IMSLIB rem * rem * EZASOKETS Check EZASOKETS Enabled box or set ES_EZASOKET_SUPPORT=YES set EZACONFG=BASESYS1\CONFIG\EZACONFG.dat rem * rem * Resource Allocation and Performance for SORT and non-Relational Data rem set MFJSENGINE=SYNCSORT set SORTSCHEME=1 set SORTSPACE=750000000 set TMP=C:\SORTWORK rem * set ES_ALLOC_OVERRIDE=%BASESYS%\CONFIG\CATMAPA1.cfg rem * For CORE_ON_ERROR function, ABEND Dump rem * set COBCONFIG_=%BASESYS%\CONFIG\diagnose.cfg rem * rem * Consolidated Trace Facility (CTF) rem * set MFTRACE_CONFIG=%BASESYS%\CONFIG\ctf.cfg rem * set MFTRACE_LOGS=c:\ctflogs rem * rem * For Job Restart, ABEND Recovery set MF_UCC11=Y set ES_JES_RESTART=Y rem * rem * Set environment for MFBSI (Micro Focus Batch Scheduling Interface) set ES_EMP_EXIT_1=mfbsiemx set MFBSI_DIR=%BASESYS%\LOGS\%JESSERVERNAME% set MFBSIEOP_CMD=ENABLE set MFBSIEOP_CSV=ENABLE set MFBSIEOP_HTM=ENABLE set MFBSIEOP_XML=ENABLE rem * rem * Set Behavior and Trace Flags for GETJOBDD rem * Position=12345678/12345678 set JDDFLAGS=nnnWnnnn/YYnnnnnn rem * set MAINFRAME_FLOATING_POINT=true set COBIDY=%BASEAPP%\COBIDY set COBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;%SimoLIBR% set LIBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;%SimoLIBR% set TXDIR=%BASESYS%\LOADLIB;%MIFOBASE% set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR% rem * rem * If not already set then set the PATH for Micro Focus Directories if "%SIMOPATH%" == "Y" goto JUMPPATH if "%MIFOSYS1%" == "EDEV" goto JUMPEDEV if "%MIFOSYS1%" == "VCBL" goto JUMPVCBL if "%MIFOSYS1%" == "ESTU" goto JUMPESTU if "%MIFOSYS1%" == "EMFE" goto JUMPEMFE :JUMPEDEV set path=%BASESYS%\LOADLIB;%MIFOEDEV%\bin;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOEDEV%\CPYLIB set MIFOBASE=%MIFOEDEV% goto JUMPPATH :JUMPVCBL set path=%MIFOVCBL%\bin;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set MIFOBASE=%MIFOVCBL% goto JUMPPATH :JUMPESTU set MIFOBASE=%MIFOESTU%\Base set MIFOBIN=%MIFOBASE%\bin set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE goto JUMPPATH :JUMPEMFE set MIFOBASE=%MIFOEMFE%\Base set MIFOBIN=%MIFOBASE%\bin set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%; set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE goto JUMPPATH rem * :JUMPPATH set SIMOPATH=Y rem * set USERCLASS=%BASELIB1%\LOADLIB set CLASSPATH=. set CLASSPATH=%CLASSPATH%;%JAVABASE% set CLASSPATH=%CLASSPATH%;%JAVABASE%\lib set CLASSPATH=%CLASSPATH%;\%USERCLASS%\simpacks set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes\simpacks if "%MIFOSYS1%" == "ESTU" set CLASSPATH=%CLASSPATH%;%MIFOBIN% if "%MIFOSYS1%" == "EDEV" set CLASSPATH=%CLASSPATH%;%MIFOEDEV% if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL% if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL%\mfcobol.jar rem * set JobStatus=0000 call SimoNOTE "* Settings CmdName ENV1BASE.cmd, Version 14.03.28, %MIFOSYS1%" call SimoNOTE "* BaseAPP ..... %BASEAPP%" rem * call SimoNOTE "* MFBSIDIR .... %MFBSI_DIR% " call SimoNOTE "* MIFOSYS1 is %MIFOSYS1% " call SimoNOTE "* MIFOBASE is %MIFOBASE% " call SimoNOTE "* SIMOLIBR is %SIMOLIBR% "
The following is a Windows CMD File (SIMONOTE.cmd) that is called to display a user message to the screen and post the message to a log file. This provides a consistent method for viewing a jobs progress during execution or reviewing the job results some time after the job has been executed.
@echo OFF rem * ******************************************************************* rem * SIMONOTE.CMD - a Windows Command File * rem * This program is provided by SimoTime Technologies * rem * (C) Copyright 1987-2018 All Rights Reserved * rem * Web Site URL: http://www.simotime.com * rem * e-mail: helpdesk@simotime.com * rem * ******************************************************************* rem * rem * Text - Display message on screen and write to a log file. rem * Author - SimoTime Technologies rem * rem * This script may be called from other scripts and expects a single rem * parameter enclosed in double quotes. The double quotes will be rem * removed. Before writing to the log file a date and time stamp rem * will be inserted in front of the message text. rem * rem * Note: The tilde (~) removes leading/trailing double-quotes. rem * if "%SimoNOTE%" == "" set SimoNOTE=c:\SimoLIBR\LOGS\SimoTime.LOG echo %date% %time% %~1>> %SimoNOTE% echo %~1
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 document and the links to other documents are intended to provide a choice of alternatives.
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 is beyond the scope and purpose of this document. The first sub-section requires an internet connection, the second sub-section references locally available documents.
Note: A SimoTime License is required for the items to be made available on a local 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 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 to interpret the results of accessing VSAM data sets and/or QSAM files.
The following links will require an internet connection.
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.
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 copyrighted and maintained by SimoTime Technologies.
If you have any questions, suggestions, comments or feedback please call or send an e-mail to: helpdesk@simotime.com
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 or need assistance with converting non-relational data structures simply give us a call at 415 883-6565 or check the web site at http://www.simotime.com
Return-to-Top |
Data Structures, Access Data within a Structure using Pointers, Offsets or Positions |
Copyright © 1987-2018 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |