The following system constants are available at compile time. These can be useful in creating conditional code.
Examples:
// Any modules referenced inside the condition must be declared outside of the condition // This will avoid syntax errors prod_thor_dali := _Control.IPAddress.prod_thor_dali; #IF(_TARGET_PLATFORM_ in ['thorlcr']) OUTPUT('thor'); prod_thor_dali; #ELSE OUTPUT('not thor'); #END //Second example IMPORT STD; STRING14 fGetDateTimeString() := #IF(__ECL_VERSION_MAJOR__ > 5) or ((__ECL_VERSION_MAJOR__ = 5) AND (__ECL_VERSION_MINOR__ >= 2)) STD.Date.SecondsToString(STD.Date.CurrentSeconds(true), '%Y%m%d%H%M%S'); #ELSE FUNCTION string14 fGetDimeTime():= // 14 characters returned BEGINC++ #option action struct tm localt; // localtime in "tm" structure time_t timeinsecs; // variable to store time in secs time(&timeinsecs); localtime_r(&timeinsecs,&localt); char temp[15]; strftime(temp , 15, "%Y%m%d%H%M%S", &localt); // Formats the localtime to YYYYMMDDhhmmss strncpy(__result, temp, 14); ENDC++; RETURN fGetDimeTime(); END; #END; // Example using __CONTAINERIZED__ over := 'overwrite=1 '; repl := 'replicate=1 '; action := 'action=spray '; srcplane :='srcplane=mydropzone '; srcfile := 'srcfile=originalperson '; dstname:='dstname=JD::originalperson ' ; //dstcluster:= 'dstcluster=data '; // for containerized //dstcluster:= 'dstcluster=mythor '; // for bare-metal dstcluster := IF(__CONTAINERIZED__, 'dstcluster=data ','dstcluster=mythor '); fmt:= 'format=fixed '; recsize:='recordsize=124 '; cmd := over + repl + action + srcplane + srcfile + dstname + dstcluster + fmt + recsize; STD.File.DfuPlusExec(cmd);
Runtime Expressions
The following system constants are evaluated at runtime. Technically, these are runtime expressions, not constants. Therefore, they cannot be used in conditional code that requires a constant.