Home page  
Help >
DDL Command INC
Version 7.11
DDL Command INC INC

The INC (increment) command is used in procedures or in report definitions to add one (1) to the current value of a string variable.

Syntax:
INC %variable

Notation standards Options Answers

Options:
X -Suppress the command response
Y -Do not alter the command answer cells

Answers:
Ctl.Ans1 =Zero
Ctl.Ans2 =Zero
Ctl.Ans3 =Zero

Notes:
Numeric variables are created by the CALC command. To increment a numeric variable, use the CALC command, for example: CALC %x = %x + 1

String variables are created by all of the other commands that create variables, such as SET, FETCH, PROMPT, etc. String variables that have numeric value in the low-order positions can be incremented with the INC command, for example:
INC %xx
increments the value in the string variable %XX by one.

At least the last position of the string variable must be numeric. For instance
SET %xxx = 'AAA3'
INC %xxx

The SET establishes the value in %xxx as AAA3. The INC increments it, so the new value is AAA4.

If you expect the increment to carry over to the adjacent column, then at least the last two characters in the string variable must be numeric, and so on.
AAAA9 does not increment to 10
AAAA09 does increment to 10

You can initialize a string variable with all numeric characters, such as:

SET %xx = '0000'

this can be incremented up to the value 9999.

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.