Problem:
How do I receive parameters the way Mainframe parameters were processed?
Resolution:
There is a complete project available under the "Related" tab.
===========================================================
M I C R O F O C U S
N E T E X P R E S S
===========================================================
PROJECT TUNABLE-PARMS
================
DATE CREATED: MARCH, 2006
===================
BUILD WITH RELEASE: NetExpress 4.0
========================
TABLE OF CONTENTS
=============
INTRODUCTION
SOURCE FILES
REQUIREMENTS
OPERATION
INTRODUCTION
==========
This example illustrates how you can acquire parameters coded at the
command prompt by using a Linkage section parameter definition and the
"command_line_linkage" Run-time tunable.
linkage section.
1 commandLine.
2 cLLength pic s9(4) comp.
2 cLParameter pic x(10).
procedure division using commandLine.
This should look familiar to anyone with experience programming an IBM
Mainframe computer. The procedure division header specifies that a
linkage section group item, "commandLine", is to be passed to the
program when it starts. This is how a JCL PARM is captured by a
Mainframe COBOL program. The "commandLine" group item consists of
two elementary items: cLLength, which captures the length of the
actual parameter; and cLParameter which is the data-name for
referencing the parameter from within the program. You can choose
whatever names you prefer for these data items. The length item must
preceed the parameter item and the parameter item may be whatever
length you need. If the parameter item is short of the actual
parameter value being passed, the value will be clipped to fit.
Accessing the data item values is very straight forward.
display 'TUNEPRMS: cLParameter value = ' cLParameter
move cLLength to editedLength
display 'TUNEPRMS: cLLength = ' editedLength
The "editedLength" data item is defined in the working-storage section.
77 editedLength pic 99999.
What makes this work is a Run-time tunable, "command_line_linkage". You
code this tunable setting in a configuration file.
(TUNEPRMS.CFG)
set command_line_linkage=TRUE
When you code this setting into your configuration file make certain
that you press the Enter key at the end of the tunable setting.
The "COBCONFIG_" environment variable must be set to the location and
name of the configuration file. See Project (menu), Properties...
(button), IDE (button).
COBCONFIG_ ./TUNEPRMS.cfg
For your application this setting could be made in System or a batch
file.
set COBCONFIG_=drive:\\path\\TUNEPRMS.cfg
You can choose whatever filename is most appropriate for your
application.
SOURCE FILES:
=========
Program Files
Description
========================================================
TUNEPRMS.cbl Example program using a linkage section data definition
to retrieve command line parameters.
TUNEPRMS.cfg A Run-time configuration file specifying a tunable
setting for the command_line_linkage tunable.
REQUIREMENTS:
==========
There are no special requirements necessary to support this example.
OPERATION:
==========
Animate the TUNEPRMS program. Note the output displayed in the output
window.
===========================================================
Micro Focus and Net Express are registered trademarks of:
Micro Focus International, Inc.
===========================================================
Copyright (C) 1996-2006 Micro Focus, Inc.