Procedure Pointers and External Data
 COBOL Examples
When technology complements business    Copyright © 1987-2013  SimoTime Enterprises  All Rights Reserved
  Table of Contents Version 12.11.21 
  Introduction
  Procedure Pointer
  External Data
  Standard CALL, Program Name & LINKAGE Section
  Standard CALL, Primary COBOL Program
  Standard CALL, Secondary COBOL Program, an I/O Module
  Standard CALL, Copy File for Working Storage Definitions
  Standard CALL, the JCL Member
  Standard CALL, the Command File
  Procedure Pointer & External Data Items
  Procedure Pointer, Primary COBOL Program
  Procedure Pointer, Secondary COBOL Program, an I/O Module
  Procedure Pointer, Copy File for Working Storage Definitions
  Procedure Pointer, the JCL Member
  Procedure Pointer, the Command File
  Setting the Environment
  Posting Messages, Display on Screen & Write to Log File
  Summary
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Downloads and Links, Internet Access Required
  Glossary of Terms
  Comments, Suggestions 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 memebrs are uploaded to a ZOS Mainframe from the Windows and Micro Focus environment the file extensions are dropped.

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 Standard CALL, Program Name & LINKAGE Section

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 Standard CALL, 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 ENTERPRISES.
      *****************************************************************
      * Copyright (C) 1987-2013 SimoTime Enterprises.                 *
      *                                                               *
      * 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    *
      * Enterprises.                                                  *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Enterprises. 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           *
      * Enterprises.                                                  *
      *                                                               *
      * SimoTime Enterprises 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       *
      * Enterprises shall not be liable for any direct, indirect,     *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Enterprises                                          *
      * 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 Enterprises,  *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Enterprises         *
      *        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-2013 '.
           05  C3 pic X(28) value '--- SimoTime Enterprises ---'.
           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 softwar'.
           05  C3 pic X(32) value 'e provided from SimoTime Enterpr'.
           05  C4 pic X(04) value 'ises'.

       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 Enterprises         *
      *        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 Standard CALL, Secondary COBOL Program, 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 ENTERPRISES.
      *****************************************************************
      *             A product of SimoTime Enterprises                 *
      *        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 Enterprises                 *
      *        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 Standard CALL, Copy File for 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-2013 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
       01  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 Standard CALL, the 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 Enterprises        *
//*           (C) Copyright 1987-2013 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   -   Standard Call with a Linkage Section.
//* Author -   SimoTime Enterprises
//* 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, 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, 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 Standard CALL, the Command 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 Enterprises          *
rem  *           (C) Copyright 1987-2013 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 Procedure Pointer & External Data Items

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 Procedure Pointer, 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 ENTERPRISES.
      *****************************************************************
      * Copyright (C) 1987-2013 SimoTime Enterprises.                 *
      *                                                               *
      * 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    *
      * Enterprises.                                                  *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Enterprises. 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           *
      * Enterprises.                                                  *
      *                                                               *
      * SimoTime Enterprises 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       *
      * Enterprises shall not be liable for any direct, indirect,     *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Enterprises                                          *
      * 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 Enterprises,  *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Enterprises         *
      *        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-2013 '.
           05  C3 pic X(28) value '--- SimoTime Enterprises ---'.
           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 softwar'.
           05  C3 pic X(32) value 'e provided from SimoTime Enterpr'.
           05  C4 pic X(04) value 'ises'.

       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 Enterprises         *
      *        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 Procedure Pointer, Secondary COBOL Program, 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 ENTERPRISES.
      *****************************************************************
      *           This program was generated by SimoZAPS              *
      *             A product of SimoTime Enterprises                 *
      *        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 Enterprises                 *
      *        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 Procedure Pointer, Copy File for 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-2013 SimoTime Enterprises          *
      *                     All Rights Reserved                       *
      *              Provided by SimoTime Enterprises                 *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
       01  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 Procedure Pointer, the 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 Enterprises        *
//*           (C) Copyright 1987-2013 All Rights Reserved             *
//*             Web Site URL:   http://www.simotime.com               *
//*                   e-mail:   helpdesk@simotime.com                 *
//* *******************************************************************
//*
//* Text   -   Procedure Pointer with External Data Items.
//* Author -   SimoTime Enterprises
//* 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, 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, 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 Procedure Pointer, the Command 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 Enterprises          *
rem  *           (C) Copyright 1987-2013 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 Setting the Environment

The following (Env1PROD.CMD) is a Windows Command file that is used to set the commonly used environment variables. This command file is used by many of the examples provided by SimoTime. It provides a single point of configuration for commonly used environment settings.

