Pointers & External Data
Using COBOL Procedure Pointers
  Table of Contents  v-24.01.01 - callam01.htm 
  Introduction
  Procedure Pointer
  External Data
  CALL, Program Name & LINKAGE
  Primary COBOL Program
  Called COBOL Routine, an I/O Module
  Copy File, Working Storage Definitions
  Job Scripts for Standard Call
  JCL Member
  CMD File
  CALL, Pointer & External Data
  Primary COBOL Program
  Called COBOL Routine, an I/O Module
  Copy File, Working Storage Definitions
  Job Scripts for Procedure Call
  JCL Member
  CMD File
  Ancillary Functionality
  Set the Environment
  Display and Log Messages
  Summary
  Software Agreement and Disclaimer
  Downloads and Links
  Current Server or Internet Access
  Internet Access Required
  Glossary of Terms
  Contact or Feedback
  Company Overview
The SimoTime Home Page 

Table of Contents Previous Section Next Section Introduction

This suite of programs will describe how to use procedure pointers and external data items. A procedure pointer will be defined in a primary COBOL (or mainline) program. The procedure pointer will then be used to call a secondary COBOL program. A LINKAGE Section will not be required in the secondary COBOL program since the data will be accessed (or shared) using EXTERNAL Data Items. Also included is a suite of programs that show the traditional method for calling programs and passing data items.

This suite of programs will provide the following.

1 Provide an example of a COBOL program calling another COBOL program using traditional coding techniques.
2 Provide an example of defining and sharing data between two COBOL programs using traditional WORKING-STORAGE and LINKAGE section data definitions.
3 Provide an example of a COBOL program calling another COBOL program using a procedure pointer.
4 Provide an example of defining and sharing data between two COBOL programs using EXTERNAL Data Items.
  Alternatives for sharing data between programs.

The source code, data sets and documentation are provided in a single zipped file called CALLAM01.ZIP. This zipped file may be downloaded from the SimoTime Web site. In the Windows and Micro Focus environment the file names have file extensions. When the source members are uploaded to a ZOS Mainframe from the Windows and Micro Focus environment the file extensions are dropped.


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

Table of Contents Previous Section Next Section Procedure Pointer

Procedure pointers are data items defined with the USAGE IS PROCEDURE-POINTER clause. You can set a procedure-pointer data item by using format 6 of the SET statement. You can set procedure-pointers to contain entry addresses (or pointers) to the following entry points.

1 Another COBOL program
2 A program written in another language.
3 An alternate entry point in another COBOL program (as defined in an ENTRY statement).
  The Possible Targets for a Procedure Pointer

Table of Contents Previous Section Next Section External Data

COBOL programs can share data items by using the EXTERNAL clause. You specify the EXTERNAL clause on the 01-level data description in the WORKING-STORAGE Section of the COBOL program. The following rules apply.

1 Items subordinate to an EXTERNAL group item inherit the EXTERNAL property.
2 The name used for the data item cannot be used on another EXTERNAL item within the same program.
3 The VALUE clause cannot be specified for any group item, or subordinate item, that is EXTERNAL.
4 EXTERNAL data cannot be initialized. Its initial value at run time is undefined.
  Rules for External Data

Note:  If the application requires that EXTERNAL data items be initialized they may be explicitly initialized in the main program.

A COBOL program within a run unit that has the same data description for the item as the program containing (or defining) the item may access and process the data item. For example, if program A had the following data description:

       01  MY-EXTERNAL-ITEM      PIC X(10) EXTERNAL.

Program B could access the data item by having the identical data description in its WORKING-STORAGE Section.

Note:  If the EXTERNAL data items are not identical then Program B will fail at execution time.

Table of Contents Previous Section Next Section CALL, Program Name & LINKAGE

This section describes by example a COBOL program that uses the traditional method of calling a second COBOL program by program name. Parameters are passed using data (or a pass area) that is defined in the WORKING-STORAGE section of the calling program and is referenced in the LINKAGE section of the called program.

Table of Contents Previous Section Next Section Primary COBOL Program

