Difference between revisions of "IMPORT"
From ICE Enterprises
ConvertBot (talk | contribs) (Import a resource (file, environment variable, ...)) |
(No difference)
|
Latest revision as of 18:04, 27 April 2020
Import a resource (file, environment variable, ...)
<IN> - Input resource name. Quotes recommended. (Case-sensitive)
<OUT> - Output resource name
Keyword Only Parameters:
<DEF> - Default value (case-sensitive) for case when environment variable
does not exist. Otherwise result will NOT be set (since 3.1.2).
<KEY=VALUE,...,KEYn=VALUEn> - additional arguments for /F (import file).
This command is intended to input an external resource of type:
* OS Environment Variable
* Non-Midas file
This command throws a Midas error if <IN> is not given.
If <IN> is "ALL", then <OUT> will be a table of all environment variables
found in the shell. If <OUT> is blank, it defaults to the uppercase of <IN>.
the terminal only.
If the optional parameter <DEF> exists when importing an environment variable,
the given default value will be assigned to <OUT> in the even that the
environment variable does not exist.
If /F is applied, <IN> is the path to a non-Midas file of data. This
command will create a detached Midas header named <OUT> and rename the
non-Midas file to <OUT>.det. The size is initialized assuming the
non-Midas file is all data and of format SB. Any key=value parameter
pairs place after <OUT> are applied to the new header the same as if
running the HEADERMOD command on the file. See the EXP on HEADERMOD.
If /F is applied and <OUT> is blank, the detached Midas header file will
be created with the same name but a .tmp extension. The non-Midas file
will not get a .det extension so it can still be used by other programs.
Note: SIZE and DATASIZE arguments are treated as special cases. (Note that
SIZE is number of elements and DATASIZE is size of data in bytes).
SIZE: If the SIZE is specified on the IMPORT command line (e.g. SIZE=<value>),
then the detached header file will be written to include <value> as the
size, regardless of the actual number of elements
DATASIZE: If the DATASIZE is specified on the IMPORT command line (e.g.
DATASIZE=<value>), then the detached header file will be written to
list SIZE as <value>/(bytes per element).
If both SIZE and DATASIZE are specified on the IMPORT command line, then SIZE
will have precedence.
Examples:
1. Set a result with the value of the OS environment variable JREHOME
nM> import "JREHOME" jrehome ! Note: quoting env var name prevents
! import from getting the VALUE
! of JREHOME on subsequent calls
2. Set a result with the value of the OS environment variable JREHOME,
but if that environment variable does not exist, put it in the results
table with the given <DEF> parameter value:
nM> import "JREHOME" jrehome DEF="my_jrehome_path"
3. Import a file of 16 bit integers generated by MatLab
nM> import/f matlabfile.data myfile form=si
4. Import a file and 'force' the header to display a different size (in bytes)
nM> import/f in=testsine.bin form=cf datastart=512 datasize=800
5. Import a type 3000 file
nM> import/f in=testcities.bin type=3000 form=nh &
sr=(POS/VD,NAME/1A) datastart=512
Switches:
/F - Import a file. Will import env var if not set. [DEF=FALSE]
/WARN - Turn on/off warnings in this command [DEF=TRUE]