TEXGET

Get a Line of Text from Segment

Environments EASI
Sections Description Parameters Parameter Details Details Example Related

Description

Transfers a line of text from a text segment on a PCIDSK file to a parameter.

TEXGET is a tool for users writing EASI procedures. Its companion is TEXPUT which puts (writes) a line of text.

Parameters

TEXGET is controlled by the following global parameters:

Name Prompt Type Length
FILE Database File Name Char 1 - 192
TEXSEG Database Text Segment Int 1
LINENUM Line Number to Access Int 0 - 1
LINETEXT Line of Text Char 0 - 64

Parameter details

FILE

Specifies name of PCIDSK image file that contains text segment.

EASI>FILE="filespec"

TEXSEG

Specifies number of the text segment (type 140) to get (read) a line from.

EASI>TEXSEG=i

LINENUM - Optional

Specifies the line number of the line of text to read. If unspecified then the last line on the file is assumed.

EASI>LINENUM=n         | Get nth line
EASI>LINENUM=          | Get last line on file

Line numbering starts at 1. Requesting a line which does not exist will result in an error. If the last line is requested (i.e., LINENUM is unspecified) then this parameter will return the line number of the last line.

LINETEXT - Optional

Upon completion of TEXGET this parameter holds the requested line of text from the text segment.

Only the first 64 characters of the line will be returned since this is all that can be held by a string parameter. If the line has more than 64 characters the extra characters cannot be accessed.

Details

TEXGET is used to get (read) a line of text to a text segment on a PCIDSK file. The line can be read from a specific position (line number in the text). TEXGET is intended for use by writers ofEASI procedures who need to read and write lines of text.

TEXGET reads a line of text (LINETEXT) from a specified line (LINENUM) in a text segment (TEXSEG) on a PCIDSK file (FILE).

The following should be noted:

1) Text segments can be up to 32767 characters long, after this, data will be lost.

2) While lines of text in the segment can have any length, TEXGET can only read the first 64 characters on a line. This is due to the length limitations on parameter strings.

3) TEXPUT puts (writes) a line of text to a text segment.

4) Normal text files on disk can be read into text segments using task TEXREAD. Text segments can be written to disk using TEXWRIT. Once in a text segment the contents of a text file can be accessed using TEXGET, TEXPUT inEASI .

5) InEASI the following string manipulation functions can be used: +, string concatenation; f$extract, substring extraction; f$string, convert number to string; f$value, convert string to number.

PCI would like to thank Liz Wegenka at the USGS, Menlo Park, California, for suggesting this program.

Example

An analyst has used a statistical program to generate coefficients to be applied to the first three channels of a sequence of files. This information is held in a text file, coeff.txt, the contents of which is listed below:

        section1.pix          .36  .33  .31
        section2.pix          .33  .32  .35
        section3.pix          .40  .31  .29
            . . .
        section50.pix         .36  .34  .30

The first 20 characters in each line are the file name, each coefficient is in a field of 5 characters. The Analyst writes the following procedure to automatically apply the coefficients to each file, storing the result in channel 4 in each file.

   5 local $s
  10 rem -- CREATE PCIDSK FILE TO HOLD coeff.txt IN TEXT SEGMENT --
  20 dbsz=16,16 \ dbnc=0 \ file="temp.pix" \ run CIM
  30 rem
  40 rem ----------------- READ IN coeff.text ---------------------
  50 tfile="coeff.txt" \ texform="FREE" \ dbsn="temp"
  60 texseg= \ run TEXREAD \ texseg = lasc
 100 rem
 110 rem ------------- SETUP RTR TO APPLY COEFFICIENTS ------------
 120 cnum=1,2,3  \ ncon= \ cden= \ wden= \ dcon=1.0 \ dboc=4
 130 smod="NONE" \ zerodiv=
 200 rem
 210 rem ------- READ EACH LINE FROM TEXT FILE --------------
 220 linenum= 1
 230 file="temp.pix"
 240 run TEXGET onerror goto 900         \rem onerror check for EOF
 300 rem
 310 rem ---------- BREAK OUT VALUES FROM LINE --------------
 320 file=f$extract(linetext, 1,20)               \rem file name
 330 $s = f$extract(linetext,21, 5)
 335 wnum(1)= f$value($s) \rem coefficient 1
 340 $s = f$extract(linetext,26, 5)
 345 wnum(2)= f$value($s) \rem coefficient 2
 350 $s = f$extract(linetext,31, 5)
 355 wnum(3)= f$value($s) \rem coefficient 3
 400 rem
 410 rem -------- RUN RTR PROGRAM AND LOOP FOR NEXT LINE --------
 420 status RTR
 430 linenum(1) = linenum(1) + 1         \rem next line
 440 goto 230
 900 rem 
 910 rem ------------ DONE:  DELETE temp.pix AND EXIT ------------
 920 delete "temp.pix"

Related topics

The following is a list of related topics.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.