@echo OFF
rem  * *******************************************************************
rem  *               ENV1BASE.CMD - a Windows Command File               *
rem  *        This program is provided by SimoTime Enterprises           *
rem  *           (C) Copyright 1987-2013 All Rights Reserved             *
rem  *             Web Site URL:   http://www.simotime.com               *
rem  *                   e-mail:   helpdesk@simotime.com                 *
rem  * *******************************************************************
rem  *
rem  * Text   - Provide a single point to set common environment variables.
rem  * Author - SimoTime Enterprises
rem  * Date   - January 24, 1996
rem  *
rem  * Set the commonly used environment variables. This is used to provide
rem  * a single point for managing the commonly used environment variables.
rem  *
     set SimoLIBR=c:\SimoLIBR
     set BaseLib1=c:\SimoSAM1\DEVL
     set BaseLib8=c:\SimoSAM8
     set DATAZERO=c:\SIMODATA\DEVL\DATA\ZERO
     set BASEAPP=%BaseLib1%
     set BASESYS=%BaseLib1%\SYS1
     set BASECAT=%BaseLib1%\DATA
     set SYSLOG=%BASESYS%\LOGS\SYSLOG_USER.DAT
     set SYSOUT=%BASEAPP%\LOGS\SYSOUT_SIMSAM01.TXT
     set SLZMSG=%BASEAPP%\LOGS\SLZMSG_USER.TXT
     set PostNOTE=%BASEAPP%\LOGS\SYSOUT_SIMONOTE.TXT
     set SimoNOTE=%BASEAPP%\LOGS\SYSOUT_SIMONOTE.TXT
     set MIFOEDEV="C:\Program Files (x86)\Micro Focus\Enterprise Developer"
     set MIFOBASE="C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0\Base"
     set MIFOBIN=%MIFOBASE%\bin
rem  *
     set MAINFRAME_FLOATING_POINT=true
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE
     set COBIDY=%BASEAPP%\COBIDY
rem  * Large file support, performance tuning and record locking of the File Handler
     set EXTFH=%BASESYS%\CONFIG\EXTFHBIG.CFG
rem  * For IMS Support
     set ES_IMSLIB=%BASEAPP%\IMSLIB
     set ES_ACBLIB=%BASEAPP%\IMSLIB
rem  * Resource Allocation and Performance for SORT and non-Relational Data
     set SORTSCHEME=1
     set SORTSPACE=500000000
     set TMP=D:\SORTWORK
     set ES_ALLOC_OVERRIDE=%BASESYS%\CONFIG\CATMAPA1.cfg
rem  * For CORE_ON_ERROR function, ABEND Dump
     set COBCONFIG_=%BASESYS%\CONFIG\diagnose.cfg
rem  * For Job Restart, ABEND Recovery
     set MF_UCC11=Y
     set ES_JES_RESTART=Y
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  * Set Behavior and Trace Flags for GETJOBDD
rem  *   Position=12345678/12345678
     set JDDFLAGS=nnnWnnnn/nnnnnnnn
rem  *
     if "%SIMOPATH%" == "Y" goto JUMPPATH
     set path=%MIFOBASE%;%MIFOBIN%;%PATH%;
     set COBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;%SimoLIBR%
     set LIBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;%SimoLIBR%
     set TXDIR=%BASESYS%\LOADLIB;%MIFOBASE%
:JUMPPATH
     set SIMOPATH=Y
     set JobStatus=0000
     call SimoNOTE "* Settings CmdName Env1BASE.CMD, Version 13.01.09"
     call SimoNOTE "* BaseAPP is %BASEAPP%"
     call SimoNOTE "* MFBSIDIR is %MFBSI_DIR% "

Table of Contents Previous Section Next Section Posting Messages, Display on Screen & Write to Log File

The following (SimoNOTE.CMD) is a Windows Command file that is used to display messages on the screen and write messages to a log file. This command file is used by many of the examples provided by SimoTime. It provides a consistent method for displaying and logging messages when called from other command files.

@echo OFF
rem  * *******************************************************************
rem  *               SIMONOTE.CMD - a Windows Command File               *
rem  *         This program is provided by SimoTime Enterprises          *
rem  *            (C) Copyright 1987-2013 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 Enterprises
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 document may bu 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.

The purpose of this suite of programs is as follows.

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 calling COBOL programs will build an 80-byte data record that will be passed to the called programs that will write the record to a sequential file.

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 Enterprises. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.

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

Table of Contents Previous Section Next Section Downloads and Links to Similar Pages

This section includes links to documents with additional information that are beyond the scope and purpose of this document.

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 to interpret the results of accessing VSAM data sets and/or QSAM files.

Table of Contents Previous Section Next Section Downloads and Links, 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 via Internet Connect for access to white papers, program examples and product information.

Explore The Micro Focus Web Site via Internet Connect for more information about products and services available from Micro Focus.

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 Comments, Suggestions or Feedback

This document was created and is copyrighted and maintained by SimoTime Enterprises.

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

We appreciate hearing from you.

Table of Contents Previous Section Next Section Company Overview

Founded in 1987, SimoTime Enterprises 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. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems.

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


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