SCAN (scan a variable field)
SCAN scans a variable and edits it.
Syntax
SCAN &Vn {REMOVING|REPLACING}
{LEADING|ALL}
{BLANK|NULL|c}
[WITH|[{BLANK|NULL|c}]]
{LEADING|ALL}
{BLANK|NULL|c}
[WITH|[{BLANK|NULL|c}]]
where
- &Vn is the name of a defined variable that contains the target data to be edited.
- REMOVING | REPLACING indicates the editing to be performed on the data of the target variable.
- LEADING | ALL edits the leading or trailing data to one byte or all the data as indicated.
- WITH must be used if REPLACING is specified.
- BLANK specifies blank characters.
- NULL specifies null characters.
- c represents any alphanumeric characters.
Example
SET BB = '&vbarSELECT TYPE CC RECORDS FROM CMRSTATS
WHERE CMRDATE = '09/17/1998'
SET Y = T6FTRNCT / 5
SET Y = Y + 1
IF Y > THEN 51 THEN SET Y = 52
SCAN &Y REMOVING LEADING 0
SET &X = BB(1:&Y)
USING CMRDATE CMRTIME T6FTRNCT X
REPORT
END
WHERE CMRDATE = '09/17/1998'
SET Y = T6FTRNCT / 5
SET Y = Y + 1
IF Y > THEN 51 THEN SET Y = 52
SCAN &Y REMOVING LEADING 0
SET &X = BB(1:&Y)
USING CMRDATE CMRTIME T6FTRNCT X
REPORT
END
Related topic
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*