Data String Manipulation Parameter Pass, Parse & Convert |
The SimoTime Home Page |
This suite of programs provides examples of how to parse, edit, modify, format and display (standard or hexadecimal dump) various words within a data string. The programs also include examples of how to pass parameters between JCL and COBOL. The COBOL programs are written using the COBOL/2 dialect but also work with COBOL for MVS and COBOL/370. A JCL member is provided to run the job as an MVS batch job on an IBM mainframe or as a project with Micro Focus Mainframe Express (MFE) running on a PC with Windows.
Functions included in this example are as follows.
| ||||||||||||||||||
Function included in this Suite of Demonstration Programs |
Another of the challenges in today's world is the movement of programs and data between the mainframe and the PC. This introduces the possibilities of a program being compiled and executed on the mainframe in EBCDIC mode or the PC in ASCII mode. Another possibility is the parameters may be created on one platform and passed to a program executing on a different platform. This introduces the problem of how to determine the ASCII or EBCDIC format of the parameters.
There are a number of possible solutions and techniques for addressing these problems. This program describes a few of the possible coding techniques. This program may serve as a tutorial for programmers that are new to COBOL and mainframe JCL and as a reference for experienced programmers.
Many of the routines in this example have been used in production environments on Mainframe System and Linux, UNIX or Windows Systems with Micro Focus technology. It is important to remember the original intent of this program was to be a learning tool for seminars and classes conducted by SimoTime. Therefore, any of the routines or techniques that will be used in a production environment should be thoroughly tested before deploying. It is the programmer's and user's responsibility to test programs for each environment before making business decisions based on the results produced by routine provided in this example.
We have made a significant effort to ensure the documents and software technologies are correct and accurate. We reserve the right to make changes without notice at any time. The function delivered in this version is based upon the enhancement requests from a specific group of users. The intent is to provide changes as the need arises and in a timeframe that is dependent upon the availability of resources.
Copyright © 1987-2025
SimoTime Technologies and Services
All Rights Reserved
This suite of samples programs will run on the following platforms.
| ||||||
Operating Systems and Supporting Software for Program Execution |
The following flowchart provides a quick overview of processing logic used with this example.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Note-1:
This is a three (3) step job. 1. Validate parameters and call user program with parameters. 2. Validate parameters and display to console 3. Execute a COBOL program that makes multiple calls to SIMOCAPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Note-2 This program (SIMOPARS) will scan a data string and identify the offset and length of each keyword within the data string. A space delimiter is used as a separator between keywords within the string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Note-3 This (SIMODUMP) program will scan a data string and dump (i. e. display the information on the console) in hexadecimal format. |
Logic Flow for the Pass, Parse, Convert and Display of a Parameter Text String |
Color Associations: The
This suite of programs will describe and demonstrate a process that will accept, edit and process a data string being passed between mainframe JCL and application programs. The format of the data string is a group of seven (7) keywords separated by space characters. The program should be able to handle leading or multiple spaces. Since a space character is used as the delimiter the space character may not be embedded within a keyword. The following shows the format of the data string with a brief description of each keyword.
STA debug-keyword identifier-keyword user-program date-keyword amount-keyword close-keyword
| ||||||||||||||||
List of the Keywords within the Text String passed between Programs |
The following shows a sample data string with seven (7) keywords.
STA NODebug id01 StaFmtC2 2001-1-1 17.50 call
The following shows the output that is produced by the SIMOCAPE program and passed to a user program.
* STAFMTC2 Receive Edited Date Parameters v03.01.24 http://www.simotime.com * STAFMTC2 Copyright 1987-2012 --- SimoTime Enterprises --- All Rights Reserved * STAFMTC2 Gregorian Date .............. 20010101 * STAFMTC2 Edited Gregorian Date ....... 2001-01-01 * STAFMTC2 Text Date ................... January 1, 2001 * STAFMTC2 Julian Date ................. 2001001 * STAFMTC2 Days Remaining in the Year .. 364 * STAFMTC2 Leap Year Flag (Y or N) ..... N * STAFMTC2 Days in the Month ........... 31 * STAFMTC2 Text for the Month .......... January * STAFMTC2 Amount ...................... 00000001750
The following shows the hexadecimal dump information that is produced when the SIMODUMP program is called.
* SIMOCAPE Parameter Number 2 - DEBUG AOK for Debug Function... * SIMOCAPE Parameter Number 3 - ID01 AOK for Identifier... * SIMOCAPE Parameter Number 4 - STAFMTC2 AOK for User Function... * SIMOCAPE Parameter Number 5 - 20010202 WIP for Calling SIMODATE... * SIMOCAPE Parameter Number 6 - 00000001875 AOK for Amount Function... * SIMOCAPE Parameter Number 7 - TEST Contains only ALPHA and NUMERIC. * SIMODUMP COBOL Hexadecimal Dump Routine v11.11.03 http://www.simotime.com * SIMODUMP Copyright 1987-2012 --- SimoTime Enterprises --- All Rights Reserved * HEXDUMP1 Starting... Length = 0128 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 53544120 44454255 47204944 30312053 ................ STA DEBUG ID01 S * 17-032 5441464D 54433220 32303031 30323032 ...(............ TAFMTC2 20010202 * 33-048 2031382E 37352054 45535420 20202020 ................ 18.75 TEST * 49-064 20202020 20202020 20202020 20202020 ................ * 65-080 20202020 20202020 20202020 20202020 ................ * 81-096 20202020 20202020 20202020 20202020 ................ * 97-112 20202020 20202020 20202020 20202020 ................ * 113-128 20202020 20202020 20202020 20202020 ................ * HEXDUMP1 Complete... Length = 0128 * SIMODUMP COBOL Hexadecimal Dump Routine v11.11.03 http://www.simotime.com * SIMODUMP Copyright 1987-2012 --- SimoTime Enterprises --- All Rights Reserved * HEXDUMP2 Starting... Length = 0128 * Offset Hex..... ........ ........ ........ ebcdic.......... ascii........... * 1-016 E2E3C140 C4C5C2E4 C740C9C4 F0F140E2 STA DEBUG ID01 S ...@.....@....@. * 17-032 E3C1C6D4 E3C3F240 F2F0F0F1 F0F2F0F2 TAFMTC2 20010202 .......@........ * 33-048 40F1F84B F7F540E3 C5E2E340 40404040 18.75 TEST @..K..@....@@@@@ * 49-064 40404040 40404040 40404040 40404040 @@@@@@@@@@@@@@@@ * 65-080 40404040 40404040 40404040 40404040 @@@@@@@@@@@@@@@@ * 81-096 40404040 40404040 40404040 40404040 @@@@@@@@@@@@@@@@ * 97-112 40404040 40404040 40404040 40404040 @@@@@@@@@@@@@@@@ * 113-128 40404040 40404040 40404040 40404040 @@@@@@@@@@@@@@@@ * HEXDUMP2 Complete... Length = 0128 * SIMOCAPE Processing the TEST request * SIMOCAPE Gregorian Date .............. 20010202 * SIMOCAPE Edited Gregorian Date ....... 2001-02-02 * SIMOCAPE Text for the Date............ February 2, 2001 * SIMOCAPE Julian Date ................. 2001033 * SIMOCAPE Days Remaining in the Year... 332 * SIMOCAPE Leap Year Flag (Y or N) ..... N * SIMOCAPE Days in the Month ........... 28 * SIMOCAPE Text for the Month .......... February * SIMOCAPE Amount ...................... 00000001875
The following shows the data structure of the fixed-length field format. This is what will be used as the pass area when the user-defined application program is called.
***************************************************************** * PASSCAPE.CPY - a COBOL Copy File * * Data structure for calling a user-program from SimoCAPE * * Copyright (C) 1987-2019 SimoTime Technologies * * All Rights Reserved * * Provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * ***************************************************************** 01 CAPE-XCTL-API. 05 CAPE-ID pic X(8). 05 CAPE-DEBUG pic X(8). 05 CAPE-GREGORIAN-DATE pic 9(8). 05 CAPE-DATE-EDITED pic X(10). 05 CAPE-DATE-VERBAGE pic X(16). 05 CAPE-JULIAN-DATE pic 9(7). 05 CAPE-DAYS-REMAINING pic 9(3). 05 CAPE-LEAP-YEAR-YN pic X. 05 CAPE-DAYS-IN-MONTH pic 99. 05 CAPE-MONTH-VERBAGE pic X(10). 05 CAPE-AMOUNT pic 9(11). * *** PASSCAPE - End-of-Copy File - - - - - - - - - - - PASSCAPE * ***************************************************************** *
The following is an example of the WORKING-STORAGE or LINKAGE Section fields that are passed as parameters to the string parsing program (SimoCAPE).
01 F01-PARM-BUFFER. 05 F01-PARM-LENGTH pic S9(4) comp. 05 F01-PARM-DATA pic X(256).
The following is an example of the call statement.
call 'SIMOCAPE' using F01-PARM-LENGTH, F01-PARM-DATA
This section will describe and demonstrate the two JCL members that are included in this package.
The following is the mainframe JCL member (STAFMTJ1.jcl) required to run the demonstration program and make calls and pass parameters to user-defined application programs.
//STAFMTJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This JCL Member is provided by SimoTime Technologies * //* (C) Copyright 1987-2019 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Text - Process a parameter passed from JCL or COBOL //* Author - SimoTime Technologies //* Date - January 24, 1996 //* //* This is a sample program that shows how to do a variety of tasks //* relating to parameter passing and parsing. //* //* This set of programs will run on a mainframe under MVS or on a //* Personal Computer with Windows and Micro Focus Mainframe Express. //* //* ************ //* * STAFMTJ1 * //* ********jcl* //* * //* * //* * //* ************ ************ //* * SIMOCAPE *--*--* SIMOPARS * //* ************ * ************ //* * * //* * * ************ //* * *--* SIMODATE * //* * * ************ //* * * //* * * ************ ************ //* * *--* SIMODUMP *-----* CONSOLE * //* * * ********opt* ******dsply* //* * * //* * * ************ //* * *--* userprog * * 4th & 7th Keywords //* * * ********opt* //* * * //* * * ************ //* * *--* CONSOLE * //* * ********opt* //* * //* * //* ************ ************ ************ //* * STAFMTC1 *-----* SIMOCAPE *--*--* SIMOPARS * * Job Step 02 //* ********cbl* ************ * ************ //* * * //* * * ************ //* * *--* SIMODATE * //* * * ************ //* * * //* * * ************ ************ //* * *--* SIMODUMP *-----* CONSOLE * //* * * ********cbl* ******dsply* //* * * //* * * ************ //* * *--* userprog * //* * * ********opt* //* * * //* * * ************ //* * *--* CONSOLE * //* * ********opt* //* ************ //* * EOJ * //* ************ //* //* //* ******************************************************************* //* Step 1 of 2, Execute the COBOL parsing program with a parameter //* from JCL. //* Set NODEBUG to prevent tracing or dumping unless //* error. //* //STAFMTS1 EXEC PGM=SIMOCAPE, // PARM='STA NODebug id01 StaFmtC2 2001-1-1 17.50 call' //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //SYSOUT DD SYSOUT=* //* //* ******************************************************************* //* Step 2 of 2, Execute the COBOL demonstration program without //* a parameter from JCL. The demonstration program //* (STAFMTC1) will create a parameter string using the //* same callable interface that is required when passing //* a string from JCL to COBOL. //* //STAFMTS3 EXEC PGM=STAFMTC1 //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //SYSOUT DD SYSOUT=* //*
The following is the mainframe JCL member (STAFMTJ2.jcl) required to run the demonstration program without making the call to the user-defined application programs.
//STAFMTJ2 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1 //* ******************************************************************* //* This JCL Member is provided by SimoTime Technologies * //* (C) Copyright 1987-2019 All Rights Reserved * //* Web Site URL: http://www.simotime.com * //* e-mail: helpdesk@simotime.com * //* ******************************************************************* //* //* Text - Process a parameter passed from JCL or COBOL //* Author - SimoTime Technologies //* Date - January 24, 1996 //* //* This is a sample program that shows how to do a variety of tasks //* relating to parameter passing and parsing. //* //* This set of programs will run on a mainframe under MVS or on a //* Personal Computer with Windows and Micro Focus Mainframe Express. //* //* Since the seventh (7th) keyword is set to "TEST" the user-defined //* program or fourth (4th) keyword will not be called. //* //* ************ //* * STAFMTJ2 * //* ********jcl* //* * //* * //* * //* ************ ************ //* * SIMOCAPE *--*--* SYSOUT * //* ************ * ************ //* * * //* * * ************ //* * *--* SIMOPARS * //* * * ************ //* * * //* * * ************ //* * *--* SIMODATE * //* * * ************ //* * * //* * * ************ ************ //* * *--* SIMODUMP *-----* SYSOUT * //* * ********opt* ************ //* * //* ************ //* * EOJ * //* ************ //* //* //* ******************************************************************* //* Step 1 of 1, Execute the COBOL parsing program with a parameter //* from JCL. Set TRACE mode (2nd keyword)to trace execution of //* functions. //* //STAFMTS1 EXEC PGM=SIMOCAPE, // PARM='STA TRACE id01 StaFmtC2 20010202 18.75 test' //STEPLIB DD DSN=SIMOTIME.DEMO.LOADLIB1,DISP=SHR //SYSOUT DD SYSOUT=* //*
This program (STAFMTC1.cbl) was written to be used as a teaching, learning and debugging aid. The use of the techniques or technology provided in this example should be thoroughly tested in each unique environment.
IDENTIFICATION DIVISION. PROGRAM-ID. STAFMTC1. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * Copyright (C) 1987-2019 SimoTime Technologies. * * * * All rights reserved. Unpublished, all rights reserved under * * copyright law and international treaty. Use of a copyright * * notice is precautionary only and does not imply publication * * or disclosure. * * * * Permission to use, copy, modify and distribute this software * * for any non-commercial purpose and without fee is hereby * * granted, provided the SimoTime copyright notice appear on all * * copies of the software. The SimoTime name or Logo may not be * * used in any advertising or publicity pertaining to the use * * of the software without the written permission of SimoTime * * Technologies. * * * * Permission to use, copy, modify and distribute this software * * for any commercial purpose requires a fee to be paid to * * SimoTime Technologies. Once the fee is received by SimoTime * * the latest version of the software will be delivered and a * * license will be granted for use within an enterprise, * * provided the SimoTime copyright notice appear on all copies * * of the software. The SimoTime name or Logo may not be used * * in any advertising or publicity pertaining to the use of the * * software without the written permission of SimoTime * * Technologies. * * * * SimoTime Technologies makes no warranty or representations * * about the suitability of the software for any purpose. It is * * provided "AS IS" without any expressed or implied warranty, * * including the implied warranties of merchantability, fitness * * for a particular purpose and non-infringement. SimoTime * * Technologies shall not be liable for any direct, indirect, * * special or consequential damages resulting from the loss of * * use, data or projects, whether in an action of contract or * * tort, arising out of or in connection with the use or * * performance of this software * * * * SimoTime Technologies * * 15 Carnoustie Drive * * Novato, CA 94949-5849 * * 415.883.6565 * * * * RESTRICTED RIGHTS LEGEND * * Use, duplication, or disclosure by the Government is subject * * to restrictions as set forth in subparagraph (c)(1)(ii) of * * the Rights in Technical Data and Computer Software clause at * * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of * * Commercial Computer Software - Restricted Rights at 48 * * CFR 52.227-19, as applicable. Contact SimoTime Technologies, * * 15 Carnoustie Drive, Novato, CA 94949-5849. * * * ***************************************************************** * This program is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * ***************************************************************** * ***************************************************************** * Source Member: STAFMTC1.CBL * Calls to: SIMOCAPE ***************************************************************** * * STAFMTC1 - Demonstration of Passing, Parsing and Converting * data string between JCL and COBOL. * * CALLING PROTOCOL * ---------------- * Use standard procedure to RUN or ANIMATE. * * DESCRIPTION * ----------- * This program calls the Callable Application Progam Extension * (i.e. SimoCAPE) to edit a data string and then pass an edited * and formatted data string to a user-defined program. SimoCAPE * also calls the SimoDATE routine to edit and format date * information. * * ************ * * STAFMTJ1 * * ********jcl* * * * * * * * ************ ************ ************ * * SIMOCAPE *--*--* SIMOPARS *-----* Console * * ************ * ************ ******dsply* * * * * * * ************ * * *--* SIMODUMP * * * * ************ * * * * * * ************ * * *--* userprog * * * * ************ * * * * * * ************ * * *--* Console * * * ************ * * * * * ************ ************ ************ ************ * * STAFMTC1 *-----* SIMOCAPE *--*--* SIMOPARS *-----* Console * * ********cbl* ************ * ************ ******dsply* * * * * * * ************ * * *--* SIMODUMP * * * * ************ * * * * * * ************ * * *--* userprog * * * * ************ * * * * * * ************ * * *--* Console * * * ************ * ************ * * EOJ * * ************ * ***************************************************************** * * MAINTENANCE * ----------- * 1997/02/27 Simmons, Created program. * 1997/02/27 Simmons, No changes to date. * ***************************************************************** * ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. ***************************************************************** * Data-structure for Title and Copyright... * ------------------------------------------------------------ 01 SIM-TITLE. 05 T1 pic X(11) value '* STAFMTC1 '. 05 T2 pic X(34) value 'Parse & Process Parameter Strings '. 05 T3 pic X(10) value ' v03.01.24'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* STAFMTC1 '. 05 C2 pic X(20) value 'Copyright 1987-2019 '. 05 C3 pic X(28) value ' SimoTime Technologies '. 05 C4 pic X(20) value ' All Rights Reserved'. 01 SIM-THANKS-01. 05 C1 pic X(11) value '* STAFMTC1 '. 05 C2 pic X(32) value 'Thank you for using this program'. 05 C3 pic X(32) value ' provided from SimoTime Technolo'. 05 C4 pic X(04) value 'gies'. 01 SIM-THANKS-02. 05 C1 pic X(11) value '* STAFMTC1 '. 05 C2 pic X(32) value 'Please send all inquires or sugg'. 05 C3 pic X(32) value 'estions to the helpdesk@simotime'. 05 C4 pic X(04) value '.com'. ***************************************************************** 01 F01-PARM-BUFFER. 05 F01-PARM-LENGTH pic S9(4) comp. 05 F01-PARM-DATA pic X(256). ***************************************************************** 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(11) value '* STAFMTC1 '. 05 MESSAGE-TEXT pic X(68) value is SPACES. ***************************************************************** PROCEDURE DIVISION. perform POST-COPYRIGHT perform APPLICATION-TASK-01 perform APPLICATION-TASK-02 perform APPLICATION-TASK-03 perform APPLICATION-TASK-04 perform APPLICATION-TASK-05 move 'Program is complete...' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE perform THANK-YOU. GOBACK. ***************************************************************** APPLICATION-TASK-01. move 'Task-01 is starting, NODEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE move 'STA NOdebug ID02 stafmtc3 2001/3/3 22.95 call' to F01-PARM-DATA move F01-PARM-DATA to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE add length of F01-PARM-DATA to ZERO giving F01-PARM-LENGTH call 'SIMOCAPE' using F01-PARM-LENGTH, F01-PARM-DATA move 'Task-01 is complete, NODEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE exit. ***************************************************************** APPLICATION-TASK-02. move 'Task-02 is starting, DUMP Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE move 'STA Dump ID02 stafmtc2 2000/07/4 9.49 stop-001' to F01-PARM-DATA move F01-PARM-DATA to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE add length of F01-PARM-DATA to ZERO giving F01-PARM-LENGTH call 'SIMOCAPE' using F01-PARM-LENGTH, F01-PARM-DATA move 'Task-02 is complete, DUMP Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE exit. ***************************************************************** APPLICATION-TASK-03. move 'Task-03 is starting, DEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE move 'STA debug ID02 stafmtc3 1996/07/4 10.00 //Finish' to F01-PARM-DATA move F01-PARM-DATA to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE add length of F01-PARM-DATA to ZERO giving F01-PARM-LENGTH call 'SIMOCAPE' using F01-PARM-LENGTH, F01-PARM-DATA move 'Task-03 is complete, DEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE exit. ***************************************************************** APPLICATION-TASK-04. move 'Task-04 is starting, NODEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE move 'STA NODEBUG ID02 stafmtc2 1943/05/22 10.00 c9a2x6m1' to F01-PARM-DATA move F01-PARM-DATA to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE add length of F01-PARM-DATA to ZERO giving F01-PARM-LENGTH call 'SIMOCAPE' using F01-PARM-LENGTH, F01-PARM-DATA move 'Task-04 is complete, NODEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE exit. ***************************************************************** APPLICATION-TASK-05. move 'Task-05 is starting, NODEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE move 'STA NODEBUG ID02 stafmtc2 1944/4/1 99.98 CALL' to F01-PARM-DATA move F01-PARM-DATA to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE add length of F01-PARM-DATA to ZERO giving F01-PARM-LENGTH call 'SIMOCAPE' using F01-PARM-LENGTH, F01-PARM-DATA move 'Task-05 is complete, NODEBUG Test' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE exit. ***************************************************************** DISPLAY-CONSOLE-MESSAGE. display MESSAGE-BUFFER move SPACES to MESSAGE-TEXT exit. ***************************************************************** ABEND-MESSAGE. if MESSAGE-TEXT not = SPACES perform DISPLAY-CONSOLE-MESSAGE else move '* STAFMTC1 is ABENDING...' to MESSAGE-TEXT perform DISPLAY-CONSOLE-MESSAGE end-if exit. ***************************************************************** POST-COPYRIGHT. display SIM-TITLE display SIM-COPYRIGHT exit. ***************************************************************** THANK-YOU. display SIM-THANKS-01 display SIM-THANKS-02 exit. ***************************************************************** * This example is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * *****************************************************************
This Callable Application Program Extension (SIMOCAPE.cbl) will accept a data string in the following format.
This program accepts two parameters via a LINKAGE SECTION. The first parameter is two bytes and contains a binary number that is the length of the second parameter. The second parameter is a variable length text string (or data string) that contains seven keywords delimited by a space character. This input is then converted to a fixed-field format as defined in a COBOL copy file (PASSCAPE.CPY). The fifth keyword is a date and will be analyzed for correct values and reformatted into multiple formats that are passed to a user-defined application program.
IDENTIFICATION DIVISION. PROGRAM-ID. SIMOCAPE. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * Copyright (C) 1987-2018 SimoTime Technologies. * * * * All rights reserved. Unpublished, all rights reserved under * * copyright law and international treaty. Use of a copyright * * notice is precautionary only and does not imply publication * * or disclosure. * * * * Permission to use, copy, modify and distribute this software * * for any non-commercial purpose and without fee is hereby * * granted, provided the SimoTime copyright notice appear on all * * copies of the software. The SimoTime name or Logo may not be * * used in any advertising or publicity pertaining to the use * * of the software without the written permission of SimoTime * * Technologies. * * * * Permission to use, copy, modify and distribute this software * * for any commercial purpose requires a fee to be paid to * * SimoTime Technologies. Once the fee is received by SimoTime * * the latest version of the software will be delivered and a * * license will be granted for use within an enterprise, * * provided the SimoTime copyright notice appear on all copies * * of the software. The SimoTime name or Logo may not be used * * in any advertising or publicity pertaining to the use of the * * software without the written permission of SimoTime * * Technologies. * * * * SimoTime Technologies makes no warranty or representations * * about the suitability of the software for any purpose. It is * * provided "AS IS" without any expressed or implied warranty, * * including the implied warranties of merchantability, fitness * * for a particular purpose and non-infringement. SimoTime * * Technologies shall not be liable for any direct, indirect, * * special or consequential damages resulting from the loss of * * use, data or projects, whether in an action of contract or * * tort, arising out of or in connection with the use or * * performance of this software * * * * SimoTime Technologies * * 15 Carnoustie Drive * * Novato, CA 94949-5849 * * 415.883.6565 * * * * RESTRICTED RIGHTS LEGEND * * Use, duplication, or disclosure by the Government is subject * * to restrictions as set forth in subparagraph (c)(1)(ii) of * * the Rights in Technical Data and Computer Software clause at * * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of * * Commercial Computer Software - Restricted Rights at 48 * * CFR 52.227-19, as applicable. Contact SimoTime Technologies, * * 15 Carnoustie Drive, Novato, CA 94949-5849. * * * ***************************************************************** * This program is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * ***************************************************************** * ***************************************************************** * Source Member: SIMOCAPE.CBL * Copy Files: PASSPARS.CPY * PASSDUMP.CPY * PASSDATE.CPY * CAPEXCTL.CPY * Calls to: SIMODATE * SIMODUMP * SIMOPARS * User defined program... (optional) ***************************************************************** * * SIMOCAPE - is a Callable Application Program Extension that * performs a variety of common, reusable functions. * * CALLING PROTOCOL * ---------------- * call 'SIMOCAPE' using F01-PARM-LENGTH, F01-PARM-DATA * * The first four bytes of the F01-PARM-DATA must be 'STA ', * if not then program will post a message and abend. * * DESCRIPTION * ----------- * This program will process the JCL parameter from the EXEC * * // EXEC PGM=SIMOCAPE,PARM='STA ID01 additional parameters' * * This program may also be called by another program. * * ************ ************ ************ * * SIMOCAPE *--*--* SIMOPARS *-----* Console * * ************ * ************ ******dsply* * * * * ************ * *--* SIMODUMP * * * ************ * * * * ************ * *--* userprog * * * ************ * * * * ************ * *--* Console * * ************ * ***************************************************************** * * MAINTENANCE * ----------- * 1997/02/27 Simmons, Created program. * ***************************************************************** * DATA DIVISION. WORKING-STORAGE SECTION. * ***************************************************************** * Data-structure for Title and Copyright... ***************************************************************** 01 SIM-TITLE. 05 T1 pic X(11) value '* SIMOCAPE '. 05 T2 pic X(34) value 'Application Program Extensions '. 05 T3 pic X(10) value ' v03.12.11'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* SIMOCAPE '. 05 C2 pic X(20) value 'Copyright 1987-2018 '. 05 C3 pic X(28) value ' SimoTime Technologies '. 05 C4 pic X(20) value ' All Rights Reserved'. ***************************************************************** 01 FIRST-TIME pic X value 'Y'. 01 UPPER-CASE-A pic X value 'A'. 01 UPPER-EBCDIC-STA. 05 UPPER-EBCDIC-S pic X value X'E2'. 05 UPPER-EBCDIC-T pic X value X'E3'. 05 UPPER-EBCDIC-A pic X value X'C1'. 05 filler pic X value X'40'. 01 UPPER-ASCII-STA. 05 UPPER-ASCII-S pic X value X'53'. 05 UPPER-ASCII-T pic X value X'54'. 05 UPPER-ASCII-A pic X value X'41'. 05 filler pic X value X'20'. 01 IX-1 pic 999 value 0. 01 IX-2 pic 999 value 0. 01 IX-3 pic 999 value 0. 01 WORK-DATA pic X(256) value SPACES. 01 WORK-N-7 pic 9(7) value 0. 01 WORK-08 pic X(8) value SPACES. 01 F01-PARM-LENGTH-COPY pic 9(5) value 0. 01 FLAG-4-COMPILE pic X value 'X'. 01 FLAG-4-PARAMETER pic X value 'X'. 01 FLAG-4-ALPHANUMERIC pic X value 'N'. 01 MSG-AC pic X(32) value 'Compilation is ASCII '. 01 MSG-EC pic X(32) value 'Compilation is EBCDIC '. 01 MSG-XC pic X(32) value 'Compilation is not ASCII/EBCDIC '. 01 MSG-AP pic X(32) value 'Parameter is ASCII '. 01 MSG-EP pic X(32) value 'Parameter is EBCDIC '. 01 MSG-XP pic X(32) value 'Parameter is not ASCII/EBCDIC '. 01 MSG-EDIT. 05 filler pic X(17) value 'Parameter Number '. 05 MSG-EDIT-NUMBER pic 9 value 0. 05 filler pic X(3) value ' - '. 05 MSG-EDIT-CONTENT pic X(12) value is SPACES. 05 filler pic X value is SPACES. 05 MSG-EDIT-TEXT pic X(40) value is SPACES. ***************************************************************** 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(11) value '* SIMOCAPE '. 05 MESSAGE-TEXT pic X(68). ***************************************************************** * The following is used by the INSPECT statement to do the * conversion from/to UPPER and lower Case. ***************************************************************** 01 UPPER-CASE pic X(26) value 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. 01 LOWER-CASE pic X(26) value 'abcdefghijklmnopqrstuvwxyz'. 01 ZERO-NINE pic X(10) value '0123456789'. ***************************************************************** * The following is used by the INSPECT statement to do the * conversion betweeen EBCDIC and ASCII. ***************************************************************** 01 EBCDIC-TABLE. *> 01 A B C D E F G H I *> 02 J K L M N O P Q R *> 03 S T U V W X Y Z *> 04 a b c d e f g h i *> 05 j k l m n o p q r *> 06 s t u v w x y z *> 07 0 1 2 3 4 5 6 7 8 9 *> 08 space . < ( + | & ! $ * ) ; - *> 09 7D/7F Single/Double quote / , % _ > ? ` : # @7D =7F *> 10 [ ] { } \ ~ ^ 05 filler pic X(9) value X'C1C2C3C4C5C6C7C8C9'. 05 filler pic X(9) value X'D1D2D3D4D5D6D7D8D9'. 05 filler pic X(8) value X'E2E3E4E5E6E7E8E9'. 05 filler pic X(9) value X'818283848586878889'. 05 filler pic X(9) value X'919293949596979899'. 05 filler pic X(8) value X'A2A3A4A5A6A7A8A9'. 05 filler pic X(10) value X'F0F1F2F3F4F5F6F7F8F9'. 05 filler pic X(13) value X'404B4C4D4E4F505A5B5C5D5E60'. 05 filler pic X(13) value X'616B6C6D6E6F797A7B7C7D7E7F'. 05 filler pic X(7) value X'ADBDC0D0E0A1B0'. 01 EBCDIC-INFO redefines EBCDIC-TABLE pic X(95). *> ------------------------------------------------------------ 01 ASCII-TABLE. *> 01 A B C D E F G H I *> 02 J K L M N O P Q R *> 03 S T U V W X Y Z *> 04 a b c d e f g h i *> 05 j k l m n o p q r *> 06 s t u v w x y z *> 07 0 1 2 3 4 5 6 7 8 9 *> 08 space . < ( + | & ! $ * ) ; - *> 09 27/22 Single/Double quote / , % _ > ? ` : # @27 =22 *> 10 [ ] { } \ ~ ^ 05 filler pic X(9) value X'414243444546474849'. 05 filler pic X(9) value X'4A4B4C4D4E4F505152'. 05 filler pic X(8) value X'535455565758595A'. 05 filler pic X(9) value X'616263646566676869'. 05 filler pic X(9) value X'6A6B6C6D6E6F707172'. 05 filler pic X(8) value X'737475767778797A'. 05 filler pic X(10) value X'30313233343536373839'. 05 filler pic X(13) value X'202E3C282B7C2621242A293B2D'. 05 filler pic X(13) value X'2F2C255F3E3F793A2340273D22'. 05 filler pic X(7) value X'5B5D7B7D5C7E5E'. 01 ASCII-INFO redefines ASCII-TABLE pic X(95). 01 STD-DEBUG-FUNCTION pic X(8) value SPACES. 01 STD-IDENTIFIER pic X(4) value SPACES. 01 STD-USER-FUNCTION pic X(8) value SPACES. 01 FMTC2-DATE-FUNCTION pic X(10) value SPACES. 01 STD-AMOUNT pic X(11) value SPACES. 01 FMTC2-ALPHANUMERIC-FUNCTION pic X(8) value SPACES. ***************************************************************** *> The copy file of the pass area for calling SIMOPARS, the *> parameter parsing routine. COPY PASSPARS. *> ----------------------------------------------------------- *> The copy file of the pass area for calling SIMODUMP, the *> hexadecimal dump routine. COPY PASSDUMP. *> ----------------------------------------------------------- *> The copy file of the pass area for calling SIMODATE, the *> date editing routine. COPY PASSDATE. *> ----------------------------------------------------------- *> The copy file of the pass area for calling a user-program. COPY PASSCAPE. ***************************************************************** LINKAGE SECTION. 01 F01-PARM-BUFFER. 05 F01-PARM-LENGTH pic S9(4) comp. 05 F01-PARM-DATA pic X(256). ***************************************************************** * Mainline processing routine... ***************************************************************** PROCEDURE DIVISION using F01-PARM-BUFFER. if FIRST-TIME not = 'N' if STD-DEBUG-INFO = 'DEBUG ' or STD-DEBUG-INFO = 'TRACE ' perform POST-COPYRIGHT end-if perform ASCII-OR-EBCDIC-COMPILATION move 'N' to FIRST-TIME end-if perform ASCII-OR-EBCDIC-PARAMETER move F01-PARM-DATA to WORK-DATA if FLAG-4-PARAMETER not = FLAG-4-COMPILE if FLAG-4-COMPILE = 'A' inspect WORK-DATA converting EBCDIC-INFO to ASCII-INFO else inspect WORK-DATA converting ASCII-INFO to EBCDIC-INFO end-if end-if perform MOVE-AND-CONVERT-TO-UPPER-CASE perform DISPLAY-THE-PARAMETER-INFO perform PARSE-THE-PARAMETER-DATA perform DISPLAY-THE-PARAMETER-KEYWORDS perform EDIT-AND-FORMAT-PARAMETERS if STD-DEBUG-FUNCTION = 'DEBUG ' or STD-DEBUG-FUNCTION = 'DUMP ' perform HEX-DUMP-OF-PARSING-BUFFER perform SIMODUMP-TO-ASCII-OR-EBCDIC perform DUMP-SIMOTIME-BUFFER end-if evaluate FMTC2-ALPHANUMERIC-FUNCTION when 'CALL ' perform CLOSE-WITH-CALL when 'TEST ' perform CLOSE-WITH-DISPLAY end-evaluate GOBACK. ***************************************************************** * The following routines are in alphabetical order... * ***************************************************************** ***************************************************************** * Determine the compilation environment for this program by * the working storage item. If the UPPER-CASE-A field is a * x'41' then program is ASCI. If the field is x'C1' then the * program is EBCDIC. ***************************************************************** ASCII-OR-EBCDIC-COMPILATION. evaluate UPPER-CASE-A when UPPER-EBCDIC-A move MSG-EC to MESSAGE-TEXT move 'E' to FLAG-4-COMPILE when UPPER-ASCII-A move MSG-AC to MESSAGE-TEXT move 'A' to FLAG-4-COMPILE when OTHER move MSG-XC to MESSAGE-TEXT end-evaluate perform POST-CONDITIONAL-TRACE *> If environment cannot be recognized as ASCII or EBCDIC *> then stop the program. if FLAG-4-COMPILE = 'X' perform POST-ABEND STOP RUN end-if exit. ***************************************************************** * Determine if the Parameter is ASCII or EBCDIC by the format of * the first keyword in the parameter string that should be "STA". ***************************************************************** ASCII-OR-EBCDIC-PARAMETER. evaluate F01-PARM-DATA(1:4) when UPPER-EBCDIC-STA move 'E' to FLAG-4-PARAMETER move MSG-EP to MESSAGE-TEXT when UPPER-ASCII-STA move 'A' to FLAG-4-PARAMETER move MSG-AP to MESSAGE-TEXT when OTHER move 'X' to FLAG-4-PARAMETER move MSG-XP to MESSAGE-TEXT end-evaluate perform POST-CONDITIONAL-TRACE *> If parameter cannot be recognized as ASCII or EBCDIC *> then stop the program. if FLAG-4-PARAMETER = 'X' perform POST-ABEND STOP RUN end-if exit. CLOSE-WITH-CALL. move STD-GREGORIAN-DATE to CAPE-GREGORIAN-DATE move STD-DATE-EDITED to CAPE-DATE-EDITED move STD-DATE-VERBAGE to CAPE-DATE-VERBAGE move STD-JULIAN-DATE to CAPE-JULIAN-DATE move STD-DAYS-REMAINING to CAPE-DAYS-REMAINING move STD-LEAP-YEAR-YN to CAPE-LEAP-YEAR-YN move STD-MM-DAYS to CAPE-DAYS-IN-MONTH move STD-MONTH-VERBAGE to CAPE-MONTH-VERBAGE move STD-AMOUNT to CAPE-AMOUNT call STD-USER-FUNCTION using CAPE-XCTL-API exit. CLOSE-WITH-DISPLAY. move 'Processing the TEST request ' to MESSAGE-TEXT perform POST-MESSAGE move 'Gregorian Date .............. ' to MESSAGE-TEXT move STD-GREGORIAN-DATE to MESSAGE-TEXT(31:10) perform POST-MESSAGE move 'Edited Gregorian Date ....... ' to MESSAGE-TEXT move STD-DATE-EDITED to MESSAGE-TEXT(31:10) perform POST-MESSAGE move 'Text for the Date............ ' to MESSAGE-TEXT move STD-DATE-VERBAGE to MESSAGE-TEXT(31:16) perform POST-MESSAGE move 'Julian Date ................. ' to MESSAGE-TEXT move STD-JULIAN-DATE to MESSAGE-TEXT(31:7) perform POST-MESSAGE move 'Days Remaining in the Year... ' to MESSAGE-TEXT move STD-DAYS-REMAINING to MESSAGE-TEXT(31:3) perform POST-MESSAGE move 'Leap Year Flag (Y or N) ..... ' to MESSAGE-TEXT move STD-LEAP-YEAR-YN to MESSAGE-TEXT(31:1) perform POST-MESSAGE move 'Days in the Month ........... ' to MESSAGE-TEXT move STD-MM-DAYS to MESSAGE-TEXT(31:2) perform POST-MESSAGE move 'Text for the Month .......... ' to MESSAGE-TEXT move STD-MONTH-VERBAGE to MESSAGE-TEXT(31:10) perform POST-MESSAGE move 'Amount ...................... ' to MESSAGE-TEXT move STD-AMOUNT to MESSAGE-TEXT(31:11) perform POST-MESSAGE exit. ***************************************************************** * Display the length and the original parameter plus the copied * parameter that has been converted to upper case... ***************************************************************** DISPLAY-THE-PARAMETER-INFO. if F01-PARM-LENGTH < 1 move 'Parameter length is 00000' to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE else move 'Parameter length is ?????' to MESSAGE-TEXT move F01-PARM-LENGTH-COPY to MESSAGE-TEXT(21:5) perform POST-CONDITIONAL-TRACE move WORK-DATA(1:F01-PARM-LENGTH) to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE move PRS-BUFFER(1:F01-PARM-LENGTH) to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE end-if exit. ***************************************************************** * Display the contents of the parsing tables. ***************************************************************** DISPLAY-THE-PARAMETER-KEYWORDS. add 1 to ZERO giving IX-1 perform until PRS-SIZE(IX-1) = 0 or PRS-POSITION(IX-1) = 0 or IX-1 > PRS-TABLE-MAX perform POST-TABLE-ITEM add 1 to IX-1 end-perform exit. ***************************************************************** DUMP-BUFFER. move 'DUMP' to SIMODUMP-REQUEST move 'OUT1' to SIMODUMP-OUTPUT add 128 to ZERO giving SIMODUMP-LENGTH call 'SIMODUMP' using SIMODUMP-PASS-AREA SIMODUMP-BUFFER exit. ***************************************************************** DUMP-SIMOTIME-BUFFER. *> ------------------------------------------------------------ *> Display the contents of the parsing buffer in DUMP format. move 'HEXDUMP2' to SIMODUMP-DUMP-ID perform DUMP-BUFFER exit. ***************************************************************** EDIT-AND-FORMAT-PARAMETERS. add 2 to ZERO giving IX-1 perform until PRS-SIZE(IX-1) = 0 or PRS-POSITION(IX-1) = 0 or IX-1 > PRS-TABLE-MAX evaluate IX-1 when 2 perform EDIT-DEBUG-FUNCTIONS when 3 perform EDIT-IDENTIFIER when 4 perform EDIT-USER-FUNCTION when 5 perform EDIT-DATE-FUNCTION when 6 perform EDIT-AMOUNT-FUNCTION when 7 perform EDIT-ALPHANUMERIC-FUNCTION end-evaluate add 1 to IX-1 end-perform exit. EDIT-ALPHANUMERIC-FUNCTION. move SPACES to FMTC2-ALPHANUMERIC-FUNCTION if PRS-SIZE(IX-1) < 9 and PRS-SIZE(IX-1) > 0 move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to FMTC2-ALPHANUMERIC-FUNCTION end-if *> Prepare information for display to console... add IX-1 to ZERO giving MSG-EDIT-NUMBER move SPACES to MSG-EDIT-CONTENT move FMTC2-ALPHANUMERIC-FUNCTION to MSG-EDIT-CONTENT *> Prepare a work field for determining allowable content... move FMTC2-ALPHANUMERIC-FUNCTION to WORK-08 *> The following statement will not allow spaces as *> valid characters... inspect WORK-08(1:PRS-SIZE(IX-1)) replacing all SPACE by '/' perform EDIT-ALPHABET-OR-NUMBERS if FLAG-4-ALPHANUMERIC = 'Y' move 'Contains only ALPHA and NUMERIC.' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE else move 'Contains non-ALPHANUMERIC.' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE end-if exit. EDIT-ALPHABET-OR-NUMBERS. inspect WORK-08 converting UPPER-CASE to SPACES inspect WORK-08 converting LOWER-CASE to SPACES inspect WORK-08 converting ZERO-NINE to SPACES if WORK-08 = SPACES move 'Y' to FLAG-4-ALPHANUMERIC else move 'N' to FLAG-4-ALPHANUMERIC end-if exit. *---------------------------------------------------------------- EDIT-IDENTIFIER. move SPACES to STD-IDENTIFIER if PRS-SIZE(IX-1) = 4 move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to STD-IDENTIFIER end-if add IX-1 to ZERO giving MSG-EDIT-NUMBER move SPACES to MSG-EDIT-CONTENT move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to MSG-EDIT-CONTENT if STD-IDENTIFIER = 'ID01' or STD-IDENTIFIER = 'ID02' move 'AOK for Identifier...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE else move 'NOK for Identifier...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-ABEND end-if exit. *---------------------------------------------------------------- EDIT-DEBUG-FUNCTIONS. move SPACES to STD-DEBUG-FUNCTION if PRS-SIZE(IX-1) < 9 and PRS-SIZE(IX-1) > 0 move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to STD-DEBUG-FUNCTION end-if add IX-1 to ZERO giving MSG-EDIT-NUMBER move SPACES to MSG-EDIT-CONTENT move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to MSG-EDIT-CONTENT if STD-DEBUG-FUNCTION = 'DUMP ' or STD-DEBUG-FUNCTION = 'TRACE ' or STD-DEBUG-FUNCTION = 'DEBUG ' or STD-DEBUG-FUNCTION = 'NODEBUG ' move STD-DEBUG-FUNCTION to STD-DEBUG-INFO move 'AOK for Debug Function...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE else move 'NOK for Debug Function...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-ABEND end-if exit. *---------------------------------------------------------------- EDIT-USER-FUNCTION. move SPACES to STD-USER-FUNCTION if PRS-SIZE(IX-1) < 9 and PRS-SIZE(IX-1) > 0 move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to STD-USER-FUNCTION end-if add IX-1 to ZERO giving MSG-EDIT-NUMBER move SPACES to MSG-EDIT-CONTENT move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to MSG-EDIT-CONTENT if STD-USER-FUNCTION = 'STAFMTC2' or STD-USER-FUNCTION = 'STAFMTC3' move 'AOK for User Function...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE else move 'NOK for User Function...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-ABEND end-if exit. *---------------------------------------------------------------- *> This routine will accept dates in the following formats *> ccyymmdd *> ccyy/mm/dd *> ccyy-mm-dd *> ccyy.mm.dd *---------------------------------------------------------------- EDIT-DATE-FUNCTION. add IX-1 to ZERO giving MSG-EDIT-NUMBER move SPACES to MSG-EDIT-CONTENT move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to MSG-EDIT-CONTENT move 'WIP for Calling SIMODATE...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE move SPACES to STD-GREGORIAN-4-EDIT if PRS-SIZE(IX-1) < 11 or PRS-SIZE(IX-1) > 7 move 'EDITDATE' to STD-REQUEST move '-' to STD-DATE-EDIT-BYTE move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to STD-GREGORIAN-4-EDIT call 'SIMODATE' using STD-SIMODATE else move 'NOK for Date Value, field length is incorrect...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-ABEND end-if exit. *---------------------------------------------------------------- EDIT-AMOUNT-FUNCTION. move SPACES to STD-AMOUNT add IX-1 to ZERO giving MSG-EDIT-NUMBER if PRS-SIZE(IX-1) < 9 and PRS-SIZE(IX-1) > 0 move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to STD-AMOUNT end-if *> Right Adjust... perform until STD-AMOUNT(11:1) not = SPACE add 10 to ZERO giving IX-2 perform 10 times move STD-AMOUNT(IX-2:1) to STD-AMOUNT(IX-2 + 1:1) subtract 1 from IX-2 end-perform move ZERO to STD-AMOUNT(1:1) end-perform *> Remove decimal... if STD-AMOUNT(9:1) = '.' add 8 to ZERO giving IX-2 perform 8 times move STD-AMOUNT(IX-2:1) to STD-AMOUNT(IX-2 + 1:1) subtract 1 from IX-2 end-perform end-if if STD-AMOUNT is NUMERIC move STD-AMOUNT to MSG-EDIT-CONTENT move 'AOK for Amount Function...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE else move STD-AMOUNT to MSG-EDIT-CONTENT move 'NOK for Amount Function...' to MSG-EDIT-TEXT move MSG-EDIT to MESSAGE-TEXT perform POST-ABEND end-if exit. *---------------------------------------------------------------- EDIT-CLOSE-FUNCTION. exit. ***************************************************************** HEX-DUMP-OF-PARSING-BUFFER. *> ------------------------------------------------------------ *> Display the contents of the parsing buffer in DUMP format. move PRS-BUFFER to SIMODUMP-BUFFER move 'HEXDUMP1' to SIMODUMP-DUMP-ID perform DUMP-BUFFER exit. ***************************************************************** MOVE-AND-CONVERT-TO-UPPER-CASE. *> ------------------------------------------------------------ *> Move Parameter Length value to a move/display field... add F01-PARM-LENGTH to ZERO giving F01-PARM-LENGTH-COPY *> ------------------------------------------------------------ *> Move Parameter data to the parsing buffer move SPACES to PRS-BUFFER move WORK-DATA(1:F01-PARM-LENGTH) to PRS-BUFFER(1:F01-PARM-LENGTH) *> ------------------------------------------------------------ *> Convert parsing buffer to upper case... inspect PRS-BUFFER converting LOWER-CASE to UPPER-CASE exit. ***************************************************************** PARSE-THE-PARAMETER-DATA. *> ------------------------------------------------------------ *> Display the start of task message. move 'Start Parse for Sample-Task...' to MESSAGE-TEXT perform POST-CONDITIONAL-TRACE *> ------------------------------------------------------------ *> Prepare control items for parsing. move '0' to PRS-REQUEST add 9 to ZERO giving PRS-STATUS move ' ' to PRS-DELIMITER * move 'N' to PRS-TERMINATOR-FLAG move ' ' to PRS-TERMINATOR-BYTE add 32 to ZERO giving PRS-TABLE-MAX add 128 to ZERO giving PRS-BUFFER-SIZE *> ------------------------------------------------------------ *> Move the data string to the parsing buffer and call *> the parsing routine. call 'SIMOPARS' using PRS-PARAMETERS exit. ***************************************************************** POST-TABLE-ITEM. move 'Item-nnnn, Offset-nnnn, Length-nnnn, Parameter - ' to MESSAGE-TEXT(1:49) move IX-1 to MESSAGE-TEXT(6:4) move PRS-POSITION(IX-1) to MESSAGE-TEXT(19:4) move PRS-SIZE(IX-1) to MESSAGE-TEXT(32:4) if PRS-SIZE(IX-1) < 20 move PRS-BUFFER(PRS-POSITION(IX-1):PRS-SIZE(IX-1)) to MESSAGE-TEXT(50:PRS-SIZE(IX-1)) else move PRS-BUFFER(PRS-POSITION(IX-1):19) to MESSAGE-TEXT(50:19) end-if perform POST-CONDITIONAL-TRACE exit. ***************************************************************** * Display Copyright or Program Message... * ------------------------------------------------------------ POST-ABEND. if MESSAGE-TEXT not = SPACES perform POST-MESSAGE end-if move 'Program is ABENDING...' to MESSAGE-TEXT perform POST-CONSOLE perform POST-MESSAGE STOP RUN. POST-CONDITIONAL-TRACE. if STD-DEBUG-INFO = 'DEBUG ' or STD-DEBUG-INFO = 'TRACE ' display MESSAGE-BUFFER end-if move SPACES to MESSAGE-TEXT exit. POST-COPYRIGHT. display SIM-TITLE display SIM-COPYRIGHT exit. POST-CONSOLE. display MESSAGE-BUFFER upon console exit. POST-MESSAGE. display MESSAGE-BUFFER move SPACES to MESSAGE-TEXT exit. ***************************************************************** SIMODUMP-TO-ASCII-OR-EBCDIC. *> ------------------------------------------------------------ *> Convert between EBCDIC and ASCII based on the current *> ASCII or EBCDIC environment. *> Display the contents of the parsing tables. if FLAG-4-COMPILE = 'E' inspect SIMODUMP-BUFFER converting EBCDIC-INFO to ASCII-INFO else inspect SIMODUMP-BUFFER converting ASCII-INFO to EBCDIC-INFO end-if 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 * *****************************************************************
The following program (STAFMTC2.cbl) is used to show the pass area that would be received by a user-defined application program.
IDENTIFICATION DIVISION. PROGRAM-ID. STAFMTC2. AUTHOR. SIMOTIME TECHNOLOGIES. ***************************************************************** * Copyright (C) 1987-2019 SimoTime Technologies. * * * * All rights reserved. Unpublished, all rights reserved under * * copyright law and international treaty. Use of a copyright * * notice is precautionary only and does not imply publication * * or disclosure. * * * * Permission to use, copy, modify and distribute this software * * for any non-commercial purpose and without fee is hereby * * granted, provided the SimoTime copyright notice appear on all * * copies of the software. The SimoTime name or Logo may not be * * used in any advertising or publicity pertaining to the use * * of the software without the written permission of SimoTime * * Technologies. * * * * Permission to use, copy, modify and distribute this software * * for any commercial purpose requires a fee to be paid to * * SimoTime Technologies. Once the fee is received by SimoTime * * the latest version of the software will be delivered and a * * license will be granted for use within an enterprise, * * provided the SimoTime copyright notice appear on all copies * * of the software. The SimoTime name or Logo may not be used * * in any advertising or publicity pertaining to the use of the * * software without the written permission of SimoTime * * Technologies. * * * * SimoTime Technologies makes no warranty or representations * * about the suitability of the software for any purpose. It is * * provided "AS IS" without any expressed or implied warranty, * * including the implied warranties of merchantability, fitness * * for a particular purpose and non-infringement. SimoTime * * Technologies shall not be liable for any direct, indirect, * * special or consequential damages resulting from the loss of * * use, data or projects, whether in an action of contract or * * tort, arising out of or in connection with the use or * * performance of this software * * * * SimoTime Technologies * * 15 Carnoustie Drive * * Novato, CA 94949-5849 * * 415.883.6565 * * * * RESTRICTED RIGHTS LEGEND * * Use, duplication, or disclosure by the Government is subject * * to restrictions as set forth in subparagraph (c)(1)(ii) of * * the Rights in Technical Data and Computer Software clause at * * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of * * Commercial Computer Software - Restricted Rights at 48 * * CFR 52.227-19, as applicable. Contact SimoTime Technologies, * * 15 Carnoustie Drive, Novato, CA 94949-5849. * * * ***************************************************************** * This program is provided by SimoTime Technologies * * Our e-mail address is: helpdesk@simotime.com * * Also, visit our Web Site at http://www.simotime.com * * * ***************************************************************** * SOURCE MODULE STAFMTC2.CBL ***************************************************************** * * STAFMTC2 - This program receives and processes the edited and * formatted data string from the Callable Application Program * Extension member (SimoCAPE). * * CALLING PROTOCOL * ---------------- * call 'STAFMTC2' using CAPE-XCTL-API. * * The format of the LINKAGE SECTION paramter is as follows: * * 01 CAPE-XCTL-API. * 05 CAPE-ID pic X(8). * 05 CAPE-DEBUG pic X(8). * 05 CAPE-GREGORIAN-DATE pic 9(8). * 05 CAPE-DATE-EDITED pic X(10). * 05 CAPE-DATE-VERBAGE pic X(16). * 05 CAPE-JULIAN-DATE pic 9(7). * 05 CAPE-LEAP-YEAR-YN pic X. * 05 CAPE-DAYS-IN-MONTH pic 99. * 05 CAPE-MONTH-VERBAGE pic X(10). * 05 CAPE-AMOUNT pic 9(11). * ***************************************************************** * * MAINTENANCE * ----------- * 1997/02/27 Simmons, Created program. * ***************************************************************** * DATA DIVISION. WORKING-STORAGE SECTION. * ***************************************************************** * Data-structure for Title and Copyright... ***************************************************************** 01 SIM-TITLE. 05 T1 pic X(11) value '* STAFMTC2 '. 05 T2 pic X(34) value 'Receive Edited Date Parameters '. 05 T3 pic X(10) value ' v03.01.24'. 05 T4 pic X(24) value ' http://www.simotime.com'. 01 SIM-COPYRIGHT. 05 C1 pic X(11) value '* STAFMTC2 '. 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 FIRST-TIME pic X value 'Y'. ***************************************************************** 01 MESSAGE-BUFFER. 05 MESSAGE-HEADER pic X(11) value '* STAFMTC2 '. 05 MESSAGE-TEXT pic X(68). ***************************************************************** LINKAGE SECTION. COPY PASSCAPE. ***************************************************************** * Mainline processing routine... ***************************************************************** PROCEDURE DIVISION using CAPE-XCTL-API. if FIRST-TIME not = 'N' perform POST-COPYRIGHT move 'N' to FIRST-TIME end-if move 'Gregorian Date .............. ' to MESSAGE-TEXT move CAPE-GREGORIAN-DATE to MESSAGE-TEXT(31:10) perform POST-MESSAGE move 'Edited Gregorian Date ....... ' to MESSAGE-TEXT move CAPE-DATE-EDITED to MESSAGE-TEXT(31:10) perform POST-MESSAGE move 'Text Date ................... ' to MESSAGE-TEXT move CAPE-DATE-VERBAGE to MESSAGE-TEXT(31:16) perform POST-MESSAGE move 'Julian Date ................. ' to MESSAGE-TEXT move CAPE-JULIAN-DATE to MESSAGE-TEXT(31:7) perform POST-MESSAGE move 'Days Remaining in the Year .. ' to MESSAGE-TEXT move CAPE-DAYS-REMAINING to MESSAGE-TEXT(31:3) perform POST-MESSAGE move 'Leap Year Flag (Y or N) ..... ' to MESSAGE-TEXT move CAPE-LEAP-YEAR-YN to MESSAGE-TEXT(31:1) perform POST-MESSAGE move 'Days in the Month ........... ' to MESSAGE-TEXT move CAPE-DAYS-IN-MONTH to MESSAGE-TEXT(31:2) perform POST-MESSAGE move 'Text for the Month .......... ' to MESSAGE-TEXT move CAPE-MONTH-VERBAGE to MESSAGE-TEXT(31:10) perform POST-MESSAGE move 'Amount ...................... ' to MESSAGE-TEXT move CAPE-AMOUNT to MESSAGE-TEXT(31:11) perform POST-MESSAGE GOBACK. ***************************************************************** * The following routines are in alphabetical order... * ***************************************************************** * ***************************************************************** * Display Copyright or Program Message... * ------------------------------------------------------------ POST-ABEND. if MESSAGE-TEXT not = SPACES perform POST-MESSAGE end-if move 'Program is ABENDING...' to MESSAGE-TEXT perform POST-MESSAGE STOP RUN. POST-COPYRIGHT. display SIM-TITLE display SIM-COPYRIGHT exit. POST-MESSAGE. display MESSAGE-BUFFER move 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 * *****************************************************************
SimoTime provides a suite of programs that perform functions or tasks that are used by many of the application programs and demonstration. The following provides information about the common or shared modules that are used by this suite of programs.
The SIMODATE program is part of the SIMOMODS suite of common or shared callable routines. The following provides detailed information about the SIMODATE program.
Explore a callable date validation, edit and convert routine that will accept a date in the ccyymmdd format and convert into various other formats. The routine will identify leap years, calculate the day of year and the number of days remaining in the year.
The SIMODUMP program is part of the SIMOMODS suite of common or shared callable routines. The following provides detailed information about the SIMODUMP program.
Explore a callable routine that will convert a data string into a hexadecimal dump string. The dump information may include the hex values, the possible EBCDIC translation and the possible ASCII translation based on the user's request.
This suite of programs provides examples of how to parse, edit, modify, format and display (standard or hexadecimal dump) various words within a data string. 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 choice of alternatives.
In the world of programming there are many ways to solve a problem. This documentation and software were developed and tested on systems that are configured for a SIMOTIME environment based on the hardware, operating systems, user requirements and security requirements. Therefore, adjustments may be needed to execute the jobs and programs when transferred to a system of a different architecture or configuration.
SIMOTIME Services has experience in moving or sharing data or application processing across a variety of systems. For additional information about SIMOTIME Services or Technologies please contact us using the information in the Contact or Feedback section of this document.
Software Agreement and Disclaimer
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.
SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.
Note: A SimoTime License is required for the items to be made available on a local system or server.
The following links may be to the current server or to the Internet.
Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the icon.
Explore a complete list of the SimoTime Callable Routines or Utility Programs. This includes the callable routines and utility programs for the Micro Focus environment.
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.
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 (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 |
Data String Manipulation |
Copyright © 1987-2025 SimoTime Technologies and Services All Rights Reserved |
When technology complements business |
http://www.simotime.com |