|
midrange-l-request@xxxxxxxxxxxx wrote: > 8. Any way in the CL program to find the length of the character > data stored in a variable? (Siva) > >Is there any way in the CL program to find the length of the character data >stored in a variable? > >I find there is no direct CL command to acheive this... may be some roundabout >way there to do this... but nothing striking at this moment.... > > i think of some prgm calls with the required variable as the parm and the > receiviong prgm process the variable etc... but couldnt get any logic here > :-)...... Siva: Create this CL program: *----begin pgm ( + &Value + &Len + ) dcl &Value *char 3002 dcl &Len *dec ( 5 0 ) chgvar &Len %bin( &Value 1 2 ) return endpgm *----end Now create this command using the CL program as the command-processing program: *----begin RTNLEN: CMD PROMPT('Return LEN of a value') PARM KWD(VALUE) TYPE(*CHAR) LEN(3000) MIN(1) + EXPR(*YES) VARY(*YES) PROMPT('Value to + measure') PARM KWD(LEN) TYPE(*DEC) LEN(5 0) RTNVAL(*YES) + MIN(1) CHOICE('Variable name (*DEC 5,0)') + PROMPT('Returned length') *----end You will then have a RTNLEN command that will return the length of any *CHAR variable up to 3000 in length. The length will be returned as a *DEC (5 0) value. All done in CL and it works well. Tom Liotta -- Tom Liotta The PowerTech Group, Inc. 19426 68th Avenue South Kent, WA 98032 Phone 253-872-7788 x313 Fax 253-872-7904 http://www.powertech.com __________________________________________________________________ Switch to Netscape Internet Service. As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.