COBOL really you need ideas to modify strings

The below are the selected examples for INSPECT replacing and INSPECT converting. Total I have given 3 examples.

Example for Replacing Single Letter:

77 COUNTR PIC 9 VALUE ZERO.
01 DATA-2 PIC X(11).
. . .
INSPECT DATA-2
TALLYING COUNTR FOR LEADING “0”
REPLACING FIRST “A” BY “2” AFTER INITIAL “C”

Example for Replacing Multiple Chars

77 COUNTR PIC 9 VALUE ZERO.
01 DATA-3 PIC X(8).
. . .
INSPECT DATA-3
REPLACING CHARACTERS BY ZEROS BEFORE INITIAL QUOTE

Example for INSPECT Converting:

1 DATA-4 PIC X(11).
. . .
INSPECT DATA-4
CONVERTING
“abcdefghijklmnopqrstuvwxyz” TO
“ABCDEFGHIJKLMNOPQRSTUVWXYZ”
AFTER INITIAL “/”
BEFORE INITIAL”?”

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.