Net Express COBOL
Environment and Command Line
  Table of Contents  v-14.09.08 - nxcsys01.htm 
  Introduction
  The .CMD Member
  The COBOL Programs
  Set or Get Environment
  Read the File
  Ancillary Functions
  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
  Comments or Feedback
  Company Overview

Table of Contents Previous Section Next Section Introduction

This is an example of how a COBOL program can access (i.e. Get or Set) environment variables using Micro Focus Net Express. The first sample program starts by setting an environment variable for a file name. The program then gets the environment variable and displays the environment value on the screen. Next the program calls a second program that does file I/O. Since the second program is compiled with the assign(EXTERNAL) and SEQUENTIAL(LINE) directives the second program will read the ASCII/Text file specified in the environment value that was set in the first program.

Note: This module is part of The SIMOPATH Series of training and reference materials. For more information refer to The Home Page for The SIMOPATH Series.


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-2019
SimoTime Technologies and Services
All Rights Reserved

Table of Contents Previous Section Next Section The .CMD Member

The following is the batch file (NXCSYSE1.cmd) that is required to run the job from a Net Express command line on a Windows System.

@echo OFF
rem  * *******************************************************************
rem  *               NXCSYSE1.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   - Map File Name via Micro Focus Functions.
rem  * Author - SimoTime Technologies
rem  * Date   - January 24, 1996
rem  *
rem  * The process will execute the first of two COBOL programs. The
rem  * first COBOL program will get a parameter from the command line
rem  * and then use the parameter to set an environment variable.
rem  * The first COBOL program will then call a second COBOL program
rem  * that will use the environment variable to map the COBOL file
rem  * name to a fully qualified PC file name. The file will then be
rem  * read and the records displayed to the screen.
rem  *
rem  * *******************************************************************
rem  *
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
     set CmdName=NxcSysE1
     call ..\Env1BASE %CmdName%
rem  *
     call SimoNOTE "*******************************************************%CmdName%"
     call SimoNOTE "Starting JobName %CmdName%"
rem  *
rem  * Step 1, Create a New Test File...
     set TestFile=%BaseLib1%\DataLibA\Txt1\NXCDB080.TXT
     if exist %TestFile% del %TestFile%
rem  *
     call SimoNOTE "%CmdName% Create the ASCII/Text File..."
     echo This is Record-001... >  %TestFile%
     echo This is Record-002... >> %TestFile%
     echo This is Record-003... >> %TestFile%
     echo This is Record-004... >> %TestFile%
     echo This is Record-005... >> %TestFile%
rem  *
rem  * *******************************************************************
rem  * Step 2, Pass File name via Command Line Parameter
rem  *
     run  NXCSYSC1 %TestFile%
     if not ERRORLEVEL = 0 set JobStatus=0001
     if not %JobStatus% == 0000 goto :EojNok
rem  *
:EojAok
     call SimoNOTE "Finished JobName %CmdName%, Job Status is %JobStatus%"
     goto :End
:EojNok
     call SimoNOTE "ABENDING JobName %CmdName%, Job Status is %JobStatus%"
:End
     call SimoNOTE "Conclude SysLog is %SYSLOG%"
     if not "%1" == "nopause" pause

Table of Contents Previous Section Next Section The COBOL Programs

This set of programs contains two COBOL programs that describe and demonstrate how to access environment variables and map a program file name to a physical file name.

Table of Contents Previous Section Next Section Set or Get Environment

