Home page  
Help >
ddlCalc() - single CALC/SET/IF function
Version 7.11
ddlCalc() - single CALC/SET/IF function
ddlCalc() - single CALC/SET/IF function

Prototype:
   void ddlCalc(
      CONTROL *ctl,
      char *OptnStr,
      char *ArgList);

Description:
The ddlCalc() API function encapsulates eleven CALC-related functions.

CALC, SET, IF, WHILE are analogues of the respective ddlCreateCalcObject() statements: CALC, SET, IF, WHILE,

In addition, number valued functions that can be used by CALC are described in the CALC document. String valued functions that can be used by SET are described in the SET document.

UNCALC, UNSET, VLIST, SUB, SUBSTITUTE, INC are extrapolations of the respective Thunderbolt RAD DCL commands: UNCALC, UNSET, VLIST, SUB or SUBSTITUTE, INC.

VALUEOF is a newly minted function that performs variable substitution in strings.


Summary of ddlCalc() sub-functions:
Function Form of OptnStr Form of ArgList
CALC NA %Var = <expression>
CALC %Var = <expression>
SET NA SET %Var = <expression>
IF NA IF <expression>
WHILE NA WHILE <expression>
INC NA INC %Var
SUB or SUBSTITUTE /A - all occurrences
/U - ignore case
SUB %Var /v1Old/v1New/ /v2Old/v2New/ ...
UNCALC /Z - also UNCALC super-globals UNCALC [<var-list>]
UNSET /Z - also UNSET super-globals UNSET [<var-list>]
VALUEOF NA VALUEOF <command>
VLIST NA VLIST

In this context, the CALC/SET/IF <expression> may contain global variables (variables that begin with '%'), super global variables (variables that begin with '%%'), numeric constants and string constants. It may not contain local variables (variables that do not begin with '%') or field names.

<expression> may also contain special system variables. One class of system variables correspond to the values that were returned by the previous API function. For all API functions except ddlCalc(), when a function terminates, the relevant CONTROL structure members are captured to the API context. The ddlCalc() API function is excepted since it is used for capturing and testing these variables.


System Variables:
All system variables are string variables. In the case where a system variable corresponds to a numeric value, the system variable contains the ascii decimal encoded value.

The mapping for the CONTROL structure members is:
%Status control.Status
%Warning control.Warning
%Answer control.Ans1str; or control.Ans1 if control.Ans1str is null 
%Answer1 control.Ans1str; or control.Ans1 if control.Ans1str is null 
%Answer2 control.Ans2str; or control.Ans2 if control.Ans2str is null 
%Answer3 control.Ans3str; or control.Ans3 if control.Ans3str is null 
%Answer1num control.Ans1
%Answer2num control.Ans2
%Answer3num control.Ans3
%Answer1str control.Ans1str
%Answer2str control.Ans2str
%Answer3str control.Ans3str
%Answer1L control.Ans1L
%Answer2L control.Ans2L
%Answer3L control.Ans3L
%Answer4L control.Ans4L
%Answer5L control.Ans5L
%Answer6L control.Ans6L

There are additional system variables that do not correspond to CONTROL structure members.
%LastCommand the previous API command as <ddlXxx> [/<options>] [<command-string>]  
%Level Calc-Object only; hierarchical level of the current frame
%Null always SQL null
%Timing elapsed time for previous function; hh:mm:ss.tt
%USN user ID for current data base

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.