Difference between revisions of "Add List Delimiter"
From MidrangeWiki
DaveLClarkI (talk | contribs) (→Service Procedure) |
DaveLClarkI (talk | contribs) (→Service Procedure) |
||
Line 28: | Line 28: | ||
**free | **free | ||
ctl-opt NoMain AlwNull(*UsrCtl) Debug Option(*SrcStmt:*NoDebugIo) | ctl-opt NoMain AlwNull(*UsrCtl) Debug Option(*SrcStmt:*NoDebugIo) | ||
− | DatFmt(*ISO) TimFmt(*ISO | + | DatFmt(*ISO) TimFmt(*ISO); |
//============================================================================== | //============================================================================== |
Revision as of 16:47, 14 December 2018
Summary
The following are the RPG/LE fully free-form definitions and instructions needed for using the Add List Delimiter service procedure. This service procedure simply allows the caller to conditionally add a delimiter string to another (or "master") character string when the master character string has a length greater than zero (meaning: it already has content in it).
Service Prototype
Place the following in a separate copybook for inclusion in both the caller and the service program source members.
**free //============================================================================== // If the supplied variable-length string (or list) has a length greater than // zero, then this procedure adds the supplied delimiter to the end of that // string on return. Otherwise, the string is returned unchanged. // This can also be used, for example, for dynamically building command (or SQL) // character strings that have conditional content without having to know // whether the built string already has content--or not. //============================================================================== dcl-pr GenUtl_AddListDelimiter varchar(65530) rtnparm; pList varchar(65530) const; pDelimiter varchar(30) const; end-pr;
Service Procedure
Place the following in a service program source member.
**free ctl-opt NoMain AlwNull(*UsrCtl) Debug Option(*SrcStmt:*NoDebugIo) DatFmt(*ISO) TimFmt(*ISO); //============================================================================== // If the supplied variable-length string (or list) has a length greater than // zero, then this procedure adds the supplied delimiter to the end of that // string on return. Otherwise, the string is returned unchanged. // This can also be used, for example, for dynamically building command (or SQL) // character strings that have conditional content without having to know // whether the built string already has content--or not. //============================================================================== dcl-proc GenUtl_AddListDelimiter export; dcl-pi *n varchar(65530) rtnparm; pList varchar(65530) const; pDelimiter varchar(30) const; end-pi; if %len(pList) <= *zero; // if list is empty return pList; // return unchanged list endif; return (pList + pDelimiter); // return resulting list end-proc;