Subprocedures that return a value can be used as the based-on variable in a like() definition. If the linter option "RequiresParameter" is set to true, the linter will flag these declarations as needing to have the parentheses after the subprocedure name. When referencing a subprocedure in a like() declaration, one cannot include the parentheses after the name.
For example:
**FREE
ctl-opt dftactgrp(*NO);
// If RequiresParameter is enabled, the following line will be flagged with "Procedure calls require brackets.".
dcl-s myValue like(getSomeValue);
// !! The following is not valid syntax and will not compile:
// !! dcl-s myValue like(getSomeValue()); // Invalid syntax; will not compile
myValue = getSomeValue();
*inLR = *ON;
return;
dcl-proc getSomeValue;
dcl-pi *N varchar(10);
end-pi;
return %char(%date(): *ISO);
end-proc;
Note:
Technically, while I dislike the name, these are subprocedures not procedures. In addition, I am may be straying into UK vs US English, but () are parentheses, not brackets ... at least in US English ... I think UK may also call parentheses "round brackets" and brackets "square brackets".
I am running the latest version of VS Code on an up-to-date Windows 11 Pro 64-bit system. The Code for IBM i version is v2.0.2 and the RPGLE extension is v0.20.2.
Subprocedures that return a value can be used as the based-on variable in a
like()
definition. If the linter option "RequiresParameter" is set to true, the linter will flag these declarations as needing to have the parentheses after the subprocedure name. When referencing a subprocedure in alike()
declaration, one cannot include the parentheses after the name.For example:
Note: Technically, while I dislike the name, these are subprocedures not procedures. In addition, I am may be straying into UK vs US English, but
()
are parentheses, not brackets ... at least in US English ... I think UK may also call parentheses "round brackets" and brackets "square brackets".I am running the latest version of VS Code on an up-to-date Windows 11 Pro 64-bit system. The Code for IBM i version is v2.0.2 and the RPGLE extension is v0.20.2.