-------------------------------------------------------------------------------- MODULE IRECODE
-------------------------------------------------------------------------------- REPLACES Nothing, IRECODE is a new IMP utility.
--------------------------------------------------------------------------------
IRECODE enables change of selected layer, feature code, text component code or AC numbers in an existing IFF file to specified new values. By default, IRECODE creates an output IFF file to contain the altered data. Alternatively, changes to the input file may be made in-situ.
--------------------------------------------------------------------------------
$ IRECODE input-file-spec [output-file-spec] Command qualifiers Defaults
/[NO]ALPHABETIC=filename /NOALPHABETIC /AC[=(integer>integer,...)] None. /FC[=(integer>integer,...)] IRECODE prompts for feature codes. /TCC[=(integer>integer,...)] None. /IN_SITU Create a new file. /LAYER[=(integer>integer,...)] None. /[NO]LOG /NOLOG
If, for example, the user issues this IRECODE command line within a command file and supplies the arguments for /LAYER as if they were to be prompted for:
$ IRECODE/AC=(1>g)/LAYER
2>34>6 5>8 $
IRECODE will detect the erroneous "g" in the argument list for /AC and enter prompt mode. What had been intended as arguments for the /LAYER qualifier will now be read as arguments for /AC. Fortunately, in this example, IRECODE will detect end-of-input-file (the dollar of the next DCL command line) when trying to get arguments for /LAYER. IRECODE will then abort execution. If, however, the user had mistakenly specified 2 blank lines in the input file before the dollar, /LAYER argument input would be considered complete and entirely erroneous recoding would have occurred. $STATUS would be set to SS$_NORMAL and the errors would continue through the command file. --------------------------------------------------------------------------------
_Input-File: input-file-spec
If /IN_SITU is not specified, then: _Output-File: output-file-spec
--------------------------------------------------------------------------------
input-file-spec
- specifies the IFF file which is to be recoded. Any part of the file specification which is not supplied will be taken from the default specification 'LSL$IF:IFF.IFF;0'.
output-file-spec
- specifies the IFF file which is to be created. By default, IRECODE creates an output IFF file to contain the altered data. Alternatively, changes to the input file may be made in-situ by specifying the /IN_SITU qualifier. No output file specification should be supplied on an IRECODE command line containing the /IN_SITU qualifier.
Any part of the output file specification which is not explicitly given will be taken from the parsed input specification. Note that a version number must not be specified for the output file. If a file with the specified name already exists, a new file will be created with the version number incremented by one.
--------------------------------------------------------------------------------
/ALPHABETIC=filename
This qualifier allows the optional text field contained in the Laser Scan default AC entry of type 1 (Secondary_FC), to be used to change the feature codes of features taken from the input IFF file.
The file which /ALPHABETIC takes as its argument contains a list of entries which specify the text (to be compared with that from the AC entry) and their corresponding feature codes. These entries must be of the form:
Entries which have an exclamation mark '!' as their first non-space character will be assumed to be comments and will be ignored.
A Definition_string which consists of more than one word must be enclosed in quotes.
The Definition_string and Output_feature_code may be separated by an optional comma (',') or a greater-than sign ('>').
IRECODE will read the entries from the file and compare the Definition_strings with the optional text contained in the AC type 1 entries. If the strings match, the current feature code in the output file will be modified using the Output_feature_code associated with the string.
/AC[=(integer>integer[,...])]
- where the first integer of each pair of integers is the old AC type number, the second the new AC type number which is to replace the old one.
If a syntax error is made in the command string, or /AC is specified with no arguments then IRECODE will prompt for input:
Old AC type number, New AC type number ?
.
.
.
This prompt will be repeated for additional arguments until IRECODE detects a blank line.
+--------------------------------------------------------------------+ | Beware that if the /AC qualifier is used on an AC type having | | a floating point value in the AC longword field then the longword | | will be rounded to the nearest integer (via FORTRAN NINT). If | | used to change an integer longword AC to an AC type having a | | floating point longword field the integer will be floated. | | | | All AC types have an integer value stored in their longword field | | except type 3 and type 80 through 99 ACs) which have a floating | | point number. | +--------------------------------------------------------------------+
/FC[=(integer>integer[,...])]
- where the first integer of each pair of integers is the old feature code, the second the new feature code which is to replace the old code. This is the default mode of IRECODE. Failure to specify any qualifiers will result in IRECODE prompting for input. Similarly, if a syntax error is made in the /FC argument list, or /FC is specified with no arguments, then IRECODE will enter prompt mode:
Old Feature Code, New Feature Code ?
.
.
.
This prompt will be repeated for additional arguments until IRECODE detects a blank line.
/TCC[=(integer>integer[,...])]
- where the first integer of each pair of integers is the old TCC (Text Component Code), the second the new TCC which is to replace it. If a syntax error is made in the /TCC argument list, or /TCC is specified with no arguments, then IRECODE will enter prompt mode:
Old Text Component Code, New Text Component Code ?
.
.
.
This prompt will be repeated for additional arguments until IRECODE detects a blank line.
/IN_SITU
/NOIN_SITU
- the default mode of IRECODE operation is to create a new IFF file to receive the modified data. The /IN_SITU qualifier forces modification to occur in-situ, thus destroying the original data. /IN_SITU is not available if an output file is specified. Qualifiers on the command line preceding the /IN_SITU qualifier are ignored by the Command Line Interpreter (CLI) and a warning message is given.
/LAYER[=(integer>integer[,...])]
- where the first integer of each pair of integers is the old layer number, the second the new layer number which is to replace the old one. If a syntax error is made in the /LAYER argument string, or /LAYER is specified with no arguments, then IRECODE will prompt for input:
Old Layer Number, New Layer Number ?
.
.
.
This prompt will be repeated for additional arguments until IRECODE detects a blank line.
/LOG
/NOLOG
- this will result in supplementary messages being sent to SYS$OUTPUT. Supplementary messages are generated when a file is successfully opened, and a reassuring message output each time a new IFF layer is encountered in the IFF file.
--------------------------------------------------------------------------------
Used on an existing IFF file, IRECODE enables the global change of the following IFF entry values within the file:
The IFF entry type which is to be changed is specified with the qualifier of the corresponding name. The 'old' and 'replacement' values for the specified IFF entry may be specified as arguments to the IFF entry qualifier. An argument pair, 'old' and 'replacement', is separated by a closing angle bracket. Multiple argument pairs are separated by commas and the whole list of argument pairs is enclosed in parentheses. In the event of a command decoding error or in the event of no arguments being supplied to an IFF entry qualifier IRECODE will enter prompt mode and explicitly request argument pairs from the user. Exit from prompt mode is achieved by specifying a blank line.
An option to change the input file in-situ is provided with the /IN_SITU qualifier. Only one file-spec parameter should be specified on the command line if the in-situ mode of operation is selected. It is very dangerous to work on an IFF file in situ as some changes are irrevocable. Such changes fall into two classes:
Changing the value of IFF entries with IRECODE can have implications beyond the immediate value change. These implications are outlined below for each of the IRECODE IFF entry code qualifiers.
/AC
A number of AC types are reserved by Laser-Scan for special applications. IFF applications programs (such as those of IMP!) are written with awareness of the specialist nature of some of these AC types. AC entries are used to hold miscellaneous information. They are composed of a word (integer*2) type, a longword (integer*4 or real) code and an optional text.
The type of information held in an AC is determined by the AC type. Current type values are defined in the IFF User Guide.
AC types may take values in the range 0-32767. Negative types are not allowed.
The range of the AC code is implicitly specified by the use of the AC. Note that AC type 3 and types 80 to 99 (inclusive) are currently the only ACs to have a real value in the AC longword field.
If an AC type number is changed from one associated with a real (floating point number) longword field to an AC type number associated with an integer value in the longword field the floating point number will rounded.
The length of the text field is limited to 255 characters.
/FC
The Feature Code of a feature is carried in the first word of the FS entry of each feature. IRECODE only changes the first (feature code) word of the FS entry. As the feature code is stored as a word (16 bit integer) its value must lie in the range -32768 to 32767. In practice negative feature codes are not allowed. The other 3 words of the IFF FS entry remain unaltered. Be very careful to ensure that by changing the feature code, conflicts with Words 2 to 4 of an IFF FS entry are defined in the IFF User Guide.
/LAYER
IFF files are generally divided up into multiple layers, where data of a common sort or source is grouped in the same layer. Note that a layer may be split into several parts, identified by all having the same layer number.
Layer 0 is conventionally reserved for 'non-essential' data - for instance a grid, symbols at control points, or MCE DFAD accuracy polygons. The assumption is that the IFF file would not be significantly degraded in terms of information content by throwing layer 0 away. If layer 0 is present, some programs expect it to be the first layer in the file.
Historically, layers 11 and 32 were also used for the same sort of purpose as layer 0. If working with an IFF file belonging to an historical database this should be taken into consideration.
/TCC
Text features may contain one text string, with associated location and descriptive data, or they may be composite - that is composed of several sub-texts or text components, which may be manipulated independently or as a single entity.
Each text component starts with a TS entry, and ends with the next TS entry, or the final EF of the feature. The first TS entry occurs immediately after the FS entry and any AC entries. Text components may not include FS or AC entries, but may contain any other entries that are legal within a normal text feature.
Word 1 of the TS entry is the text component code (TCC), which is the primary descriptive code for a text component - it is effectively the feature code for this component of the composite text, and is used in the same manner. IRECODE enables the user to alter only the first word of a TS entry, i.e_._the TCC. Alteration of the TCC should, however, take account of the third word of the TS entry.
Word 3 of the TS entry is the text word, and is identical in form to word 3 of a text's FS entry - it holds a description of the type of text component.
The second and fourth words are reserved for later definition. For a detailed description of the IFF TS entry see the IFF User Guide.
--------------------------------------------------------------------------------
$ IRECODEInput-file: S320480SW.IFF/LOG Output-File: TEST.IFF Old Feature Code, New Feature Code ? 123,4 Old Feature Code, New Feature Code ? %LSLLIB-I-IFFOPENED, DUA0:[LSL.ACCEPTANCE]S320480SW.IFF;4 opened for read %LSLLIB-I-IFFOPENED, DUA0:[LSL.ACCEPTANCE]TEST.IFF;1 opened for write %IRECODE-I-LAYER, layer 1 found %IRECODE-I-LAYER, layer 80 found ELAPSED: 00:00:27.67 CPU: 0:00:05.50 BUFIO: 9 DIRIO: 155 FAULTS: 247 $
$ IRECODE S320480SW.IFF/AC=(3>J8)/LOG
This example illustrates IRECODE behaviour when an error is detected while decoding qualifier code change pair arguments. A 'J' has been included in the /AC argument string. IRECODE abandons decoding of the argument list for the /AC qualifier and prompts for the correct input. The user should enter each code change pair on a new line. In the example the user make two further errors while specifying the code change pairs in response to the prompt for input. In each case IRECODE issues a warning message and re-prompts. When the whole list of code change pairs for the /AC qualifier is re-entered the user should enter a blank line. Processing will then begin. In the example IRECODE detects no processing errors and the run completes normally. $STATUS is set to SS$_NORMAL.
$ IRECODE S320480SWF.IFF/AC=(3>5)/LAYER=(1>77,88>2)/IN_SITU TEST.IFF
The first example here shows an attempt to run IRECODE specifying both the
/IN_SITU qualifier and an output file parameter. The Command Line Interpreter
(CLI) issues error messages and IRECODE aborts execution. The command line is
respecified without the output parameter. Unfortunately the user has specified
qualifiers on the command line which occur before the /IN_SITU qualifier.
The CLI ignores these. This results in the CLI interpreting the command line
as if no code change qualifiers were specified. IRECODE therefore prompts for
Feature Code change pairs by default. The user, realising the error, responds
with
$ IRECODE S320480SW.IFF/TCC/FC/LAYER
This example shows IRECODE prompting for code change pairs for the /FC, /TCC and /LAYER qualifiers. The user specified 2 valid Feature Code change pairs. A third feature Code change pair was then specified. IRECODE detected that a change to feature code 3 had already been specified (change feature code 3 to 5 on prompt line 1). A warning message is issued and the most recent feature code change for feature code 3 is substituted. Feature code 3 will now be changed to 4 not 5. A further three feature code changes were then specified followed by a blank line. IRECODE then prompted for TCC (Text Component Code) change pairs. The user specified TCC change pairs and then specified a blank line. Finally, IRECODE prompted for Layer change pairs. The user specified one Layer change pair and then specified a blank line. IRECODE then successfully processed the file, writing the modified feature codes and layer numbers to LSL$IF:TEST.IFF;0.
--------------------------------------------------------------------------------
These messages give information only, and require no immediate action by the user (except perhaps to verify that the correct options have been selected). Most will only appear if /LOG has been specified on the command line, unless they are used to provide supplementary information after an error has occurred.
ARGRANGE, IRECODE qualifier arguments must lie in the range 0 - 32767
Explanation: The specified argument value (or value typed in response to a prompt) is outside the specified range.
User action:Specify values that lie within the specified range.
LAYER, Layer 'integer' found
Explanation: The specified layer has been encountered in the IFF file.
User action: None.
LINESKIP, skipping over line due to warning
Explanation: A warning condition occurred while reading a line from the file given with the /ALPHABETIC qualifier
User action:The warning message which preceded this message identifies what the problem was. Check the file given as the argument for the /ALPHABETIC qualifier.
CANALPHA, cancelling /ALPHABETIC qualifier
Explanation:An error occurred while reading from entries in the file specified with the /ALPHABETIC qualifier.
User action:This error suggests that the entries in the file were corrupt. Check that the file contained text only and that it was not corrupt.
NOMATCH, text from ACD1 "string" unmatched
Explanation:The "string" read from the optional text field an AC entry of type 1 (ACD1) ,was not matched with text entries read from the file specified with the /ALPHABETIC qualifier. As a result the feature code (FC) of the feature containing that AC entry will not be modified.
User action:If the user wished to modify the FC of the feature which had an ACD1 with the specified text entry, then an appropriate entry should be made in the file specified with the /ALPHABETIC qualifier.
--------------------------------------------------------------------------------
These messages are output when an error has occurred that can be corrected immediately by the user.
ARGSREQ, at least one argument pair required.
Explanation: The user has failed to provide any 'OLD','REPLACEMENT' code pairs and has pressed carriage return in response to one of the prompts:
Old Feature Code, New Feature Code?
or:
Old Text Component Code, New Text Component Code?
or:
Old AC type number, New AC type number?
or:
Old Layer Number, New Layer Number ?
User action: IRECODE expects at least one AC, Layer, Feature or TCC
code pair to work with and will persist in reprompting until one is provided.
Use
BADARGFMT, bad format for arguments
Explanation: The parameters have been entered in an incorrect format
(see command qualifiers section), the user must enter them all again.
User action: IRECODE cannot read the supplied arguments. Instead it
will prompt for input.
The user should supply the arguments in the form requested. Further
arguments can be supplied, if desired, and the argument list terminated by
specifying a blank line.
BADARGRA, qualifier argument out of range
Explanation: The specified argument value (or value typed in response
to a prompt) is outside the specified range.
User action: Specify values that lie within the specified range.
BADCHR, bad character in string
Explanation: A bad character is present in the argument list,
IRECODE will prompt for input which should be supplied using the format:
User action: Supply the arguments in the form requested. Further
arguments can be supplied, if desired, and the argument list terminated by
specifying a blank line.
TOOMNYPAR, too many argument pairs - maximum 'integer'
Explanation: Too many code change argument pairs were supplied in
prompt mode.
User action: The maximum number of code change argument pairs allowed
is large. Ensure that you are quite certain that you really want to
change so many code values. If you do, you will have to run IRECODE twice. The
first time you should specify an output file and change up to the maximum
number of codes only. The second time you may wish to modify the output file of
the first IRECODE run using IRECODE in /IN_SITU mode. You can then change all
remaining codes to specified new values. Should you wish to change such large
numbers of IFF entry code values on a regular production basis please contact
Laser-Scan.
TWOARGS, two integer arguments required.
Explanation: Only one integer argument was specified either as a
qualifier argument or in response to a prompt for input.
User action: Supply the arguments in the form requested. Further
arguments can be supplied, if desired, and the argument list terminated by
specifying a blank line.
The following messages are self-explanatory and relate to entries being
read from the file specified with the /ALPHABETIC qualifier:
--------------------------------------------------------------------------------
ERRSSNVIO, successive syntax violations - please read manual
Explanation: The user has failed to enter the argument pair in the
correct format, in four successive attempts. IRECODE exits.
User action: Read the documentation before trying again.
UNEXPEOF, unexpected end of IFF file.
Explanation: The specified input IFF file ended before an EJ entry was
encountered. The valid part of the input IFF file was processed, but upon
detection of this error condition IRECODE deletes the output file and aborts
execution.
User action: Use IMEND to correctly terminate the input file before
re-specifying the IRECODE command line.
UNEXPERR, unexpected error while reading from file.
FILERR, unexpected file error.
Explanation: These errors relate to the file specified with the
_/ALPHABETIC qualifier.
User action:Check that the file contains only text entries and that
it is not damaged.
--------------------------------------------------------------------------------
In addition to the above messages which are generated by IRECODE itself,
other messages may be produced by the command line interpreter (CLI) and by
Laser-Scan libraries. In particular, messages may be generated by the IFF
library. These are introduced by '%IFF' and are documented in the IFF library
users' guide. In most cases IFF errors will be due to a corrupt input file, and
this should be the first area of investigation. If the cause of the error
cannot be traced by the user and Laser-Scan are consulted, then the input file
should be preserved to facilitate diagnosis.
'integer', 'integer'
MESSAGES (ERROR)
These messages indicate an error in processing which has caused IRECODE to
terminate. The most likely causes are a corrupt or otherwise invalid input IFF
file, or an error related to command line processing and file manipulation.
It is most unlikely that any output file produced will be correctly processed.
MESSAGES (OTHER)