用cobol如何计算一个文章的字符数?

2024-12-21 16:11:56
推荐回答(1个)
回答1:

哈哈,选我吧!这是一个计算变量长度的子程序。
你拿去参考参考,估计可以改的出来计算文章的字符数的程序。
000100IDENTIFICATIONDIVISION.00010000
000300PROGRAM-ID.STRLEN.00030000
000500ENVIRONMENTDIVISION.00050000
000700DATADIVISION.00070000
000900WORKING-STORAGESECTION.00090000
00110001SWITCH.00110000
00130005LENGTH-DETERMINED-SWPICXVALUE'N'.00130000
00140088LENGTH-DETERMINEDVALUE'Y'.00140002
001600LINKAGESECTION.00160000
00180001TEXT-LENGTHPICS9(4)COMP.00180000
00200001WORK-TABLE.00200000
00220005WT-CHARACTEROCCURS1TO254TIMES00220000
002300DEPENDINGONTEXT-LENGTH00230000
002400PICX.00240000
002600PROCEDUREDIVISIONUSINGTEXT-LENGTH00260000
002700WORK-TABLE.00270000
002900000-DETERMINE-STRING-LENGTH.00290000
003100MOVE'N'TOLENGTH-DETERMINED-SW.00310000
003200PERFORM100-EXAMINE-LAST-CHARACTER00320000
003300UNTILLENGTH-DETERMINED.00330000
003700EXITPROGRAM.00370000
003900100-EXAMINE-LAST-CHARACTER.00390000
004100IFWT-CHARACTER(TEXT-LENGTH)=SPACE00410000
004200SUBTRACT1FROMTEXT-LENGTH00420000
004300ELSE00430000
004400MOVE'Y'TOLENGTH-DETERMINED-SW.00440000
004500IFTEXT-LENGTH=000450000
004600MOVE'Y'TOLENGTH-DETERMINED-SW.00460000