The following (CALLUSC1.cbl) is the primary (or calling) COBOL program that uses a standard "CALL by Program Name" approach to do the call. The data items are defined in the WORKING-STORAGE Section of the calling program and are passed to the called program via a USING clause on the call statement. To ensure the data is defined identically in both programs a copy file (PASSUS80.cpy) is used to define the data.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CALLUSC1.
       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       *
      *****************************************************************
      *
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CALLUSC1 '.
           05  T2 pic X(34) value 'Standard Call with Linkage Section'.
           05  T3 pic X(10) value ' v07.06.11'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CALLUSC1 '.
           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 '* CALLUSC1 '.
           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 '* CALLUSC1 '.
           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'.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CALLUSC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

       01  TEST-RECORD.
           05  filler              pic X(12) value 'Test Record '.
           05  TEST-RECORD-COUNT   pic 9(11) value 0.

       01  RECORD-LIMIT            pic 9(5)  value 25000.

       COPY PASSWS80.

      *****************************************************************
      * The Call statements in this program do a "CALL by Name" with a
      * USING clause to pass data...
      *
       PROCEDURE DIVISION.

           perform Z-POST-COPYRIGHT

           move 'OPEN' to PASS-WS-80-REQUEST
           call 'CALLUSC2' using PASS-WS-80

           move 'PUT ' to PASS-WS-80-REQUEST
           perform until TEST-RECORD-COUNT not < RECORD-LIMIT
               add 1 to TEST-RECORD-COUNT
               move TEST-RECORD to PASS-WS-80-DATA
               call 'CALLUSC2' using PASS-WS-80
           end-perform

           move 'CLOZ' to PASS-WS-80-REQUEST
           call 'CALLUSC2' using PASS-WS-80

           perform Z-THANK-YOU.

           GOBACK.

      *****************************************************************
      * The following Z-ROUTINES provide administrative functions     *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

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

      *****************************************************************
       Z-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       *
      *****************************************************************

Table of Contents Previous Section Next Section Called COBOL Routine, an I/O Module

The following (CALLUSC2.cbl) is the secondary (or called) COBOL program that receives control via a traditional call by name. The data items are defined in the WORKING-STORAGE Section of the calling program and are passed to the called program via a USING clause on the call statement. The data items are then accessed based on the data definitions of the called program's LINKAGE Section. To ensure the data is defined identically in both programs a copy file (PASSUS80.cpy) is used to define the data. This called program is an I/O module that simply writes records to a record sequential file.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CALLUSC2.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  An I/O Module for a New Sequential File with Fixed, 80-Byte  *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  OUTPUT    SIMOSEQ1 SEQUENTIAL    FIXED      00080            *
      *                                                               *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SIMOSEQ1-FILE  ASSIGN TO       SIMOSEQ1
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS SIMOSEQ1-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  SIMOSEQ1-FILE
           DATA RECORD    IS SIMOSEQ1-REC.
       01  SIMOSEQ1-REC.
           05  SIMOSEQ1-DATA-01 PIC X(80).

      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIMOSEQ1-STATUS.
           05  SIMOSEQ1-STATUS-L     pic X.
           05  SIMOSEQ1-STATUS-R     pic X.
       01  SIMOSEQ1-EOF              pic X       value 'N'.
       01  SIMOSEQ1-OPEN-FLAG        pic X       value 'C'.

      *****************************************************************
      * The following buffers are used to create a four-byte status   *
      * code that may be displayed.                                   *
      *****************************************************************
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  IO-STATUS-04.
           05  IO-STATUS-0401      pic 9     value 0.
           05  IO-STATUS-0403      pic 999   value 0.
       01  TWO-BYTES-BINARY        pic 9(4)  BINARY.
       01  TWO-BYTES-ALPHA         redefines TWO-BYTES-BINARY.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CALLUSC2 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  PROGRAM-NAME            pic X(8)     value 'CALLUSC2'.

       01  APPL-RESULT             pic S9(9)    comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

      *****************************************************************
       LINKAGE SECTION.
       COPY PASSWS80.

      *****************************************************************
      * The "USING" clause on the following statement is required. The
      * PASS-WS-80 is a group items defined in the Copy File that is
      * located in the LINKAGE Section of this program.
      *
       PROCEDURE DIVISION using PASS-WS-80.
           evaluate PASS-WS-80-REQUEST
             when 'PUT ' move PASS-WS-80-DATA to SIMOSEQ1-DATA-01
                         perform SIMOSEQ1-WRITE
             when 'OPEN' perform SIMOSEQ1-OPEN
             when 'CLOZ' perform SIMOSEQ1-CLOSE
             when other  add 16 to ZERO giving RETURN-CODE
                         move 0016 to PASS-WS-80-RESPOND
           end-evaluate

           GOBACK.
      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       SIMOSEQ1-WRITE.
           if  SIMOSEQ1-OPEN-FLAG = 'C'
               perform SIMOSEQ1-OPEN
           end-if
           write SIMOSEQ1-REC
           if  SIMOSEQ1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SIMOSEQ1-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'WRITE Failure with SIMOSEQ1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SIMOSEQ1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SIMOSEQ1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT SIMOSEQ1-FILE
           if  SIMOSEQ1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SIMOSEQ1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with SIMOSEQ1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SIMOSEQ1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SIMOSEQ1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SIMOSEQ1-FILE
           if  SIMOSEQ1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to SIMOSEQ1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with SIMOSEQ1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SIMOSEQ1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-ROUTINES provide administrative functions     *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * four digits. If the full two byte file status is numeric it   *
      * will display as 00nn. If the 1st byte is a numeric nine (9)   *
      * the second byte will be treated as a binary number and will   *
      * display as 9nnn.                                              *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               move IO-STAT1 to IO-STATUS-04(1:1)
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           else
               move '0000' to IO-STATUS-04
               move IO-STATUS to IO-STATUS-04(3:2)
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           exit.

      *****************************************************************
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section Copy File, Working Storage Definitions