This program (NXCSYSC1.cbl) was written, compiled and tested on Windows/2000 using Micro Focus Net Express. This program will only set an environment variable for the COBOL Runtime Environment. This program will set an environment variable for a file name and then call a second COBOL program to read the file.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NXCSYSC1.
      *AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2018 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, provided the SimoTime copyright notice appear on all *
      * copies of the software. The SimoTime name or Logo may not be  *
      * used in any advertising or publicity pertaining to the use    *
      * of the software without the written permission of SimoTime    *
      * Technologies.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies shall not be liable for any direct, indirect,    *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      * MAINTENANCE
      * -----------
      * 1994/02/27 Simmons, Created program.
      *
      *****************************************************************
      * Source Member: NXCSYSC1.CBL
      * Copy Files:    None
      * Calls to:      NXCSYSC2
      *****************************************************************
      * This program will get the parameters from the command line,
      * set an environment variable based on the command line parameter
      * and then call a second COBOL program.
      *
       ENVIRONMENT DIVISION.
      *CONFIGURATION SECTION.
      *SPECIAL-NAMES.
      *    ENVIRONMENT-VALUE
      *    ENVIRONMENT-NAME.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* NXCSYSC1 '.
           05  T2 pic X(34) value 'Net Express, CMD and ENV Step-01  '.
           05  T3 pic X(10) value ' v03.01.24'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* NXCSYSC1 '.
           05  C2 pic X(20) value 'Copyright 1987-2018 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* NXCSYSC1 '.
           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 '* NXCSYSC1 '.
           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'.

      *****************************************************************
      *    Buffer used for posting messages to the console.
      *    ------------------------------------------------------------
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* NXCSYSC1 '.
           05  MESSAGE-TEXT        pic X(68).

      *****************************************************************
      *    Data-structure for environment variable get routine...
      *    ------------------------------------------------------------
       01  ENV-VAR-NAME            pic X(16)   value SPACES.
       01  ENV-VAR-VALUE           pic X(256)  value SPACES.

       01  PROGRAM-COMMAND-LINE    pic x(256)  value SPACES.

      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT

      *>   Get the Command Line information...
           accept PROGRAM-COMMAND-LINE from COMMAND-LINE.

      *>   Set an Environment Variable...
           move 'Set an Environment Variable...' to MESSAGE-TEXT
           perform Z-POST-MESSAGE
      *
           move SPACES      to ENV-VAR-NAME
           move 'NXCDB080'  to ENV-VAR-NAME

           move PROGRAM-COMMAND-LINE to ENV-VAR-VALUE
           perform SET-ENVIRONMENT-VARIABLE
           if  RETURN-CODE = 0
               move ENV-VAR-VALUE to MESSAGE-TEXT
               perform Z-POST-MESSAGE
           else
               move 'SET-ENV Failed...' to MESSAGE-TEXT
               perform Z-POST-MESSAGE
           end-if

      *>   Get an Environment Variable...
           move 'Get an Environment Variable...' to MESSAGE-TEXT
           perform Z-POST-MESSAGE

           move SPACES      to ENV-VAR-NAME
           move 'NXCDB080'  to ENV-VAR-NAME
           perform GET-ENVIRONMENT-VARIABLE
           if  RETURN-CODE = 0
           and ENV-VAR-VALUE not = SPACES
               move ENV-VAR-VALUE to MESSAGE-TEXT
               perform Z-POST-MESSAGE
           else
               move 'GET-ENV Failed...' to MESSAGE-TEXT
               perform Z-POST-MESSAGE
           end-if

           call 'NXCSYSC2'

           perform Z-THANK-YOU.

           GOBACK.

      *****************************************************************
      * Get an environment variable.
      *----------------------------.
       GET-ENVIRONMENT-VARIABLE.
           move SPACES to ENV-VAR-VALUE
           accept  ENV-VAR-VALUE from ENVIRONMENT ENV-VAR-NAME
                   on exception add 8 to ZERO giving RETURN-CODE
           end-accept
           if  RETURN-CODE not = 0
               move SPACES to ENV-VAR-VALUE
           end-if
           exit.

      *****************************************************************
      * Set an environment variable.
      *----------------------------.
       SET-ENVIRONMENT-VARIABLE.
           display ENV-VAR-NAME  upon ENVIRONMENT-NAME
                   on exception add 4 to ZERO giving RETURN-CODE
           end-display
           display ENV-VAR-VALUE upon ENVIRONMENT-VALUE
                   on exception add 4 to ZERO giving RETURN-CODE
           end-display
           exit.

      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * for this program.                                             *
      *****************************************************************

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

      *****************************************************************
       Z-POST-MESSAGE.
           display MESSAGE-BUFFER upon console
           move SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01 upon console
           display SIM-THANKS-02 upon console
           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 Read the File

