Net Express COBOL
 Environment and Command Line
http://www.simotime.com
  Table of Contents Version 09.05.17 
  Introduction
  The .CMD Member for Execution
  The COBOL Program to Set or Get Environment
  The COBOL Program to Read the File
  Setting the Environment
  Posting Messages, Display on Screen & Write to Log File
  Summary
 
  Software Agreement and Disclaimer
  Downloads and Links to Similar Pages
  Comments or Suggestions
  About SimoTime

Introduction
(Next) (Previous) (Table-of-Contents)

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.

The .CMD Member
(Next) (Previous) (Table-of-Contents)

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

@echo OFF
rem  * *******************************************************************
rem  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2010 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 Enterprises
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  *
     call Env1PROD
     if "%SYSLOG%" == "" set syslog=c:\SimoLIBR\LOGS\SimoTime.LOG
     set CmdName=NxcSysE1
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

The COBOL Program to Set or Get Environment
(Next) (Previous) (Table-of-Contents)

This program (NXCSYS01.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 ENTERPRISES.
      *****************************************************************
      * Copyright (C) 1987-2010 SimoTime Enterprises, LLC.            *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only does not imply publication or    *
      * disclosure.  This software contains confidential information  *
      * and trade secrets of SimoTime Enterprises, LLC. No part of    *
      * this program or publication may be reproduced, transmitted,   *
      * transcribed, stored in a retrieval system, or translated into *
      * any language or computer language, in any form or by any      *
      * means, electronic, mechanical, magnetic, optical, chemical,   *
      * manual or otherwise, without the prior written permission of: *
      *                                                               *
      * 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       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1994/02/27 Simmons, Created program.
      *
      *****************************************************************
      * Source Member: NXCSYSC1.CBL
      * Copy Files:    None
      * Calls to:      NXCSYSC2
      *****************************************************************
       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-2010 '.
           05  C3 pic X(28) value '  SimoTime Enterprises, LLC '.
           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 sample '.
           05  C3 pic X(32) value 'by SimoTime Enterprises, LLC    '.
           05  C4 pic X(04) value '    '.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* NXCSYSC1 '.
           05  C2 pic X(32) value 'Please send comments or suggesti'.
           05  C3 pic X(32) value 'ons to helpdesk@simotime.com    '.
           05  C4 pic X(04) value '    '.

      *****************************************************************
      *    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
           display ENV-VAR-NAME  upon ENVIRONMENT-NAME
                   on exception add 4 to ZERO giving RETURN-CODE
           end-display
           accept  ENV-VAR-VALUE from ENVIRONMENT-VALUE
                   on exception add 4 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 Enterprises         *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

The COBOL Program to Read the File
(Next) (Previous) (Table-of-Contents)

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 ENTERPRISES.
      *****************************************************************
      * Copyright (C) 1994-2003 SimoTime Enterprises, LLC.            *
      *                                                               *
      * All rights reserved.  Unpublished, all rights reserved under  *
      * copyright law and international treaty.  Use of a copyright   *
      * notice is precautionary only does not imply publication or    *
      * disclosure.  This software contains confidential information  *
      * and trade secrets of SimoTime Enterprises, LLC. No part of    *
      * this program or publication may be reproduced, transmitted,   *
      * transcribed, stored in a retrieval system, or translated into *
      * any language or computer language, in any form or by any      *
      * means, electronic, mechanical, magnetic, optical, chemical,   *
      * manual or otherwise, without the prior written permission of: *
      *                                                               *
      * 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       *
      *                                                               *
      *****************************************************************
      *
      *****************************************************************
      *
      * MAINTENANCE
      * -----------
      * 1989/02/27 Simmons, Created program.
      *
      *****************************************************************
      * Source Member: NXCSYSC2.CBL
      * Copy Files:    None
      * Calls to:      None
      *****************************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SYSUT1-FILE  ASSIGN TO       NXCDB080
                  ORGANIZATION IS 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 ' v03.01.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-2010 '.
           05  C3 pic X(28) value '  SimoTime Enterprises, LLC '.
           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 sample '.
           05  C3 pic X(32) value 'by SimoTime Enterprises, LLC    '.
           05  C4 pic X(04) value '    '.

       01  SIM-THANKS-02.
           05  C1 pic X(11) value '* NXCSYSC2 '.
           05  C2 pic X(32) value 'Please send comments or suggesti'.
           05  C3 pic X(32) value 'ons to helpdesk@simotime.com    '.
           05  C4 pic X(04) value '    '.

      *****************************************************************
      *    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  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-CONSOLE-MESSAGE

           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-CONSOLE-MESSAGE
               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-CONSOLE-MESSAGE
                   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-CONSOLE-MESSAGE
               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-CONSOLE-MESSAGE
           end-if
           move 'PROGRAM-IS-ABENDING...'  to MESSAGE-TEXT
           perform Z-DISPLAY-CONSOLE-MESSAGE
           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
               display '* NXCSYSC2 File-Status-' IO-STAT1 '/'
                       TWO-BYTES-BINARY upon console
           else
               display '* NXCSYSC2 File-Status-' IO-STATUS upon console
           end-if
           exit.

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

      *****************************************************************
       Z-DISPLAY-CONSOLE-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 Enterprises         *
      *        Our e-mail address is: helpdesk@simotime.com           *
      *     Also, visit our Web Site at http://www.simotime.com       *
      *****************************************************************

Setting the Environment
(Next) (Previous) (Table-of-Contents)

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.

rem  * *******************************************************************
rem  * Set the commonly used environment variables. This is used to
rem  * provide a single point for managing the commonly used environment
rem  * variables.
rem  *
     set BaseLib1=c:\SimoSAM1
     set syslog=%BaseLib1%\LOGS\SpoolSysLog.TXT
     set SimoNOTE=%BaseLib1%\LOGS\SimoNoteLog01.TXT
     call SimoNOTE "Starting JobName Env1PROD.CMD"
rem  *
     set sysout=%BaseLib1%\LOGS\ApplSysOut.TXT
     set CobCpy=%BaseLib1%\CobCpy1;c:\SimoLIBR
rem  *
rem  * set MFTRACE_CONFIG=c:\SimoSAM1\LOGS\TRACE001\ctfrtsfs.cfg
rem  * set MFTRACE_LOGS=c:\SimoSAM1\LOGS\TRACE001
rem  *
rem  * The following SORTSPACE of 1 gigabyte is used when sorting very large files.
rem  * The value is the digit one (1) followed by nine (9) zeroes. To allocate this
rem  * amount of memory for sorting will require a minimum of two (2) gigabytes of RAM.
rem  set SORTSPACE=1000000000
rem  *
rem  * Set environment for MFBSI (Micro Focus Batch Scheduling Interface)
     set ES_EMP_EXIT_1=mfbsiemx
     set MFBSI_DIR=%BaseLib1%\BSIA\SimoBatA
     set MFBSIEOP_CMD=ENABLE
     set MFBSIEOP_CSV=ENABLE
rem  *
rem  * The following is used to map the location of files that are allocated using JCL
rem  * with ES/MTO.
     set ES_ALLOC_OVERRIDE=%BaseLib1%\SysLibA1\CatMapA1.cfg
rem  *
rem  * Set the environment for Core Dump on System error, CBLCORE file
rem  set COBCONFIG_=%BaseLib1%\SysLibA1\Diagnose.CFG
rem  *
rem  * Specify the location of the IDY files when animating
     set COBIDY=%BaseLib1%\COBOL
rem  *
rem  * The following may need to be adjusted based on individual systems and the
rem  * various versions of the Operating System, Sub-Systems and other software.
     if "%ENV1PROD%" == "Y" goto :NOPATH
     set iexplore=C:\Program Files\Internet Explorer
     set path="C:\Program Files\Micro Focus\Net Express 5.0\Base\";"C:\Program Files\Micro Focus\Net Express 5.0\Base\bin";%PATH%;
rem  set path="C:\Program Files\Micro Focus\Server 5.0\Base\";"C:\Program Files\Micro Focus\Server 5.0\Base\bin";%PATH%;
:NOPATH
     set cobpath=%BaseLib1%\ProdLibA;%BaseLib1%\ProdLibA\UTIL
     set JobStatus=0000
     set StepStatus=0000
     set ENV1PROD=Y
     call SimoNOTE "Finished JobName Env1PROD.CMD"

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

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  *                   This program is provided by:                    *
rem  *                    SimoTime Enterprises, LLC                      *
rem  *           (C) Copyright 1987-2010 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

Summary
(Next) (Previous) (Table-of-Contents)

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.

Software Agreement and Disclaimer
(Next) (Previous) (Table-of-Contents)

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.

Permission to use, copy, modify and distribute this software for a 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.

SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express 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.

Downloads and Links to Similar Pages
(Next) (Previous) (Table-of-Contents)

You may download this example at http://www.simotime.com/sim4dzip.htm#CobolEnvVarCmdFileName as a Z-Pack. The 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.

Please view the complete list of SimoTime Z-Pack Examples at http://www.simotime.com/sim4dzip.htm.

Note: You must be attached to the Internet to download a Z-Pack or view the list.

The SimoZAPS Utility Program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.

Check out   The COBOL Connection  for more examples of mainframe COBOL coding techniques and sample code.

Check out   The SimoTime Library  for a wide range of topics for Programmers, Project Managers and Software Developers.

To review all the information available on this site start at   The SimoTime Home Page .

Comments or Suggestions
(Next) (Previous) (Table-of-Contents)

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

About SimoTime Enterprises
(Next) (Previous) (Table-of-Contents)

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
Copyright © 1987-2010  SimoTime Enterprises  All Rights Reserved
When technology complements business
http://www.simotime.com