The following (PASSWS80.cpy) is the COBOL copy file that is used by both programs to define or access the data Items. The COPY statement is placed in the WORKING-STORAGE Section of the calling program and the LINKAGE Section of the called program.

      *****************************************************************
      *               PASSWS80.CPY - a COBOL Copy File                *
      *         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  PASS-WS-80.
           05  PASS-WS-80-REQUEST  pic X(4).
           05  PASS-WS-80-RESPOND  pic x(4).
           05  PASS-WS-80-DATA     pic X(80).
      *
      ***  PASSWS80 - End-of-Copy File - - - - - - - - - - - PASSWS80 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Job Scripts for Standard Call

The JCL Member is provided to execute the test programs on an IBM Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Server.

The CMD File is provided to execute the test programs on a Windows System using Micro Focus COBOL.

Note:  Both jobs will execute a COBOL program that uses a standard call methodology and a Linkage Section.

Table of Contents Previous Section Next Section JCL Member

The following (CALLUSJ1.jcl) is the Mainframe Job Control (or JCL) member that is used to run the sample application. Using this approach requires a valid license for Micro Focus Mainframe Express or Micro Focus Enterprise Server with the Mainframe Transaction Option (ES/MTO).

//CALLUSJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CALLUSJ1.JCL - a JCL Member for Batch Job Processing        *
//*       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   -   Standard Call with a Linkage Section.
//* Author -   SimoTime Technologies
//* Date   -   January 01, 1997
//*
//* This set of COBOL programs will use a standard calling interface
//* between a mainline program and an I/O module to create a new
//* sequential file with 80-byte, fixed-length records.
//*
//*         ************
//*         * CALLUSJ1 *
//*         ********jcl*
//*              *
//*              *
//*         ************
//*         *  IEFBR14 *      * Delete USE1SEQ1 File
//*         ********jcl*
//*              *
//*              *
//*         ************      ************
//*         * CALLUSC1 *-call-* CALLUSC2 *
//*         ********cbl*      ********cbl*
//*              *                 *
//*              *            ************
//*              *            * USE1SEQ1 *
//*              *            *******qsam*
//*         ************
//*         *   EOJ    *
//*         ************
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//SIMOSEQ1 DD  DSN=SIMOTIME.DATA.USE1SEQ1,
//             DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create a new sequential file...
//*
//CALLUSS1 EXEC PGM=CALLUSC1
//STEPLIB  DD  DISP=SHR,DSN=MFI01.SIMOPROD.LOADLIB1
//SIMOSEQ1 DD  DISP=SHR,DSN=SIMOTIME.DATA.USE1SEQ1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section CMD File

