美文网首页
Cobol接收命令行参数

Cobol接收命令行参数

作者: CodingCode | 来源:发表于2023-05-12 06:25 被阅读0次
    $ 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.
    

    相关文章

      网友评论

          本文标题:Cobol接收命令行参数

          本文链接:https://www.haomeiwen.com/subject/khjesdtx.html