$ cat TESTCMDLINE.cbl
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTCMDLINE.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 SEND-STRING PIC X(50) VALUE SPACES.
01 RECV-STRING PIC X(50) VALUE SPACES.
LINKAGE SECTION.
01 CMD-PARAM.
03 CMD-LENGTH PIC 9(4) COMP.
03 CMD-LINE.
05 CMD-CHAR PIC X OCCURS 1 TO 50
DEPENDING ON CMD-LENGTH.
******************************************************
* Start program with command line args
******************************************************
PROCEDURE DIVISION USING CMD-PARAM.
DISPLAY "CMD-LINE:[" CMD-LENGTH "]=[" CMD-LINE "]".
MOVE CMD-LINE TO SEND-STRING.
DISPLAY "SEND-STRING=[" SEND-STRING "]".
STOP RUN.
网友评论