INSPECT input-string REPLACING ALL char1 BY char2. 复制 使用的参数是 - input-string− 要将其字符从char1 替换为char2 的字符串。 例如 IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-STRING PIC X(15) VALUE 'ABCDACDADEAAAFF'. PROCEDURE DIVISIO...
INSPECT CONVERTING 就是INSPECT REPLACING的缩写。 INSPECT CS CONVERTING "EE" TO "00".也可以加上BEFORE,AFTER。 STRING 将几个字符串合并成一个字符串。 STRING A DELIMITED BY SPACE,"!" DELIMITED BY SIZE INTO C.假设A中的内容是"HELLO",则结果是"HELLO !". DELIMITED BY SPACE意思是碰到空格,或到A...
INTO OUTPUT-LINE. INSPECT OUTPUT-LINE REPLACING ALL "_" BY SPACES. DISPLAY OUTPUT-LINE PAYMENT-OUT. MOVE "OK" TO CALL-FEEDBACK. GOBACK. 子例程 COBVALU *** * COBVALU * * * * A simple subprogram that calculates present value * * for a series of cash flows. * * * *** IDENTIFICAT...
INSPECT REPLACING 用另一个字符串替换这个字符串。 还用上面的例子。 INSPECT CS REPLACING ALL "E" BY "Y". 结果"RYYLWHYYL" INSPECT CS REPLACING CHARACTERS BY "Z" AFTER "L". 结果"REELZZZZZ" INSPECT CS REPLACING LEADING "E" BY "Y". 结果不变 INSPECT CS REPLACING LEADING "E" BY "Z" AF...
对开始数据进行替换:INSPECTSOURCE-STRINGREPLACING LEADING'A' BY 'B'. 对首个字符进行替换:INSPECTSOURCE-STRINGREPLACING FIRST'A' BY 'B'. 5.字符串替换 以原字符串的字符为基础进行格式转换。 a、大小写转换 例: FUNCTION LOWER-CASE(TEST-STRING) TO NEW-STRING. ...
INSPECT TEST-STRING REPLACING LEADING 0 BY '*'. DISPLAY 'AFTER INSPECT :',TEST-STRING. STOP RUN. 该代码执行后,将有如下输出信息。 B 9、EFORE INSPECT :0000567.90 AFTER INSPECT :*567.90 通过以上代码可以发现,使用LEADING选项只是对前缀字符进行了替换。这里的前缀字符是从字符串开头处连续出现的一串字符...
INSPECT A REPLACING ALL ‘X’ BY ‘A’. ·将字符串A中所有的‘X’字符替换成‘A’. 还可以在最后加BEFORE‘X’或AFTER‘X’,即在某一字符前或后的查找或替换。 8、字符串操作语句STRING,UNSTRING a. STRING A, B, C DELIMITED BY SIZE INTO D . ·将字符串A, B, C按它们定义长度连接赋给变量...
INSPECT A REPLACING ALL ‘X’ BY ‘A’. ·将字符串A中所有的‘X’字符用‘A’代替. 连结语句STRING STRING A, B, C DELIMITED BY SIZE INTO D . ·将字符串A, B, C按它们定义长度连接赋给变量D. STRING A, B, C DELIMITED BY SPACE INTO D . ·将字符串A, B, C连接赋给变量D,去掉中间...
格式:COPY库名REPLACING标识符1/常量1/字1BY标识符2/常量2/字2子程序一.概述举例:编一个才T印一行“*”符号的子程序1 .主程序( 35、只写与调用子程序有关的部分)IDENTIFICATIONDIVISION.(标识部)PROGRAM-ID.A.(程序名为A)ENVIRONMENTDIVISION.(环境部)DATADIVISION.(数据部)PROCEDUREDIVISION.(过程部)CALLB....
66 INSPECT RECV-STRING CONVERTING 67 "abcdefghijklmnopqrstuvwxyz" TO 68 "ABCDEFGHIJKLMNOPQRSTUVWXYZ". 69 MOVE "Success" TO LOGMSG-TEXT. 70 PERFORM DO-USERLOG. 71 SET TPSUCCESS TO TRUE. 72 COPY TPRETURN REPLACING 73 DATA-REC BY RECV-STRING. ...