The following (CALLUSE1.cmd) is the Windows Command file that is used to run the sample application. Using this approach only requires a valid Micro Focus license for Net Express. Micro Focus Enterprise Server with the Mainframe Transaction Option (ES/MTO) is not required.

@echo OFF
rem  * *******************************************************************
rem  *               CALLUSE1.CMD - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2019 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   -   Standard Call by Name with a Linkage Section.
rem  * Author -   SimoTime Enterprises
rem  * Date   -   January 01, 2006
rem  *
rem  * This set of COBOL programs will use a standard calling interface
rem  * between a mainline program and an I/O module to create a new
rem  * sequential file with 80-byte, fixed-length records.
rem  *
rem  * ********************************************************************
rem  * Step 1 of 2, Set the global environment variables...
rem  *
     setlocal
     call ..\Env1BASE
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************CallUsE1"
     call SimoNOTE "Starting JobName CallUsE1"
rem  * ********************************************************************
rem  * Step 2 of 2, Execute the sample program...
rem  *
     set SIMOSEQ1=%BaseLib1%\DATA\Wrk1\USE1Cmd1.DAT
     echo %SYSOUT%
     if exist %SIMOSEQ1% erase %SIMOSEQ1%
     run CALLUSC1
     if ERRORLEVEL = 1 set JobStatus=0001
     if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
     call SimoNOTE "Finished JobName CallUsE1, Job Status is %JobStatus%"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING JobName CallUsE1, Job Status is %JobStatus%"
     goto :End
:End
     call SimoNOTE "Conclude SysOut is %SYSOUT%"
     if not "%1" == "nopause" pause
     endlocal

Table of Contents Previous Section Next Section CALL, Pointer & External Data

This section describes by example a COBOL program that uses a procedure pointer to call a second COBOL program. Data is passed (or shared) by both programs using EXTERNAL Data Items that are defined in the WORKING-STORAGE Section of each program. A LINKAGE Section is not required in the called program.

Table of Contents Previous Section Next Section Primary COBOL Program

The following (CALLPEC1.cbl) is the primary (or calling) COBOL program that uses a procedure pointer to do the call. Both programs use EXTERNAL Data Items to pass (or share) data items. To ensure the EXTERNAL Data is defined identically in both programs a copy file (PASSEX80.cpy) is used to define the data.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CALLPEC1.
       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       *
      *****************************************************************
      *
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  SIM-TITLE.
           05  T1 pic X(11) value '* CALLPEC1 '.
           05  T2 pic X(34) value 'Procedural-Pointer/External-Memory'.
           05  T3 pic X(10) value ' v07.06.11'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* CALLPEC1 '.
           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 '* CALLPEC1 '.
           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 '* CALLPEC1 '.
           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'.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CALLPEC1 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

       01  TEST-RECORD.
           05  filler              pic X(12) value 'Test Record '.
           05  TEST-RECORD-COUNT   pic 9(11) value 0.

       01  RECORD-LIMIT            pic 9(9)  value 25000.
      *01  RECORD-LIMIT            pic 9(9)  value 500000.

       01  CALLPEC2-PTR            PROCEDURE-POINTER.
       01  CALLPEC2-PGM            pic X(8)    value 'CALLPEC2'.

       COPY PASSEX80.

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

           perform Z-POST-COPYRIGHT

           set CALLPEC2-PTR to entry CALLPEC2-PGM

           move 'OPEN' to PASS-EX80-REQUEST
           call CALLPEC2-PTR

           move 'PUT ' to PASS-EX80-REQUEST
           perform until TEST-RECORD-COUNT not < RECORD-LIMIT
               add 1 to TEST-RECORD-COUNT
               move TEST-RECORD to PASS-EX80-DATA
               call CALLPEC2-PTR
           end-perform

           move 'CLOZ' to PASS-EX80-REQUEST
           call CALLPEC2-PTR

           perform Z-THANK-YOU.

           GOBACK.

      *****************************************************************
      * The following Z-ROUTINES provide administrative functions     *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

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

      *****************************************************************
       Z-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       *
      *****************************************************************

Table of Contents Previous Section Next Section Called COBOL Routine, an I/O Module

