The WORDPOS function return the Word number in a string. My question is that exists or anyone knows a function that returns a substring position.
An Example:
For the following string "XPTO DDSSSD TTG000124", is there a function that returns the position of the substring "TTG". In this case position 13.
Thank´s in advance
Atenciosamente,
João Carvalho
DSI-DSTS-DST-TAG
* - mailto:joao.mato...@caixaseguros.pt <mailto:joao.mato...@caixaseguros.pt>
' - 670701
"A mente é como um pára-quedas, só funciona se estiver aberta"
(Thomas Dewar)
P Antes de imprimir este e-mail pense bem se tem mesmo que o fazer. Há cada vez menos árvores
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
Try POS
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A370/4.3.44
Gotta love that Needle in a Haystack. You'll remember it till your dying days.
Say POS("TTG","XPTO DDSSSD TTG000124")
13
Regards,
Herman Stocker
<----- snip on -------->
The WORDPOS function return the Word number in a string. My question is that
exists or anyone knows a function that returns a substring position.
An Example:
For the following string "XPTO DDSSSD TTG000124", is there a function that
returns the position of the substring "TTG". In this case position 13.
<------ snip off ------->
The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent. This message and
its attachments could have been infected during transmission. By reading the
message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects. The sender's employer is not liable for any loss or damage
arising in any way from this message or its attachments.
Atenciosamente,
João Carvalho
DSI-DSTS-DST-TAG
* - mailto:joao.mato...@caixaseguros.pt
"A mente é como um pára-quedas, só funciona se estiver aberta"
(Thomas Dewar)
P Antes de imprimir este e-mail pense bem se tem mesmo que o fazer. Há cada vez menos árvores
If you want the word-number of a word (or sequence of words) in a blank-delimited list of words, use WORDPOS.
For example: WORDPOS( 'JOHNS', 'JOHNSON JOHNS' ) returns 2
If you want the character position of a string of characters within another string, use POS.
For example: POS( 'JOHNS', 'JOHNSON JOHNS' ) returns 1
In the example above, POS( 'JOHNS', 'JOHNSON JOHNS' ) returns 1, which is NOT the position of the *word* "JOHNS". There are other important differences as well. For example:
WORDPOS( 'JACK BLACK', 'JIM JOHN JACK BLACK WHITE' ) returns 3, whereas:
POS( 'JACK BLACK', 'JIM JOHN JACK BLACK WHITE' ) returns 0
If you want the *character* position of a blank-delmited *word* (or sequence of words), you must use:
WORDINDEX( haystack, WORDPOS( needle, haystack ) )
For example: WORDINDEX( 'JOHNSON JOHNS', WORDPOS( 'JOHNS', 'JOHNSON JOHNS' ) ) returns 9, and
haystack = 'JIM JOHN JACK BLACK WHITE'
needle = 'JACK BLACK'
WORDINDEX( haystack, WORDPOS( needle, haystack ) ) returns 12
WORDINDEX is a little-used function, but there is no simple way to replace it.
BTW, the INDEX and FIND functions are no longer recommended; use POS and WORDPOS instead (the INDEX and FIND functions are non-SAA and not portable).
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of João Luís Matos Carvalho (DSI)
Atenciosamente,
João Carvalho
An Example:
--------------------------------------------------------
The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. The McGraw-Hill Companies, Inc. reserves the right, subject to applicable local law, to monitor and review the content of any electronic message or information sent to or from McGraw-Hill employee e-mail addresses without informing the sender or recipient of the message.
--------------------------------------------------------
---
Bob Bridges, rhb...@attglobal.net
cell 336 382-7313
/* Silence promotes the presence of God, prevents many harsh and proud
words, and suppresses many dangers in the way of ridiculing or harshly
judging our neighbors....If you are faithful in keeping silence when it is
not necessary to speak, God will preserve you from evil when it is right
for you to talk. -Francois Fenelon (1651-1715) */
-----Original Message-----
From: Lindy Mayfield
Sent: Wednesday, August 13, 2008 07:03
I just happened to have the TSO docs open. Try POS
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A370/4.3.44
Gotta love that Needle in a Haystack. You'll remember it till your dying
days.
-----Original Message-----
From: João Luís Matos Carvalho (DSI)
Sent: 13. elokuuta 2008 13:57
The WORDPOS function return the Word number in a string. My question is
whether anyone knows of a function that returns a substring position.
An example: For the string "XPTO DDSSSD TTG000124", is there a function
that returns the position of the substring "TTG"? in this case position 13?