This program (NXCSYSC2.cbl) was originally written to run on an IBM Mainframe running MVS. This program was downloaded, compiled and tested on Windows/2000 using Micro Focus Net Express. The file name was mapped to a fully qualified MVS file name using JCL. This program has not been modified, it was downloaded from the mainframe then compiled and executed using Net Express from Micro Focus.

       IDENTIFICATION DIVISION.
       PROGRAM-ID.    NXCSYSC2.
       AUTHOR.        SIMOTIME TECHNOLOGIES.
      *****************************************************************
      * Copyright (C) 1987-2018 SimoTime Technologies.                *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only and does not imply publication   *
      * or disclosure.                                                *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any non-commercial purpose and without fee is hereby      *
      * granted, provided the SimoTime copyright notice appear on all *
      * copies of the software. The SimoTime name or Logo may not be  *
      * used in any advertising or publicity pertaining to the use    *
      * of the software without the written permission of SimoTime    *
      * Technologies.                                                 *
      *                                                               *
      * Permission to use, copy, modify and distribute this software  *
      * for any commercial purpose requires a fee to be paid to       *
      * SimoTime Technologies. Once the fee is received by SimoTime   *
      * the latest version of the software will be delivered and a    *
      * license will be granted for use within an enterprise,         *
      * provided the SimoTime copyright notice appear on all copies   *
      * of the software. The SimoTime name or Logo may not be used    *
      * in any advertising or publicity pertaining to the use of the  *
      * software without the written permission of SimoTime           *
      * Technologies.                                                 *
      *                                                               *
      * SimoTime Technologies makes no warranty or representations    *
      * about the suitability of the software for any purpose. It is  *
      * provided "AS IS" without any expressed or implied warranty,   *
      * including the implied warranties of merchantability, fitness  *
      * for a particular purpose and non-infringement. SimoTime       *
      * Technologies shall not be liable for any direct, indirect,    *
      * special or consequential damages resulting from the loss of   *
      * use, data or projects, whether in an action of contract or    *
      * tort, arising out of or in connection with the use or         *
      * performance of this software                                  *
      *                                                               *
      * SimoTime Technologies                                         *
      * 15 Carnoustie Drive                                           *
      * Novato, CA 94949-5849                                         *
      * 415.883.6565                                                  *
      *                                                               *
      * RESTRICTED RIGHTS LEGEND                                      *
      * Use, duplication, or disclosure by the Government is subject  *
      * to restrictions as set forth in subparagraph (c)(1)(ii) of    *
      * the Rights in Technical Data and Computer Software clause at  *
      * DFARS 52.227-7013 or subparagraphs (c)(1) and (2) of          *
      * Commercial  Computer Software - Restricted Rights  at 48      *
      * CFR 52.227-19, as applicable.  Contact SimoTime Technologies, *
      * 15 Carnoustie Drive, Novato, CA 94949-5849.                   *
      *                                                               *
      *****************************************************************
      *      This program is provided by SimoTime Technologies        *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1989/02/27 Simmons, Created program.
      *
      *****************************************************************
      * Source Member: NXCSYSC2.CBL
      * Copy Files:    None
      * Calls to:      None
      *****************************************************************
      * This program will use an environment variable to map the file
      * name on the SELECT statement to a fully qualified PC file name.
      * To do this mapping this program must be compiled with the
      * assign(EXTERNAL) directive.
      * The program will read the file and display the records to the
      * screen. If this program is compiled with the sequential(LINE)
      * directive then the input file may be an ASCII/Text file.
      *
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SYSUT1-FILE  ASSIGN TO       NXCDB080
                  ORGANIZATION IS LINE SEQUENTIAL
                  ACCESS MODE  IS SEQUENTIAL
                  FILE STATUS  IS SYSUT1-STATUS.

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

       WORKING-STORAGE SECTION.
      *****************************************************************
      *    Data-structure for Title and Copyright...
      *    ------------------------------------------------------------
       01  SIM-TITLE.
           05  T1 pic X(11) value '* NXCSYSC2 '.
           05  T2 pic X(34) value 'Sequential File Processing        '.
           05  T3 pic X(10) value ' v08.02.24'.
           05  T4 pic X(24) value ' http://www.simotime.com'.
       01  SIM-COPYRIGHT.
           05  C1 pic X(11) value '* NXCSYSC2 '.
           05  C2 pic X(20) value 'Copyright 1987-2018 '.
           05  C3 pic X(28) value '   SimoTime Technologies    '.
           05  C4 pic X(20) value ' All Rights Reserved'.

       01  SIM-THANKS-01.
           05  C1 pic X(11) value '* NXCSYSC2 '.
           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 '* NXCSYSC2 '.
           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'.

      *****************************************************************
      *    Buffer used for posting messages to the console.
      *    ------------------------------------------------------------
       01  MESSAGE-BUFFER.
           05  MESSAGE-HEADER      pic X(11)   value '* NXCSYSC2 '.
           05  MESSAGE-TEXT        pic X(68).

      *****************************************************************
      *    Data-structure for environment variable get routine...
      *    ------------------------------------------------------------
       01  ENV-VAR-NAME            pic X(16)   value SPACES.
       01  ENV-VAR-VALUE           pic X(256)  value SPACES.

       01  SYSUT1-STATUS.
           05  SYSUT1-STATUS-L     pic X.
           05  SYSUT1-STATUS-R     pic X.
       01  SYSUT1-EOF              pic X       value 'N'.
       01  SYSUT1-OPEN-FLAG        pic X       value 'C'.

       01  IO-STATUS.
           05  IO-STAT1            pic X.
           05  IO-STAT2            pic X.
       01  TWO-BYTES.
           05  TWO-BYTES-LEFT      pic X.
           05  TWO-BYTES-RIGHT     pic X.
       01  TWO-BYTES-BINARY        redefines TWO-BYTES pic 9(4) comp.
       01  THREE-BYTE-VALUE        pic 9(3)    value 0.

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

      *****************************************************************
       PROCEDURE DIVISION.
           perform Z-POST-COPYRIGHT

           perform SYSUT1-OPEN

           perform until SYSUT1-STATUS not = '00'
               perform SYSUT1-READ
               if  SYSUT1-STATUS = '00'
                   display SYSUT1-RECORD upon console
               end-if
           end-perform

           if  APPL-EOF
               move 'is Complete...' to MESSAGE-TEXT
           else
               move 'is ABENDING...' to MESSAGE-TEXT
           end-if
           perform Z-DISPLAY-MESSAGE-TEXT

           perform SYSUT1-CLOSE
           perform Z-THANK-YOU.
           GOBACK.

      *****************************************************************
      * I/O ROUTINES FOR SYSUT1...                                    *
      *****************************************************************
       SYSUT1-CLOSE.
           add 8 to ZERO giving APPL-RESULT.
           close SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT1-Failure-CLOSE...' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SYSUT1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT1-READ.
           read SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
           else
               if  SYSUT1-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
               if  APPL-EOF
                   move 'Y' to SYSUT1-EOF
               else
                   move 'SYSUT1-Failure-GET...' to MESSAGE-TEXT
                   perform Z-DISPLAY-MESSAGE-TEXT
                   move SYSUT1-STATUS to IO-STATUS
                   perform Z-DISPLAY-IO-STATUS
                   perform Z-ABEND-PROGRAM
               end-if
           end-if
           exit.
      *---------------------------------------------------------------*
       SYSUT1-OPEN.
           add 8 to ZERO giving APPL-RESULT.
           open input SYSUT1-FILE
           if  SYSUT1-STATUS = '00'
               subtract APPL-RESULT from APPL-RESULT
               move 'O' to SYSUT1-OPEN-FLAG
           else
               add 12 to ZERO giving APPL-RESULT
           end-if
           if  APPL-AOK
               CONTINUE
           else
               move 'SYSUT1-Failure-OPEN...' to MESSAGE-TEXT
               perform Z-DISPLAY-MESSAGE-TEXT
               move SYSUT1-STATUS to IO-STATUS
               perform Z-DISPLAY-IO-STATUS
               perform Z-ABEND-PROGRAM
           end-if
           exit.

      *****************************************************************
      * The following Z-Routines perform administrative tasks         *
      * 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 the file status bytes. This routine will display as   *
      * two digits if the full two byte file status is numeric. If    *
      * second byte is non-numeric then it will be treated as a       *
      * binary number.                                                *
      *****************************************************************
       Z-DISPLAY-IO-STATUS.
           if  IO-STATUS not NUMERIC
           or  IO-STAT1 = '9'
               subtract TWO-BYTES-BINARY from TWO-BYTES-BINARY
               move IO-STAT2 to TWO-BYTES-RIGHT
               add TWO-BYTES-BINARY to ZERO giving THREE-BYTE-VALUE
               move 'File Status is: nnnn' to MESSAGE-TEXT
               move IO-STAT1 to MESSAGE-TEXT(17:1)
               move THREE-BYTE-VALUE to MESSAGE-TEXT(18:3)
               perform Z-DISPLAY-MESSAGE-TEXT
           else
               move 'File Status is: 00nn' to MESSAGE-TEXT
               move IO-STATUS to MESSAGE-TEXT(19:2)
               perform Z-DISPLAY-MESSAGE-TEXT
           end-if
           exit.

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

      *****************************************************************
       Z-DISPLAY-MESSAGE-TEXT.
           display MESSAGE-BUFFER upon console
           move SPACES to MESSAGE-TEXT
           exit.

      *****************************************************************
       Z-THANK-YOU.
           display SIM-THANKS-01 upon console
           display SIM-THANKS-02 upon console
           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 Ancillary Functions