The following (CALLPEC2.cbl) is the secondary (or called) COBOL program that receives control via a procedure pointer. Both programs use EXTERNAL Data Items to pass (or share) data items. To ensure the EXTERNAL Data is defined identically in both programs a copy file (PASSEX80.cpy) is used to define the data. This program is an I/O module that simply writes records to a record sequential file.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    CALLPEC2.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *                                                               *
      *  An I/O Module for a New Sequential File with Fixed, 80-Byte  *
      *                                                               *
      *                                   Record    Record     Key    *
      *  Function  Name     Organization  Format    Max-Min  Pos-Len  *
      *  OUTPUT    SIMOSEQ1 SEQUENTIAL    FIXED      00080            *
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SIMOSEQ1-FILE  ASSIGN TO       SIMOSEQ1
                  ORGANIZATION  IS SEQUENTIAL
                  ACCESS MODE   IS SEQUENTIAL
                  FILE STATUS   IS SIMOSEQ1-STATUS.

      *****************************************************************
       DATA DIVISION.
       FILE SECTION.
       FD  SIMOSEQ1-FILE
           DATA RECORD    IS SIMOSEQ1-REC.
       01  SIMOSEQ1-REC.
           05  SIMOSEQ1-DATA-01 PIC X(80).

      *****************************************************************
       WORKING-STORAGE SECTION.
       01  SIMOSEQ1-STATUS.
           05  SIMOSEQ1-STATUS-L     pic X.
           05  SIMOSEQ1-STATUS-R     pic X.
       01  SIMOSEQ1-EOF              pic X       value 'N'.
       01  SIMOSEQ1-OPEN-FLAG        pic X       value 'C'.

      *****************************************************************
      * The following buffers are used to create a four-byte status   *
      * code that may be displayed.                                   *
      *****************************************************************
       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  IO-STATUS-04.
           05  IO-STATUS-0401      pic 9     value 0.
           05  IO-STATUS-0403      pic 999   value 0.
       01  TWO-BYTES-BINARY        pic 9(4)  BINARY.
       01  TWO-BYTES-ALPHA         redefines TWO-BYTES-BINARY.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.

      *****************************************************************
      * Message Buffer used by the Z-DISPLAY-MESSAGE-TEXT routine.    *
      *****************************************************************
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* CALLPEC2 '.
           05  MESSAGE-TEXT.
               10  MESSAGE-TEXT-1  pic X(68)   value SPACES.
               10  MESSAGE-TEXT-2  pic X(188)  value SPACES.

      *****************************************************************
       01  PROGRAM-NAME            pic X(8)     value 'CALLPEC2'.

       01  APPL-RESULT             pic S9(9)    comp.
           88  APPL-AOK            value 0.
           88  APPL-EOF            value 16.

       COPY PASSEX80.

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

           evaluate PASS-EX80-REQUEST
             when 'PUT ' move PASS-EX80-DATA to SIMOSEQ1-DATA-01
                         perform SIMOSEQ1-WRITE
             when 'OPEN' perform SIMOSEQ1-OPEN
             when 'CLOZ' perform SIMOSEQ1-CLOSE
             when other  add 16 to ZERO giving RETURN-CODE
                         move 0016 to PASS-EX80-RESPOND
           end-evaluate

           GOBACK.

      *****************************************************************
      * I/O Routines for the OUTPUT File...                           *
      *****************************************************************
       SIMOSEQ1-WRITE.
           if  SIMOSEQ1-OPEN-FLAG = 'C'
               perform SIMOSEQ1-OPEN
           end-if
           write SIMOSEQ1-REC
           if  SIMOSEQ1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SIMOSEQ1-STATUS = '10'
                   add 16 to ZERO giving APPL-RESULT
               else
                   add 12 to ZERO giving APPL-RESULT
               end-if
           end-if.
           if  APPL-AOK
               CONTINUE
           else
               move 'WRITE Failure with SIMOSEQ1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SIMOSEQ1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SIMOSEQ1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open OUTPUT SIMOSEQ1-FILE
           if  SIMOSEQ1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SIMOSEQ1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'OPEN Failure with SIMOSEQ1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SIMOSEQ1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SIMOSEQ1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SIMOSEQ1-FILE
           if  SIMOSEQ1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'C' to SIMOSEQ1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'CLOSE Failure with SIMOSEQ1' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SIMOSEQ1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-ROUTINES provide administrative functions     *
      * for this program.                                             *
      *****************************************************************
      * ABEND the program, post a message to the console and issue    *
      * a STOP RUN.                                                   *
      *****************************************************************
       Z-ABEND-PROGRAM.
           if  MESSAGE-TEXT not = SPACES
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-MESSAGE-TEXT
           add 12 to ZERO giving RETURN-CODE
           STOP RUN.
      *    exit.

      *****************************************************************
      * Display CONSOLE messages...                                   *
      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           if MESSAGE-TEXT-2 = SPACES
               display MESSAGE-BUFFER(1:79)
           else
               display MESSAGE-BUFFER
           end-if
           move all SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
      * Display the file status bytes. This routine will display as   *
      * four digits. If the full two byte file status is numeric it   *
      * will display as 00nn. If the 1st byte is a numeric nine (9)   *
      * the second byte will be treated as a binary number and will   *
      * display as 9nnn.                                              *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               move IO-STAT1 to IO-STATUS-04(1:1)
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               add TWO-BYTES-BINARY to ZERO giving IO-STATUS-0403
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           else
               move '0000' to IO-STATUS-04
               move IO-STATUS to IO-STATUS-04(3:2)
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STATUS-04 to MESSAGE-TEXT(17:4)
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           exit.
      *****************************************************************
      *             A product of SimoTime Technologies                *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Table of Contents Previous Section Next Section Copy File, Working Storage Definitions

