------------------------------------------------------------------------------- MODULE IFROMTEXT
-------------------------------------------------------------------------------
REPLACES DAMP module TEXT2I
-------------------------------------------------------------------------------
IFROMTEXT is a program which converts data held in a text form into an IFF file. IFF files, such as template files or standard grids may be created from scratch, with data input either from a file or directly from the terminal. IFROMTEXT can also be used to edit existing IFF files in conjunction with ITOTEXT. This is done by converting an IFF file into text form using ITOTEXT, editing the text file, and creating a new IFF file from the edited text file using IFROMTEXT. The default file extensions are .IFF for IFF files and .TXT for text files.
-------------------------------------------------------------------------------
$ IFROMTEXT text-file-spec [IFF-file-spec] Command qualifiers Defaults /[NO]ECHO /NOECHO /FRT = file-spec No FRT file is used /[NO]LOG /NOLOG /ORIGIN = (double_real, double_real) /NOORIGIN
Input may be read from the terminal by specifying SYS$INPUT: (or TT:) in place of the input filename.
-------------------------------------------------------------------------------
_Text-file: text-file-spec _IFF-file: IFF-file-spec
If input is from the terminal then IFROMTEXT will prompt for each line of input with:
IFF entry>
--------------------------------------------------------------------------------
text-file-spec
- specifies the text file from which an IFF file is to be made. Any part of the file name which is not specified will be taken from the default specification 'SYS$DISK:IFROMTEXT.TXT'.
IFF-file-spec
- specifies the IFF file which is to be created. IF any part of the
IFF-file specification is not explicitly given, the missing parts will be taken
from:
'LSL$IF:'input-file-spec'.IFF'.
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.
-------------------------------------------------------------------------------
/ECHO
/NOECHO
- input file lines will be echoed as read in.
/FRT = file-spec
- specifies an FRT file which contains feature code graphical types, and an ACD definitions table. Any part of the file specification not supplied is taken from the default LSL$FRT:FRT.FRT.
This qualifier should only be specified if non-standard ACD definitions are required to define attributes in CB or AC entries, or if text and symbol FS entry fields are to be set automatically (with some default values). See the IFF user guide for a description of standard ACD definitions and FS entry values.
/LOG
/NOLOG
- this will result in supplementary messages being sent to SYS$OUTPUT. Supplementary messages are generated when files are successfully opened, and a reassuring message is output each time a new IFF layer is written to the IFF file. If missing IFF entries are created by IFROMTEXT in order to maintain a valid IFF file structure, /LOG will cause detailed information about these entries to be output.
/ORIGIN = (double_real,double_real)
/NOORIGIN
- specifies an origin offset double real coordinate pair to subtract from any absolute coordinates in an absolute coordinate text file.
-------------------------------------------------------------------------------
IFROMTEXT creates a new IFF file from a text file or from data entered by the user at the terminal. IFF entries which are required to produce a valid IFF file are defaulted if not present. The following should be noted:
A new ISN (internal sequence number) which is the second value in the NF (New Feature) entry is created for each NF encountered in the text file. They are numbered monotonically, and any ISN values in the text file are ignored.
If there were coordinates encountered without an FS entry, a default FS is created with a feature code of 0. This means that if the /FRT qualifier is given and there is no FC 0 in the FRT, a warning message will result. Also, if there is an FC 0 in the FRT which is a symbol or text feature, the third FS entry field will be set appropriately, with possibly unexpected results.
IFROMTEXT produces a default empty MH 0 (Map Header) entry in the IFF file if there was no MH entry in the text file. The map header types and their intended users are:
0 map header is unset
1 MCE specific map header - edit with MCEHED
2 OSGB specific type 2 map header - edit with OMHED
3 OSGB specific type 3 (OSTF) map header - edit with OS editor
4 OSGB specific type 4 (CITF) map header - edit with OS editor
MCEHED is a utility supplied with the customer-specific package MCE. OSMHED is a utility in the IFFOSTF module of the CONVERT package.
Type 1 map headers are MCE specific and not intended for use by others.
Type 2 map headers are intended for users of OSTF data to hold OS specific header information needed during conversion to and from IFF.
Type 3 OS map headers are intended for use by Ordnance Survey (Great Britain) only and will be edited using OS developed header editors. If the text file contains a type 3 MH entry then the size of the entry is taken from the translation table LSL$OS_MH_TABLE and the header will be copied to the IFF file as an ASCII block. Note that, for type 3 OSTF headers, the size of the header will be the sum of the -1 and -20 header sizes specified in the translation table.
For type 3 map headers, the sizes (OSTF_MH_ONE and OSTF_MH_TWENTY) in the lookup table are intended to be static for OSTF and are assumed to be correct. This number of bytes will be used and if it is too small then not all of the header will copied to the IFF MH entry, the remainder being skipped, and the next entry (the MD) will be processed. If the size in the table is larger than the MH entry, then there is a danger that some of the MD entry will be copied in to the header and the MD entry will not be found. However, a default type 2 map descriptor will be created. It is therefore important to ensure that the header size(s) accurately reflect the size of the text MH entry.
If a type 3 header is being manually edited into the text file then it is safer to have a header that is longer than the size specified in the translation table. Any totally blank text lines must be represented as 80 spaces rather than a carriage return.
Type 4 CITF map headers are intended for use by Ordnance Survey (Great Britain) only and will be edited using OS developed header editors. Since type 4 map headers are variable in length, they are copied in lines (of 80 characters each) to the MH entry which will be only as large as required for number of lines in the text file. The size in the lookup table LSL$OS_MH_TABLE is not used, but the program reads lines until the map descriptor is found which is denoted by 'MD' or '!MD'. Since the first two characters of a CITF header line must be a numeric record descriptor, there should be no text in the header which could be mistaken for the Map Descriptor.
If the MH entry is invalid or missing then a default type 0 header is created. An invalid MH entry is one where the MH entry size is not 0 or 174. This is because MH type 0 has a entry size of zero and MH type 2 (OS) has an entry size of 174 words. For type 3 headers, the size is taken from the translation table and so the size in the MH entry should be zero.
For details of how to set up the translation table, refer to the DATA PREPARATION section of the IFFOSTF chapter in the "Convert User Guide".
A typical type 2 MH entry, when converted to text using ITOTEXT may look like:
MH 174 2
0 436500 122000 1250 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 436500 122000 0 0
50 1250 6500 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 4260880 4260880
4260880 4260880 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 4260880 4260880
4260880 4260880 4260880 4260880 0 0
0 0 0 9439170 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
Here is an example of a type 3 OS Map Header when converted to text as an ASCII block using ITOTEXT.
MH 0 3
-1 0 436500 122000 50 1250 0 6500 -20 1
9 86 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
0 0
Two text representations of a version 2 MD (Map Descriptor) entry are produced by the ITOTEXT program. The first is unformatted and is included if ITOTEXT is used for outputting the IFF file for subsequent retranslation with IFROMTEXT, eg:
MD 2 17352 0 17224
0 17786 0 0 0 0
0 0 0 0 0 0
etc.
The second formatted version 2 MD is preceded by a '!' and is thus ignored by IFROMTEXT, eg:
!MD LO 0.000000000000000 0.000000000000000 ! SC 0.000000000000000 ! PR 0 ! UN 0 ! SP 0
While it is not recommended to alter map descriptor fields it is recognised that the user may wish to set the local origin and the scale of the IFF file for subsequent processing by ITRANS. This may be done by inserting LO and SC entries either immediately before or after the MD entry in the text file, eg:
LO 500 500 SC 50000 MD "unformatted map descriptor values here"
The LO and SC values will then be recognised by IFROMTEXT and included in the appropriate map descriptor fields. Running ITRANS/DESCRIPTOR will verify that the correct values have been inserted in the map descriptor. It must be stressed that LO and SC are not valid IFF entries and are not produced by ITOTEXT.
The LO and SC entries are invalid with a version 1 map descriptor. IFROMTEXT considers a version 1 map descriptor to be one where an alphabetic character follows the MD rather than the numeric values of the unformatted version 2, eg:
MD MA -1 0.0 0.0 0.0 0.0 GR 0 0.0 0.0 0.0 0.0 SC 0.0 PS 0 0 AG 0 0.0 0.0 0.0 0.0
IFROMTEXT can read a text file containing double precision (absolute) coordinates (usually created by using the ITOTEXT/ABSOLUTE process), subtracting the supplied origin offset from all coordinate values and outputting an IFF file in local coordinates relative to this origin.
The CB entry is represented in textual form by a number of sub-entries which may be input to IFROMTEXT. A valid text form of the CB entry is as follows;-
While IFROMTEXT will produce default values if any of the sub-entries are omitted or are invalid it is important that: -
Note that attribute codes may be input either by their numeric code (eg 1006), or by the attribute name (eg X) in the ACD table. ITOTEXT, however, always outputs the numeric codes.
Character attributes (maximum 4 characters) should be enclosed in double quote markers while date and time attributes should be input in the standard VMS formats. ie.
13-OCT-1962 23:11:56.2
The IFF User guide should be consulted for a detailed description of the CB entry.
The user is not expected to produce a structurally complete textual representation of an IFF file using a text editor. Any IFF entries which are out of sequence or which are missing will be defaulted and the user informed. Which features are defaulted depends on what level of feature has been input by the user. For example if only an MD entry is included in the input file then only features at map level and above will be defaulted. (MH,MD,EM,RA,EJ). The IFF user guide should be consulted for a detailed description of IFF file structure.
One potentially disruptive default is that used for a missing ST entry. This consists of a single point having the coordinates (0.0,0.0). This will clearly affect the RA (RAnge) entry of the IFF file. The inexperienced user is recommended to use the /LOG qualifier which will output more detailed messages regarding the default IFF entries generated.
If the input file contains an entry which is incomplete or contains invalid values, then a message may be output informing the user that the remainder of the entry is defaulted. In the case of the CP (Corner points) entry, 16 values are expected. The following is an example of a deficient CP entry in the input file :
-------------------------------------------------------------------------------
$ IFROMTEXT_Text-File: TST1/LOG _IFF-File: TST1 %LSLLIB-I-IFFOPENED, DUA0:[BUREAU]TST1.IFF;2 opened for write %IFROM-I-OPTXT, text file DUA0:[BUREAU]TST1.TXT;0 opened for input %IFROM-W-ILLEGCUST, wrong customer in MH entry near line 5 %IFROM-I-REMMHDEF, remainder of MH entry defaulted %IFROM-I-SKIPPING, skipping to next entry %IFROM-I-LAYWRT, layer 1 written %IFROM-I-LAYWRT, layer 88 written %IFROM-I-LAYWRT, layer 66 written %IFROM-I-LAYWRT, layer 55 written %IFROM-I-LAYWRT, layer 44 written %IFROM-I-LAYWRT, layer 11 written ELAPSED: 00:00:37.02 CPU: 0:00:08.92 BUFIO: 6 DIRIO: 199 FAULTS: 335 $
This example demonstrates how IFROMTEXT prompts for the input and output files. The /LOG qualifier output indicates the defaults applied to the file-specs supplied. The MH (Map Header) entry in the text file contained an invalid MH customer code. IFROMTEXT reports this and outputs a default, all zero, MH entry to the IFF file. The user will have to use IPATCH/WRITE to insert the correct values and customer type into the MH entry.
$ IFROMTEXT RRROM.TXT/LOG ROM.IFF
Here the user specifies both the input text file and output IFF file on a single command line. IFROMTEXT is unable to read the contents of the RA (RAnge) entry in the text file and so calculates range values as ST and ZS points are written to the IFF file. When the EJ is read from the text file, or when end-of-file is detected, the calculated range values are patched into the RA entry in the IFF file. The run completed normally. $STATUS is set to SS$_NORMAL.
$ IFROMTEXT SYS$INPUT: TSTSYS
Because SYS$INPUT: is specified, IFROMTEXT prompts for the input from the
terminal. IFROMTEXT fills in default values for those required IFF entries
which are not included. The user terminated the session by pressing
See ifromtextmsg.html generated from IFROMTEXTMSG.RNO.