Problem:
Following is an explanation on how to collect multiple parameters from command-line.
Resolution:
Click "Related" tab above for a complete example project.
===========================================================
M I C R O F O C U S
N E T E X P R E S S
===========================================================
PROJECT COMMAND-LINE-ARGUMENTS
========================
DATE CREATED: MARCH, 2006
===================
BUILD WITH RELEASE: Net Express 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 the "ARGUMENT-NUMBER" and "ARGUMENT-VALUE"
function-names.
C:\\FOLDERNAME>ARGPARMS.EXE Alpha Beta Gamma Delta<Enter>
At the "C:\\FOLDERNAME>" prompt, the "ARGPARMS>EXE" program name has
been typed followed by four "Alpha Beta Gamma Delta" parameters.
The "ARGUMENT-NUMBER" function-name can be used as the second operand
of an accept statement to collect the number of arguments following the
program name at the command prompt.
accept argumentCount from ARGUMENT-NUMBER
The first operand of the accept statement is the name of the data item
where you want the number of parameters stored.
A perform statement can be used along with a subscript (argumentIndex)
to control the gathering of multiple argument values from the
command-line.
perform with test after
varying argumentIndex from 1 by 1
until argumentIndex = argumentCount
The "ARGUMENT-VALUE" function-name can be used as the second operand of
an accept statement to collect one argument value from the command
prompt.
accept argumentValue(argumentIndex) from ARGUMENT-VALUE
The first operand of the accept statement is the name of the data item
where you want the collected data stored. Using a subscripted table
item (argumentValue(argumentIndex)) permits the initialization of an
array of values. The first "ARGUMENT-VALUE" returned will be the first
command line parameter following the program name. Subsequent parameter
values are retrieved each time the "ARGUMENT-VALUE" function-name is
referenced.
SOURCE FILES:
=========
Program Files
Description
= ========================================================
ARGParms.cbl Example program that uses accept statements and the
"ARGUMENT-NUMBER" and "ARGUMENT-VALUE" function-names
to collect multiple parameters from the command line.
REQUIREMENTS:
==========
There are no special requirements necessary to support this example.
OPERATION:
========
Animate the ARGParms 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.
===========================================================
M I C R O F O C U S
N E T E X P R E S S
========================================================================
PROJECT COMMAND-LINE-ARGUMENTS
==============================
DATE CREATED: MARCH, 2006
=========================
BUILD WITH RELEASE: Net Express 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 the "ARGUMENT-NUMBER" and "ARGUMENT-VALUE"
function-names.
C:\\FOLDERNAME>ARGPARMS.EXE Alpha Beta Gamma Delta<Enter>
At the "C:\\FOLDERNAME>" prompt, the "ARGPARMS>EXE" program name has
been typed followed by four "Alpha Beta Gamma Delta" parameters.
The "ARGUMENT-NUMBER" function-name can be used as the second operand
of an accept statement to collect the number of arguments following the
program name at the command prompt.
accept argumentCount from ARGUMENT-NUMBER
The first operand of the accept statement is the name of the data item
where you want the number of parameters stored.
A perform statement can be used along with a subscript (argumentIndex)
to control the gathering of multiple argument values from the
command-line.
perform with test after
varying argumentIndex from 1 by 1
until argumentIndex = argumentCount
The "ARGUMENT-VALUE" function-name can be used as the second operand of
an accept statement to collect one argument value from the command
prompt.
accept argumentValue(argumentIndex) from ARGUMENT-VALUE
The first operand of the accept statement is the name of the data item
where you want the collected data stored. Using a subscripted table
item (argumentValue(argumentIndex)) permits the initialization of an
array of values. The first "ARGUMENT-VALUE" returned will be the first
command line parameter following the program name. Subsequent parameter
values are retrieved each time the "ARGUMENT-VALUE" function-name is
referenced.
SOURCE FILES:
=============
Program Files
Description
============= ========================================================
ARGParms.cbl Example program that uses accept statements and the
"ARGUMENT-NUMBER" and "ARGUMENT-VALUE" function-names
to collect multiple parameters from the command line.
REQUIREMENTS:
=============
There are no special requirements necessary to support this example.
OPERATION:
==========
Animate the ARGParms 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.