Use SST or substring IN Cl

Source: Internet
Author: User
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
The variable (VaR parameter) to be changed or the value (value parameter)
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 limit 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 & zto 123.

Chgvar % SST (& X & Y & Z)

If & A is abcdefg before this chgvar command is run, & A is

Chgvar % SST (& A 2 3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.