|
Old school RPGer, young programmers (independent of whether they are RPGer or not) all know SQL and Regular Expressions 😉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 Hauserwrote:
<Hauser@xxxxxxxxxxxxxxx>
1),
The following SQL-Statement should return the numbers only:
Select Dec(RegexP_Replace(Substr(Text,Locate_In_String(Text, '/',
-1) +
'[\s^~]', ''), 11, 2),them
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
and keeping them!"they
„Train people well enough so they can leave, treat them well enough
so
don't want to.“ (Richard Branson)Kevin
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf
Of
BucknumBucknum
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
Senior Programmer Analystindividual
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
or entity named above. The authorized recipient of this informationagent
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
responsible to deliver it to the intended recipient, you are herebynotified
that any disclosure, copying, distribution or action taken inlist
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
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,link:
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
https://amazon.midrange.comlist
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,related questions.
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
link: https://amazon.midrange.com
Help support midrange.com by shopping at amazon.com with our
affiliate
--
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 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.