| IBM MAINFRAME HELP & SUPPORT FORUMS Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
|
| View previous topic :: View next topic |
| Author |
Message |
bnrinbox
Joined: 15 Feb 2005
Posts: 1
|
| Posted: Fri Apr 28, 2006 4:40 pm Post subject: Any built in function to find out spl char used or not |
|
|
As per my requirement i have to check any spl char used as data or not in a string. Is there any built-in function available? Please let me know. If no builtin function available, let me know, how to find through code?
Thanks alot |
|
| Back to top |
|
ravi1
Joined: 27 Apr 2006
Posts: 7
|
| Posted: Wed May 03, 2006 7:00 pm Post subject: Re: Any built in function to find out spl char used or not |
|
|
bnrinbox wrote: As per my requirement i have to check any spl char used as data or not in a string. Is there any built-in function available? Please let me know. If no builtin function available, let me know, how to find through code?
Thanks alot
I think You can find the special character in a string using INDEX function.
DCL DATA1 BIN(31,0) INIT(0);
DCL STRING1 CHAR(10);
STRING1 = 'ADCF@EFGHI';
DATA1 = INDEX(STRING1,'@');
IF DATA1 = 0
THEN PUT SKIP LIST('SPECIAL CHARACTER NOT FOUND');
PUT SKIP LIST('DATA1:', DATA1);
HERE DATA1 WILL RETURN '5' SINCE @ IS PRESENT IN THE 5TH POSITION OF THE STRING. |
|
| Back to top |
|
k_vikram07
Joined: 23 Nov 2005
Posts: 34
|
| Posted: Fri Jun 09, 2006 5:22 pm Post subject: |
|
|
YOu can use VERIFY to check the existance of SPL characters.
DCL specialchar char(12) INIT('!@#$%^&*()_+}{|":?><');
DCL input CHAR(15);
IF VERIFY(input,specialchar) = 0
THEN /* there is no special character in input variable*/;
ELSE
/* special character used */;
You can include any character, you think is special, in the init of the specialchar variable. See usage of VERIFY for more info.
-Vik. |
|
| Back to top |
|
k_vikram07
Joined: 23 Nov 2005
Posts: 34
|
| Posted: Fri Jun 09, 2006 5:24 pm Post subject: |
|
|
Sorry, the function is SEARCH not VERIFY.
-Vik |
|
| Back to top |
|
| |
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
|