× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I couldn't agree more! If the average RPGer can't understand a relatively simple REGEX then maybe it's time to learn some new skills? Imagine visiting a doctor who qualified 30 years ago and never read another medical journal in their life! I realise you're not in this category Jon, but I don't understand why in so many IBM i places you're expected to code to lowest common denominator, who typically can't be bothered to keep their skills up to date.

Tim.

________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
Sent: 31 July 2020 19:03
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: How to get the dollar value from this text string?

Still a lot less intuitive for the average RPGer that a %ScanR and %Subst though.
Old school RPGer, young programmers (independent of whether they are RPGer or not) all know SQL and Regular Expressions 😉

Also: LOCATE_IN_STRING is the equivalent of %SCAN/%SCANR
Also the equivalent for %Trim is TRIM, the equivalent for %TrimR is RTRIM and for %TrimL is LTRIM.
And the equvalent for %Subst is SUBSTR.
... and RPG does not support Regular Expressions (directly).
So where is your problem?

Is this easier to read?
NumValue = %Dec(%TrimR(%Subst(CharValue, %ScanR(CharValue, '/') + 1), ' ~'), 11, 0);

Mit freundlichen Grüßen / Best regards

Birgitta Hauser


"Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them and keeping them!"
„Train people well enough so they can leave, treat them well enough so they don't want to.“ (Richard Branson)


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Freitag, 31. Juli 2020 16:25
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: How to get the dollar value from this text string?

Still a lot less intuitive for the average RPGer that a %ScanR and %Subst though.


On Jul 31, 2020, at 3:54 AM, Niels Liisberg <nli@xxxxxxxxxxxxxxxxx> wrote:

Agreed Jon, I think I will challenge Birgita on that one:

Here i my one-liner solution: Remove any characters until the last
blank, Picup the number and remove the filal ~

**free

dcl-s instr varchar(256);

dcl-s dolar packed( 15: 2);



inStr = 'NTE*OTH*#OH- HANDLING CHARGES GSYE9R03/WHT/ / 4T/-
2.29~';

exec sql values rtrim(regexp_replace (:instr, '.* '),'~')
into :dolar;


return;




On Thu, Jul 30, 2020 at 4:33 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:

OMG that is UGLY!


On Jul 30, 2020, at 1:56 AM, Birgitta Hauser
<Hauser@xxxxxxxxxxxxxxx>
wrote:

The following SQL-Statement should return the numbers only:
Select Dec(RegexP_Replace(Substr(Text,Locate_In_String(Text, '/',
-1) +
1),
'[\s^~]', ''), 11, 2),
Text
from
(Values('NTE*OTH*#F7- PST/SALES TAX GAZE9H01/MNT/ / 6/- 1,23~'),
('NTE*OTH*#F7- PST/SALES TAX GSYE9R03/WHT/ / 4T/- 1,22~'),
('NTE*OTH*#OH- HANDLING CHARGES GAZE9H01/MNT/ / 6/- 3,36~'),
('NTE*OTH*#OH- HANDLING CHARGES GSYE9R03/WHT/ / 4T/- 2,29~')) x
(Text);

Mit freundlichen Grüßen / Best regards

Birgitta Hauser


"Shoot for the moon, even if you miss, you'll land among the stars."
(Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not
training
them
and keeping them!"
„Train people well enough so they can leave, treat them well enough
so
they
don't want to.“ (Richard Branson)


-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf
Of
Kevin
Bucknum
Sent: Mittwoch, 29. Juli 2020 20:04
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: How to get the dollar value from this text string?

If you do have regex setup and working from sql on your box, then
this little quick and dirty program extracts everything after the last space.
That includes that ~ but you can remove that.

**Free
Dcl-s V1 Char(100);
Dcl-s Result Char(10);
V1 = 'NTE*OTH*#OH- HANDLING CHARGES GAZE9H01/MNT/ / 6/- 3.36~';

Exec Sql Select Regexp_Substr(
Trim(:V1),
'[\S]+$')
Into :Result
From sysibm.sysdummy1;

Dsply Result;
*Inlr = *On;
Return;


On Wed, 2020-07-29 at 11:48 -0600, Jack Woehr wrote:

the regex for that is something like


.*(\d*\.\d\d).*


when $1 will be your dollar figure.


--

Jack Woehr

Absolute Performance, Inc.

12303 Airport Way, Suite 100

Broomfield, CO 80021


NON-DISCLOSURE NOTICE: This communication including any and all

attachments is for the intended recipient(s) only and may contain

confidential and privileged information. If you are not the
intended

recipient of this communication, any disclosure, copying further

distribution or use of this communication is prohibited. If you
received

this communication in error, please contact the sender and
delete/destroy

all copies of this communication immediately.



[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin
Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual
or entity named above. The authorized recipient of this information
is prohibited from disclosing this information to any other party
and is required to destroy the information after its stated need has
been fulfilled. If you are not the intended recipient, or the
employee of
agent
responsible to deliver it to the intended recipient, you are hereby
notified
that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED.
If you have received this email in error, please notify the sender
immediately to arrange for return or destruction of these documents.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link:
https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.