Kbase 2: Running CTOS or BTOS commands OS-Requests from 4GL procedure
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
Running CTOS or BTOS commands OS-Requests from 4GL procedure
910613-mlb01
INTRODUCTION:
=============
This Progress Software Technical Support Knowledgebase entry
describes how to run a BTOS/CTOS command (.run file) from
from within PROGRESS without making the user fill out the
BTOS/CTOS command form interactively.
You can also invoke submit files to execute from within
your application.
WHY YOU NEED TO DO THIS:
========================
You may have reason to issue an Executive (operating system)
command from within your application. Or, the user may need
to know something about the system (file names, remaining
disk space) in order to select an option within the application.
This method allows you to provide that functionality without
having either to exit the Progress application or make the user
switch contexts. NOTE: This capability can only be invoked
if you are running Progress under Context Manager. There must
be an available unused partition that Progress can create a
context in. This means that one of the ten function keys
that can be assigned to a context must be left unassigned.
==============================================================
The first example is how you would run Quoter
from within a PROGRESS procedure for a data file with comma-separated-
variables.
BTOS SILENT VALUE(SEARCH("quoter.run")) quoter -d , cust.dat >cus.d
(Note that there should NOT be a space in front of the output file.)
This statement locates and runs quoter.run, passing the input file
name to the command (as required by the command). It also passes
the optional parameters explained at the end of this section.
The word "SILENT" is optional.
In this case "infile" looks like:
abcd,1,XYZ
efgh,2,PQR
ijkl,3,STU
and "filename" looks like this after running the command:
"abcd" "1" "XYZ"
"efgh" "2" "PQR"
"ijkl" "3" "STU"
The following paragraphs describe each part of the command line:
"BTOS" can be replaced with "CTOS".
"SILENT" is optional and simply means the user does not
have to press the space bar to continue when control
returns to the procedure from the invoked command.
"VALUE(SEARCH("quoter.run"))" could be replaced with the
explicit command and path of the run file you want to run.
In this case, this string equals "[sys]<sys>quoter.run".
To get this value, PROGRESS SEARCHed the PROPATH set in
the users .env file (usually Progress.env) and located
quoter in the [sys] volume <sys> directory.
"Quoter" is the name of the command you would execute at
the command bar. If the command you want to run is a
two-or-more word command, include the command name in
quotes, as in "Partition Status". This is a required
aspect of the BTOS/CTOS statement.
The command name is then followed by a list of arguments;
the arguments are used in sequence relative to the lines
on the command form. In this example, the Input File name,
"cust.dat", is a required command line argument for the Quoter command
(which could have been any operating system filename, with the
explicit path if necessary). In some BTOS/CTOS commands,
there are no required arguments, for example, "Files" can be
run without passing a directory name.
">cus.d" is the second argument; for quoter, it means put the
resultant quoted values in the operating system file
"outfile" in the current directory.
"-d ," also appears on the command [Options] line.
This option indicates that the fields in the the input file cust.dat
are separated by commas.
NULL & ZERO LENGTH PARAMETERS
=============================
Sometimes you will not want to supply values to each argument
of the command. In this case, you need to provide "place holders"
in your Progress statement, since the arguments will be applied
to the command in the order in which they are presented. Under
version 6, there is a way to do this.
If the command you are running has several optional lines
on the command form and you only want to use some of
them, place "()" for Version 6 in the Progress
statement for each of the argument lines to be skipped. For example,
if you want to write a sorted list of the files in your current
directory, one filename on a line, without timestamp/size
details, to a diskfile called "File.list", the command from the
Executive would be:
FILES
[File list] *
[Details?]
[Print File] File.list
[Suppress Sort?]
[Max columns?] 1
[Suffix Sort?]
[Suppress Error Msgs?]
The Progress application equivalent version 6 statement would be:
BTOS SILENT [sys]<sys>files.run FILES "*" "()" File.list "()" 1
The first "()" skips the [Details?] line, and the second "()" skips
the [Suppress Sort?] line.
A submit file example would be as follows:
SUBMIT
File List Sample.sub
[Parameters] File.list " [sys]<DLC>
The Progress application equivalent version 6 statement would be:
BTOS SUBMIT Sample.sub File.list "''" [sys]<DLC>
Progress Software Technical Support Note # 2