我嘗試使用單獨的字母在Cobol中創建一個字符串。直到我嘗試插入 空間,一切正常。你有什麼想法,我如何創建e.x.字符串如何將空格與字母組合
" ee ee"
?
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 S1 PIC X(10).
PROCEDURE DIVISION.
MAIN-PARAGRAPH.
Perform InsertSpace 2 Times
Perform InsertE 2 Times
Perform InsertSpace 2 Times
Perform InsertE 2 Times
Display S1
* expectation " ee ee"
End-Main
InsertE Section
STRING S1 DELIMITED BY SPACE
'e' DELIMITED BY SIZE
INTO S1
END-STRING
InsertSpace Section
STRING S1 DELIMITED BY SPACE
' ' DELIMITED BY SIZE
INTO S1
END-STRING
您可能還想嘗試初始化s1以空格。它一開始可能會有十六進制零。另外什麼是輸出 –
GNU Cobol增加了一個擴展內部的'FUNCTION CONCATENATE()',這在運行時建立字符串時非常方便。這不是一個答案,只是一個評論。 –