This section provides technical detail about the supporting scripts and programs used or called by the primary jobs.

Table of Contents Previous Section Next Section Set the Environment

A command file (ENV1BASE.cmd located in the base directory (SIMOSAM1 for this example) and 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-2019 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
     call SIMONOTE "* SIMONOTE Job Log File is %SIMONOTE% "
rem  *
     set MQBASE=C:\Program Files\IBM\WebSphere MQ
rem  *
rem  * Set the location for the Apache-Tomcat Server...
     set CATALINA_HOME=C:\APACHETC\apache-tomcat-7.0.52
rem  *
rem  * Set the Environment for the Java Environment...
     set JAVABASE=C:\Program Files (x86)\Java\jdk1.8.0_112
     set JAVASDK="%JAVABASE%\bin"
     set JAVA_HOME=%JAVABASE%
     set JRE_HOME=%JAVABASE%
rem  *
rem  * Set the environment for the Micro Focus technology...
     set MIFOEDEV=C:\Program Files (x86)\Micro Focus\Enterprise Developer
     set MIFOVCBL=C:\Program Files (x86)\Micro Focus\Visual COBOL
     set MIFOESTU=C:\Program Files (x86)\Micro Focus\Studio Enterprise Edition 6.0
     set MIFOEMFE="C:\Program Files (x86)\Micro Focus\Mainframe Express"
rem  *
rem  * Large file support, performance tuning and record locking of the File Handler
     set EXTFH=%BASESYS%\CONFIG\EXTFHBIG.CFG
rem  *
rem  * For IMS Support
     set ES_IMSLIB=%BASEAPP%\IMSLIB
     set ES_ACBLIB=%BASEAPP%\IMSLIB
rem  *
rem  * EZASOKETS Check EZASOKETS Enabled box or set ES_EZASOKET_SUPPORT=YES
     set EZACONFG=BASESYS1\CONFIG\EZACONFG.dat
rem  *
rem  * Resource Allocation and Performance for SORT and non-Relational Data
rem  set MFJSENGINE=SYNCSORT
     set SORTSCHEME=1
     set SORTSPACE=750000000
     set TMP=C:\SORTWORK
rem  *
     set ES_ALLOC_OVERRIDE=%BASESYS%\CONFIG\CATMAPA1.cfg
rem  * For CORE_ON_ERROR function, ABEND Dump
rem  *     set COBCONFIG_=%BASESYS%\CONFIG\diagnose.cfg
rem  *
rem  * Consolidated Trace Facility (CTF)
rem  *     set MFTRACE_CONFIG=%BASESYS%\CONFIG\ctf.cfg
rem  *     set MFTRACE_LOGS=c:\ctflogs
rem  *
rem  * For Job Restart, ABEND Recovery
     set MF_UCC11=Y
     set ES_JES_RESTART=Y
rem  *
rem  * Set environment for MFBSI (Micro Focus Batch Scheduling Interface)
     set ES_EMP_EXIT_1=mfbsiemx
     set MFBSI_DIR=%BASESYS%\LOGS\%JESSERVERNAME%
     set MFBSIEOP_CMD=ENABLE
     set MFBSIEOP_CSV=ENABLE
     set MFBSIEOP_HTM=ENABLE
     set MFBSIEOP_XML=ENABLE
rem  *
rem  * Set Behavior and Trace Flags for GETJOBDD
rem  *   Position=12345678/12345678
     set JDDFLAGS=nnnWnnnn/YYnnnnnn
rem  *
     set MAINFRAME_FLOATING_POINT=true
     set COBIDY=%BASEAPP%\COBIDY
     set COBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;%SimoLIBR%
     set LIBPATH=.;%BASEAPP%\LOADLIB;%BASESYS%\LOADLIB;%SimoLIBR%
     set TXDIR=%BASESYS%\LOADLIB;%MIFOBASE%
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%
rem  *
rem  * If not already set then set the PATH for Micro Focus Directories
     if "%SIMOPATH%" == "Y" goto JUMPPATH
     if "%MIFOSYS1%" == "EDEV" goto JUMPEDEV
     if "%MIFOSYS1%" == "VCBL" goto JUMPVCBL
     if "%MIFOSYS1%" == "ESTU" goto JUMPESTU
     if "%MIFOSYS1%" == "EMFE" goto JUMPEMFE
:JUMPEDEV
     set path=%BASESYS%\LOADLIB;%MIFOEDEV%\bin;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOEDEV%\CPYLIB
     set MIFOBASE=%MIFOEDEV%
     goto JUMPPATH
:JUMPVCBL
     set path=%MIFOVCBL%\bin;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set MIFOBASE=%MIFOVCBL%
     goto JUMPPATH
:JUMPESTU
     set MIFOBASE=%MIFOESTU%\Base
     set MIFOBIN=%MIFOBASE%\bin
     set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE
     goto JUMPPATH
:JUMPEMFE
     set MIFOBASE=%MIFOEMFE%\Base
     set MIFOBIN=%MIFOBASE%\bin
     set path=%BASESYS%\LOADLIB;%MIFOBASE%;%MIFOBIN%;%JAVASDK%;%BASEAPP%\JAVA;%PATH%;
     set CobCpy=%BASEAPP%\CobCpy1;%BASEAPP%\CobCpy2;%BASEAPP%\CobCpy6;%SimoLIBR%;%MIFOBASE%\SOURCE
     goto JUMPPATH
rem  *
:JUMPPATH
     set SIMOPATH=Y
rem  *
     set USERCLASS=%BASELIB1%\LOADLIB
     set CLASSPATH=.
     set CLASSPATH=%CLASSPATH%;%JAVABASE%
     set CLASSPATH=%CLASSPATH%;%JAVABASE%\lib
     set CLASSPATH=%CLASSPATH%;\%USERCLASS%\simpacks
     set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes
     set CLASSPATH=%CLASSPATH%;C:\APACHETC\apache-tomcat-7.0.52\webapps\simotcat\WEB-INF\classes\simpacks
     if "%MIFOSYS1%" == "ESTU" set CLASSPATH=%CLASSPATH%;%MIFOBIN%
     if "%MIFOSYS1%" == "EDEV" set CLASSPATH=%CLASSPATH%;%MIFOEDEV%
     if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL%
     if "%MIFOSYS1%" == "VCBL" set CLASSPATH=%CLASSPATH%;%MIFOVCBL%\mfcobol.jar
rem  *
     set JobStatus=0000
     call SimoNOTE "* Settings CmdName ENV1BASE.cmd, Version 18.09.15, %MIFOSYS1%"
     call SimoNOTE "* BaseAPP ..... %BASEAPP%"
rem *      call SimoNOTE "* MFBSIDIR .... %MFBSI_DIR% "
     call SimoNOTE "* MIFOSYS1 is %MIFOSYS1% "
     call SimoNOTE "* MIFOBASE is %MIFOBASE% "
     call SimoNOTE "* SIMOLIBR is %SIMOLIBR% "

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. The command is used to provide a consistent process for logging and displaying messages.

@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

The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers. In the world of programming there are many ways to solve a problem. This is an example of how a COBOL program can access (i.e. Get or Set) environment variables using Micro Focus Net Express.

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 SIMOPATH Series starting at the home page to view information about training sessions and learning materials available from SimoTime Enterprises.

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 COBOL Connection for more examples of COBOL programming techniques and sample code.

Link to Internet   Link to Server   Explore an Extended List of Software Technologies that are available for review and evaluation. The software technologies (or Z-Packs) provide individual programming examples, documentation and test data files in a single package. The Z-Packs are usually in zip format to reduce the amount of time to download.

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 Internet Access Required

The following links will require an internet connection.

This suite of programs and documentation is available for download. 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 and services available from Micro Focus. This link requires 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 Comments 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
Environment Variable and Command Line Access from COBOL
Copyright © 1987-2019
SimoTime Technologies and Services
All Rights Reserved
When technology complements business
http://www.simotime.com