The following (PASSEX80.cpy) is the COBOL copy file that is used by both programs to define or access the EXTERNAL Data Items.

      *****************************************************************
      *               PASSEX80.CPY - a COBOL Copy File                *
      *         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  PASS-EX80              EXTERNAL.
           05  PASS-EX80-REQUEST  pic X(4).
           05  PASS-EX80-RESPOND  pic x(4).
           05  PASS-EX80-DATA     pic X(80).
      *
      ***  PASSEX80 - End-of-Copy File - - - - - - - - - - - PASSEX80 *
      *****************************************************************
      *

Table of Contents Previous Section Next Section Job Scripts for Procedure Call

The JCL Member is provided to execute the test programs on an IBM Mainframe System with ZOS or a Linux, UNIX or Windows System with Micro Focus Enterprise Server.

The CMD File is provided to execute the test programs on a Windows System using Micro Focus COBOL.

Note:  Both jobs will execute a COBOL program that uses a procedure call methodology and External Data Items.

Table of Contents Previous Section Next Section JCL Member

The following (CALLPEJ1.jcl) is the Mainframe Job Control (or JCL) member that is used to run the sample application. Using this approach requires a valid license for Micro Focus Mainframe Express or Micro Focus Enterprise Server with the Mainframe Transaction Option (ES/MTO).

//CALLPEJ1 JOB SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//* *******************************************************************
//*       CALLPEJ1.JCL - a JCL Member for Batch Job Processing        *
//*       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   -   Procedure Pointer with External Data Items.
//* Author -   SimoTime Technologies
//* Date   -   January 01, 2006
//*
//* This set of COBOL programs will use a prodedure pointer to transfer
//* control between a mainline program to an I/O module to create a new
//* sequential file with 80-byte, fixed-length records. The parameters
//* are passed using EXTERNAL Data Items.
//* A LINKAGE Section is not required in the I/O module.
//*
//*         ************
//*         * CALLPEJ1 *
//*         ********jcl*
//*              *
//*              *
//*         ************
//*         *  IEFBR14 *      * Delete PEE1SEQ1 File
//*         ********jcl*
//*              *
//*              *
//*         ************      ************
//*         * CALLPEC1 *-call-* CALLPEC2 *
//*         ********cbl*      ********cbl*
//*              *                 *
//*              *            ************
//*              *            * PEE1SEQ1 *
//*              *            *******qsam*
//*         ************
//*         *   EOJ    *
//*         ************
//*
//* *******************************************************************
//* Step 1 of 2, Delete any previously created file...
//*
//QSAMDELT EXEC PGM=IEFBR14
//SIMOSEQ1 DD  DSN=SIMOTIME.DATA.PEE1SEQ1,
//             DISP=(MOD,DELETE,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//*
//* *******************************************************************
//* Step 2 of 2, Create a new sequential file...
//*
//CALLPES1 EXEC PGM=CALLPEC1
//STEPLIB  DD  DISP=SHR,DSN=MFI01.SIMOPROD.LOADLIB1
//SIMOSEQ1 DD  DISP=SHR,DSN=SIMOTIME.DATA.PEE1SEQ1,
//             DISP=(NEW,CATLG,DELETE),
//             STORCLAS=MFI,
//             SPACE=(TRK,5),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
//SYSOUT   DD  SYSOUT=*
//*

