zoukankan      html  css  js  c++  java
  • 在CL中使用SST或者SUBSTRING

    The substring built-in function (%SUBSTRING or%SST) produces a character string
    that is a subset of an existing character string and can only be used within a CL
    procedure. In a CHGVAR command, the %SST function can be specified in place of
    the variable (VAR parameter) to be changed or the value (VALUE parameter) to
    which the variable is to be changed. In an IF command, the %SST function can be
    specified in the expression.
    The format of the substring built-in function is:
    %SUBSTRING(character-variable-name starting-position length)
    or
    %SST(character-variable-name starting-position length)


    The following are examples of the substring built-in function:
    If the first two positions in the character variable &NAME are IN, the program
    INV210 is called. The entire value of &NAME is passed to INV210 and the value
    of &ERRCODE is unchanged. Otherwise, the value of &ERRCODE is set to 99.

    DCL &NAME *CHAR VALUE(INVOICE)
    DCL &ERRCODE *DEC (2 0)
    IF (%SST(&NAME 1 2) *EQ 扞N? +
    THEN(CALL INV210 &NAME)
    ELSE CHGVAR &ERRCODE 99

    If the first two positions of &A match the first two positions of &B, the program
    CUS210 is called.

    DCL &A *CHAR VALUE(ABC)
    DCL &B *CHAR VALUE(DEF)
    IF (%SST(&A 1 2) *EQ %SUBSTRING(&B 1 2)) +
    CALL CUS210

    Position and length can also be variables: This example changes the value of &X
    beginning at position &Y for the length &Z to 123.

    CHGVAR %SST(&X &Y &Z) 

    If &A is ABCDEFG before this CHGVAR command is run, &A is

    CHGVAR %SST(&A 2 3) 

  • 相关阅读:
    Bzoj 3654 图样图森波 题解
    1.27号考试记录
    博弈论入门小结
    「考试总结」2020-11-18 爆零
    「补题」考试题泛做
    CSP2020 游记,总结与题解
    Luogu2827 「NOIP2016」 蚯蚓
    【学习笔记】四毛子算法
    「考试反思」2020-11-04 临行
    「考试反思」2020-10-31 警示
  • 原文地址:https://www.cnblogs.com/wildfish/p/1031861.html
Copyright © 2011-2022 走看看