Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WORDPOS

0 views
Skip to first unread message

João Luís Matos Carvalho (DSI)

unread,
Aug 13, 2008, 6:56:53 AM8/13/08
to
Hello list,

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

Grant Ward Able

unread,
Aug 13, 2008, 7:00:07 AM8/13/08
to
You can use POS instead of WORDPOS.

--
Regards - Grant
=====================================
Note: Any opinion expressed is my own






João Luís Matos Carvalho (DSI) <joao.mato...@CAIXASEGUROS.PT>
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
13/08/2008 11:56
Please respond to
TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>


To
TSO-...@VM.MARIST.EDU
cc

Subject
[TSO-REXX] WORDPOS
-----------------------------------------
________________________________________________________
DTCC DISCLAIMER: This email and any files transmitted with it are
confidential and intended solely for the use of the individual or
entity to whom they are addressed. If you have received this email
in error, please notify us immediately and delete the email and any
attachments from your system. The recipient should check this email
and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted
by this email.

Lindy Mayfield

unread,
Aug 13, 2008, 7:02:57 AM8/13/08
to
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.

Say POS("TTG","XPTO DDSSSD TTG000124")

13

Stocker, Herman

unread,
Aug 13, 2008, 7:05:03 AM8/13/08
to
Xx = POS("TTG") xx will have the position


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.

João Luís Matos Carvalho (DSI)

unread,
Aug 13, 2008, 7:32:44 AM8/13/08
to
Thank's list for the help !

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

Cruz, Robert

unread,
Aug 13, 2008, 12:25:43 PM8/13/08
to
There is an important distinction here which has not been pointed out.

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.
--------------------------------------------------------

Hamilton, Robert L

unread,
Aug 13, 2008, 1:04:25 PM8/13/08
to
Kilowatt software has a good REXX tutorial
bobh

Bob Bridges

unread,
Aug 14, 2008, 4:48:49 PM8/14/08
to
Absolutely! I now judge other function documentation by that standard.

---
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?

0 new messages