Table of Contents Previous Section Next Section CMD File

The following (CALLPEE1.cmd) is the Windows Command file that is used to run the sample application. Using this approach only requires a valid Micro Focus license for Net Express. Micro Focus Enterprise Server with the Mainframe Transaction Option (ES/MTO) is not required.

@echo OFF
rem  * *******************************************************************
rem  *               CALLPEE1.CMD - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *           (C) Copyright 1987-2019 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   -   Procedure Pointer with External Data Items.
rem  * Author -   SimoTime Enterprises
rem  * Date   -   January 01, 2006
rem  *
rem  * This set of COBOL programs will use a prodedure pointer to transfer
rem  * control between a mainline program to an I/O module to create a new
rem  * sequential file with 80-byte, fixed-length records. The parameters
rem  * are passed (or shared) using EXTERNAL Data Items.
rem  * A LINKAGE Section is not required in the I/O module.
rem  *
rem  * ********************************************************************
rem  * Step 1 of 2, Set the global environment variables...
rem  *
     setlocal
     call ..\Env1BASE
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
rem  *
     call SimoNOTE "*******************************************************CallPeE1"
     call SimoNOTE "Starting JobName CallPeE1"
rem  * ********************************************************************
rem  * Step 2 of 2, Execute the sample program...
rem  *
     set SIMOSEQ1=%BaseLib1%\DATA\Wrk1\SimoSeq1.DAT
     echo %SYSOUT%
     run CALLPEC1
     if ERRORLEVEL = 1 set JobStatus=0001
     if not "%JobStatus%" == "0000" goto :EojNOK
:EojAOK
     call SimoNOTE "Finished JobName CallPeE1, Job Status is %JobStatus%"
     goto :End
:EojNOK
     call SimoNOTE "ABENDING JobName CallPeE1, Job Status is %JobStatus%"
     goto :End
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause
     endlocal

Table of Contents Previous Section Next Section Ancillary Functionality

This section provides additional detail about the CMD files and programs that are used to support this set of sample programs.

Table of Contents Previous Section Next Section Set the Environment

A Windows command file (ENV1BASE.cmd) is called from other command files to set commonly used environment variables. This provides a single point of definition. The following is a listing of the contents of the command file.

@echo OFF
rem  * *******************************************************************
rem  *               ENV1BASE.cmd - a Windows Command File               *
rem  *        This program is provided by SimoTime Technologies          *
rem  *           (C) Copyright 1987-2021 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 UMAPALIB=%BASECAT%\ASC1
     set UMAPELIB=%BASECAT%\EBC1
     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
     set USERPOST=%BASEAPP%\LOGS\ASSIGNED_USER_POST_FILE.txt
     if [%1]==[] goto NO_POST
     set SYSOUT=%BaseLib1%\LOGS\SYSOUT_%1.txt
     call SIMONOTE "+ ENV1BASE *"
     call SIMONOTE "+ ENV1BASE ********************************************************************%1"
     call SIMONOTE "+ ENV1BASE is preparing the System Environment..."
     call SIMONOTE "+ SIMOLIBR is %SIMOLIBR%"
     call SIMONOTE "+ MIFOSYS1 is %MIFOSYS1%"
     call SIMONOTE "+ BASELIB1 is %BASELIB1%"
:NO_POST
     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     set CATALINA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_112
