You must be logged in to use the copy button.
**Free ctl-opt copyright('Copyright JAS, Inc. 2024') nomain debug option(*srcstmt : *nodebugio ) ccsid(*char:*jobrun) decedit(*jobrun) alwnull(*usrctl); //*********************************************************************************** // PURPOSE: This application will center the text string in a specified field // ********************************************************************************** // COMPILE Module: CRTRPGMOD MODULE(*CURLIB/JSTEXTC) SRCFILE(*CURLIB/QRPGLESRC) // SRCMBR(JSTEXTC) DBGVIEW(*SOURCE) REPLACE(*YES) // COMPILE SrvPgm: CRTSRVPGM SRVPGM(*CURLIB/JSTEXTC) EXPORT(*ALL) ACTGRP(*CALLER) // Bindding Dir: ADDBNDDIRE BNDDIR(JASTOOL) OBJ((JSTEXTC)) // ********************************************************************************** /Define CenterTxt_pr /copy qProtoSrc,jsTextc //********************************************************************** // Center Text //********************************************************************** Dcl-proc CenterTxt export; /Define CenterTxt_pi /copy qProtoSrc,jsTextc dcl-s w_Pos Packed(5:0) inz; dcl-s CenterTxt char(1024) inz; if %len(%Trim(p_Text)) > 1; w_Pos = (p_Len - %len(%trim(p_Text))) / 2 + 1 ; %subst(CenterTxt :w_Pos) = %trim(p_Text); else; CenterTxt = p_Text; endif; Return CenterTxt; end-proc;