用错了,不能够用LEADING,LEADING是指的第一个字母为W,如果不是就不算 你可以去查一下那本cobol的Enterprise COBOL for zOS Language Reference Version 3 Release 4 一般要从开头查找都这样用 INSPECT CS TALLYING COUNT-0 FOR ALL 'W'.如果要定位的话 比如从第一个出现的E后面开...
其TALLYING 子句中有多个比较数的 INSPECT TALLYING 语句的建模导致方法 InspectTallyingClause.getComparands() 返回不正确结果。该方法应该返回包含多个对象的列表,第一个为 InspectTallyingLeading 对象,第二个为 InspectTallyingAll 对象。该方法反而返回包含单个 InspectTallyingLeading 对象的列表。
INSPECT AA TALLYING BB FOR CHARACTERS AFTER “C” BEFORE “E”. 从AA中查找C后面E前面有多少个字符,将个数写入BB。 INSPECT AA TALLYING BB FOR LEADING “E”. 从AA中第一个字符开始查找有多少个E,如果没有就结束操作,有就将个数写入BB,直至没有。 INSPECT AA TALLYING BB FOR LEADING “E” AFTE...
INSPECT SOURCE-STRING REPLACING FIRST '*' BY '$'. DISPLAY 'AFTER INSPECT:'SOURCE-STRING. STOP RUN. 对全体数据进行替换:INSPECTSOURCE-STRINGREPLACING ALL'A' BY 'B'. 对开始数据进行替换:INSPECTSOURCE-STRINGREPLACING LEADING'A' BY 'B'. 对首个字符进行替换:INSPECTSOURCE-STRINGREPLACING FIRST'A' B...
DISPLAY 'BEFORE INSPECT :',TEST-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 INPUT-STRING TALLYING WS-COUNTER FOR LEADING SPACES BEFORE INITIAL 'H'. INSPECT INPUT-STRING TALLYING WS-COUNTER FOR TRAILING SPACES AFTER INITIAL 'D'. MOVE INPUT-STRING(WS-COUNTER:LENGTH OF INPUT-STRING-WS-COUNTER) TO OUTPUT-STRING. DISPLAY 'After removing spaces: ' OUTPUT-STRING. ...
INSPECT TEST-STRING REPLACING LEADING 0 BY '*'. DISPLAY 'AFTER INSPECT :',TEST-STRING. STOP RUN. 该代码执行后,将有如下输出信息。 BEFORE INSPECT :0000567.90 AFTER INSPECT :***567.90 通过以上代码可以发现,使用LEADING选项只是对前缀字符进行了替换。这里的前缀字符是从字符串开头处连续出现的一串字符。...
INSPECT REPLACING 用另一个字符串替换这个字符串。CS 为"REELWHEEL"还用上面的例子。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 ...
1>INSPECT/TALLYING语句 INSPECT A TALLYING TLY FOR ALL“A” 对指定字符串的所有出现进行计数,即数据项中每出现一个指定的字符串,计数器就加1 INSPECT A TALLYING TLY FOR LEADING“*” 对指定字符串作为前缀进行计数,计算数据项中从第一个字符开始连续出现多少指定的字符串。 INSPECT A TALLYING FLY FOR ...
INSPECTAATALLYINGBBFORCHARACTERSAFTER“C”BEFORE“E”.从AA中查找C后面E前面有多少个字符,将个数写入BB。INSPECTAATALLYINGBBFORLEADING“E”.从AA中第一个字符开始查找有多少个E,如果没有就结束操作,有就将个数写入BB,直至没有。INSPECTAATALLYINGBBFORLEADING“E”AFTER“C”....