Compaq COBOL AAQ2G1FTK User Manual

Page 6

Advertising
background image

4.3.7

Assigning Index Values Using the SET Statement . . . . . . . . . . . . . . . .

4–16

4.3.7.1

Assigning an Integer Index Value with a SET Statement . . . . . . .

4–16

4.3.7.2

Incrementing an Index Value with the SET Statement . . . . . . . . .

4–16

4.3.8

Identifying Table Elements Using the SEARCH Statement . . . . . . . . .

4–16

4.3.8.1

Implementing a Sequential Search . . . . . . . . . . . . . . . . . . . . . . . .

4–17

4.3.8.2

Implementing a Binary Search . . . . . . . . . . . . . . . . . . . . . . . . . . .

4–18

5 Using the STRING, UNSTRING, and INSPECT Statements

5.1

Concatenating Data Using the STRING Statement . . . . . . . . . . . . . . . . . .

5–1

5.1.1

Multiple Sending Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–1

5.1.2

Using the DELIMITED BY Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–2

5.1.3

Using the POINTER Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–4

5.1.4

Using the OVERFLOW Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–4

5.1.5

Common STRING Statement Errors . . . . . . . . . . . . . . . . . . . . . . . . . .

5–6

5.2

Separating Data Using the UNSTRING Statement . . . . . . . . . . . . . . . . . .

5–6

5.2.1

Multiple Receiving Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–6

5.2.2

Controlling Moved Data Using the DELIMITED BY Phrase . . . . . . . .

5–8

5.2.2.1

Multiple Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–12

5.2.3

Using the COUNT Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–12

5.2.4

Saving UNSTRING Delimiters Using the DELIMITER Phrase . . . . . .

5–13

5.2.5

Controlling UNSTRING Scanning Using the POINTER Phrase . . . . .

5–14

5.2.6

Counting UNSTRING Receiving Items Using the TALLYING
Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–15

5.2.7

Exiting an UNSTRING Statement Using the OVERFLOW Phrase . . .

5–16

5.2.8

Common UNSTRING Statement Errors . . . . . . . . . . . . . . . . . . . . . . .

5–16

5.3

Examining and Replacing Characters Using the INSPECT Statement . . .

5–17

5.3.1

Using the TALLYING and REPLACING Options of the INSPECT
Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–17

5.3.2

Restricting Data Inspection Using the BEFORE/AFTER Phrase . . . . .

5–18

5.3.3

Implicit Redefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–18

5.3.4

Examining the INSPECT Operation . . . . . . . . . . . . . . . . . . . . . . . . . .

5–21

5.3.4.1

Setting the Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–22

5.3.4.2

Active/Inactive Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–22

5.3.4.3

Finding an Argument Match . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–23

5.3.5

The TALLYING Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–24

5.3.5.1

The Tally Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–24

5.3.5.2

The Tally Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–24

5.3.5.3

The Tally Argument List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–25

5.3.5.4

Interference in Tally Argument Lists . . . . . . . . . . . . . . . . . . . . . . .

5–27

5.3.6

Using the REPLACING Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–30

5.3.6.1

The Search Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–30

5.3.6.2

The Replacement Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–31

5.3.6.3

The Replacement Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–31

5.3.6.4

The Replacement Argument List . . . . . . . . . . . . . . . . . . . . . . . . . .

5–31

5.3.6.5

Interference in Replacement Argument Lists . . . . . . . . . . . . . . . . .

5–32

5.3.7

Using the CONVERTING Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5–33

5.3.8

Common INSPECT Statement Errors . . . . . . . . . . . . . . . . . . . . . . . . .

5–33

vi

Advertising