rem  *
rem  * Set the Environment for the Java Environment...
rem     set JAVABASE=C:\APACHETC\apache-tomcat-7.0.52
     set JAVABASE=C:\Program Files (x86)\Java\jdk1.8.0_112
     set JAVASDK="%JAVABASE%\bin"
     set JAVA_HOME=%JAVABASE%
     set JRE_HOME=%JAVABASE%
     set SIMOTCAT=%CATALINA_HOME%\webapps\simotcat
     set SIMPACKS=%CATALINA_HOME%\webapps\simotcat\WEB-INF\classes\simpacks
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 Build Tools
     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  *
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;%MIFOVCBL%;%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 MAINFRAME_FLOATING_POINT=true
     set COBIDY=%BASEAPP%\COBIDY
     set COBPATH=.;%BASEAPP%\LOADLIB;%BASEAPP%\LOADLIB\GNTS;%BASESYS%\LOADLIB;%SimoLIBR%
     set LIBPATH=.;%BASEAPP%\LOADLIB;%BASEAPP%\LOADLIB\GNTS;%BASESYS%\LOADLIB;%SimoLIBR%
     set TXDIR=%BASESYS%\LOADLIB;%MIFOBASE%
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%
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
rem  *
     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%\bin\mfcobol.jar
rem  *
     set JobStatus=0000
     call SIMONOTE "+ ENV1BASE is returning to caller"


Table of Contents Previous Section Next Section Display and Log Messages

The following (SIMONOTE.cmd) is a listing of the contents of the SimoNOTE.CMD command file.

@echo OFF
rem  * *******************************************************************
rem  *               SIMONOTE.cmd - a Windows Command File               *
rem  *         This program is provided by SimoTime Technologies         *
rem  *            (C) Copyright 1987-2019 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

Table of Contents Previous Section Next Section Summary

This suite of programs and documentation is used to describe and demonstrate two calling methodologies. The 1st calling methodology will show a standard call using a program name and a Linkage Section. The 2nd calling methodology will show a procedure call using a pointer and external data. 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 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.

Table of Contents Previous Section Next Section Software Agreement and Disclaimer

Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Technologies. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Technologies.

SimoTime Technologies makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any expressed or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Technologies shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.

Table of Contents Previous Section Next Section Downloads and Links

This section includes links to documents with additional information that are beyond the scope and purpose of this document. The first group of documents may be available from a local system or via an internet connection, the second group of documents will require an internet connection.

Note: A SimoTime License is required for the items to be made available on a local system or server.

Table of Contents Previous Section Next Section Current Server or Internet Access

The following links may be to the current server or to the Internet.

Note: The latest versions of the SimoTime Documents and Program Suites are available on the Internet and may be accessed using the Link to Internet icon. If a user has a SimoTime Enterprise License the Documents and Program Suites may be available on a local server and accessed using the Link to Server icon.

Link to Internet   Link to Server   Explore the JCL Connection for more examples of JCL functionality with programming techniques and sample code.

Link to Internet   Link to Server   Explore the COBOL Connection for more examples of COBOL programming techniques and sample code.

Link to Internet   Link to Server   Explore An Enterprise System Model that describes and demonstrates how Applications that were running on a Mainframe System and non-relational data that was located on the Mainframe System were copied and deployed in a Microsoft Windows environment with Micro Focus Enterprise Server.

Link to Internet   Link to Server   Explore The ASCII and EBCDIC Translation Tables. These tables are provided for individuals that need to better understand the bit structures and differences of the encoding formats.

Link to Internet   Link to Server   Explore The File Status Return Codes that are used to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Internet Access Required

The following links will require an internet connect.

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

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

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

Explore the GnuCOBOL Technologies available from SourceForge. SourceForge is an Open Source community resource dedicated to helping open source projects be as successful as possible. GnuCOBOL (formerly OpenCOBOL) is a COBOL compiler with run time support. The compiler (cobc) translates COBOL source to executable using intermediate C, designated C compiler and linker. This link will require an Internet Connection.

Table of Contents Previous Section Next Section Glossary of Terms

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

Table of Contents Previous Section Next Section Contact or Feedback

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.

Table of Contents Previous Section Next Section Company Overview

SimoTime Technologies was founded in 1987 and is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. Our customers include small businesses using Internet technologies to corporations using very large mainframe systems.

Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. We specialize in preparing applications and the associated data that are currently residing on a single platform to be distributed across a variety of platforms.

Preparing the application programs will require the transfer of source members that will be compiled and deployed on the target platform. The data will need to be transferred between the systems and may need to be converted and validated at various stages within the process. SimoTime has the technology, services and experience to assist in the application and data management tasks involved with doing business in a multi-system environment.

Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com


Return-to-Top
Procedure Pointers and External Data with COBOL
Copyright © 1987-2024
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com