今天继续学习大型机cobol语言基础。
本次内容在第五章。
使用UNSTRING语句拆分字符串。
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FULL-NAME PIC X(20)
VALUE ‘ADAM SMITH’.
01 LAST-NAME PIC X(10).
01 FIRST-NAME PIC X(10).
*
PROCEDURE DIVISION.
UNSTRING FULL-NAME
DELIMITED BY ‘ ‘
INTO FIRST-NAME
LAST-NAME.
DISPLAY ‘FULL NAME:’,FULL-NAME.
DISPLAY ‘FIRST-NAME:’,FIRST-NAME.
DISPLAY ‘LAST-NAME:’,LAST-NAME.
STOP RUN.