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


  • Subject: Re: [EXTERNAL] Need help to convert a name in upper case, to mixed case
  • From: Buck Calabro <kc2hiz@xxxxxxxxx>
  • Date: Tue, 22 Jan 2019 17:11:38 -0500
  • Arc-authentication-results: i=1; mx.google.com; spf=neutral (google.com: 195.159.176.228 is neither permitted nor denied by best guess record for domain of midrange-l@xxxxxxxxxxx) smtp.mailfrom=midrange-l@xxxxxxxxxxx; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:in-reply-to:autocrypt:openpgp:user-agent :content-transfer-encoding:mime-version:references:message-id:date :subject:from:to; bh=93CuTRRabUyXUyFmLXx2QIeiNYqMTPHqjp4ySfGU4iM=; b=VNK4a//fDN9v37eTpIJmsfpOZxF/zhVwUxZNZrusjPwFgabRBUTJn7fttuatbgzSHs UlBWvtHS+etarSCJ1KAa6E9CKrwwNnK6KIclAfMq/T+lsLlt+uhXpS5boFY25+QYQNUC HwliQ1m/HP32hXq1bbxAF9/eC5mx127jZR+2MZhs114fUAusdytY89esdNCs4ZIr8Boc lXpbYQrCfiLb51zbQ8lehthKBMPyqcp1iHzoj4QkeUWTVq8c32TiBBkvgEJhJBUbS8TP 0SgXCFwIxACNxREH4Ol2VeX2/PSAZ7D9jCGSI940CdfWTHROrC4SfIlRlEmRQMHYoU1x MMBQ==
  • Arc-seal: i=1; a=rsa-sha256; t=1548195107; cv=none; d=google.com; s=arc-20160816; b=whuyg7BWZ4p3d/F6TMvU7gHn4+DGwYZkjga7xRd5iQcwJ+gYHJFcwvl/UrWOwPEZnR cPfJ6C69sYjNaqV0zbiEEak4/ZqRhl3dSlZxAXJL65VCEWAIYezAR2UXB5Ggn8xakF79 5W2wa4MyTKU7SW3+BE0pkrzid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IRAvpVK9L9rYXlCR cPAm0YNK6H2DR7sQxWlxEH4mWB+jTCTALpcVq+Kpfbw5qDdn+9DVMS7tBOchtTlPSGgdKgn7 sTObra8cHtX/ddTB6OLzHeTXr4PZbUwVeQdIStdwMmozKBQvgjXWKi1GiuYbwYkCM/zJEUCs J36BIE4li9xohJ5O4iKC20YVckMJfZLbn1a2gVgn6Re8C5ezNewT0qM8ZDCUNENWAxsU/c9J UCFQ2QcMU+25b84D5yPxnEKna5U9Fz2JjRjWy5ZKZx2+WhZj0r2Tw6/kGb28AwADBgf/WBsn JSMHxyVfg+LKLHpdANwa9jdrKOt2WjJbWOiJ9l7SmqD0oi3c22FFxRXKsFfjCikLk9wbLZKH SqqnOePvMMHqNcqQTSv7+ARjxnBH4g6dhqg+zmebKpt8zV2awQzYSSm4YY6IqzkWmPNAN7BU zUtSAfL4UU2PljTnT9m443aVCTXMne5l90HQv/gdJ121owg5KuGE6LodTpoR4hn9nbdKWtfY pDNoykvR+GN5y335yF2Zp/j6QgdxWezjou5Y3/6PUZLEsJagWe9hAcKb1eiO2bmg+1bFYu0T g5Mvb27nqfFeHHFysC7a7sXtxp/pqNLNDcK6j/7Th6vF7/n98YhJBBgRAgAJBQJHG2k+AhsM AAoJEN7KcclHumuR9SgAnRuJWHon4GP58xbqCiFR/jSUfvRgAJ47KZ1UNoXgdftoePnbrZu6 W+poEw==
  • List-archive: <https://archive.midrange.com/midrange-l/>
  • List-help: <mailto:midrange-l-request@lists.midrange.com?subject=help>
  • List-id: Midrange Systems Technical Discussion <midrange-l.lists.midrange.com>
  • List-post: <mailto:midrange-l@lists.midrange.com>
  • List-subscribe: <https://lists.midrange.com/mailman/listinfo/midrange-l>, <mailto:midrange-l-request@lists.midrange.com?subject=subscribe>
  • List-unsubscribe: <https://lists.midrange.com/mailman/options/midrange-l>, <mailto:midrange-l-request@lists.midrange.com?subject=unsubscribe>

On 1/19/2019 12:08 PM, Jon Paris wrote:

I'm looking for as close to a call/parm as I can get.

In my opinion, Scott's UNIXCMD is as close as you're going to get.

The following is a discussion of using Python to assist an existing RPG
code base.

First I need to set expectations. Like OP, I have an existing RPG
program that needs Just One More Thing. Say I'm processing an incoming
file from a vendor that has 14 million rows and I need to convert as
many names as possible from upper to proper case. Python sure is
tempting in terms of LOC to achieve that goal.

Here's a minimalist example in RPG that uses UNIXCMD:

**free

// minimalist proof of concept
// this RPG program fires off a PASE / Python program
// by using Scott Klement's UNIXCMD

ctl-opt dftactgrp(*no) actgrp('QILE')
option(*srcstmt: *nodebugio: *nounref)
debug;

dcl-f pase disk(1024) handler('UNIXCMDOA' :paseCmd) usrOpn;

dcl-s paseCmd char(1024);
dcl-ds
stdout len(1024)
end-ds;
dcl-s msg char(52) ;

paseCmd = '/QOpenSys/pkgs/bin/python3 --version';

// the open fires the pase command as well as 'opens' the pipe to STDOUT
open pase;

// assume only one line comes back
// makes for the simplest (if stupid) example
read pase stdout;

// do something with the response
msg = stdout;
dsply msg;

close pase;

*inlr = *on;

For a production run, this would all get put into a sub-procedure and
then I'd have a simple properName = pythonUpper(custname); in the READ
loop in the mainline (really, in the input primary cycle, because my
program is a 2000 line monolith that was begun by a Sumerian scribe.)

That's a fair amount of wrapping for this particular present, and what
helped me considerably was thinking of Python as though it were on a
different system altogether. So whether one ultimately gets Python to
'talk back' via RPC (RFC 1050), Db2, data areas, pipes, message queues,
raw sockets, or a web service, it's really more akin to a process
running on a completely separate machine than it is to a sub-procedure
running on mine.

In summary, Python as an assistant to RPG seems do-able. In the near
future I plan to run 15M rows through the Python proper case converter
to see how the runtime performance is.


Alternatives I considered but abandoned:
1) Re-write the RPG program in Python and do all the work in Python.
Well, technically this is possible. Python reads and writes Db2 just
fine, but the idea of trying to work out all the business rules secretly
stashed away in all those indicators is enough to put me off my feed.

2) Refactor that RPG beast into sub-procedures / web services /
something that Python could invoke. Python would then become the
'primary cycle', reading and updating the proper database tables, while
the business rules would still live in RPG, usable by the rest of the
system. Haha, that was a good one!

3) Proper casing the names and sending them back to the vendor so that
*everyone* will have access to names that don't look like they were
typed in 1985.


Alternatives I'm still considering:
a) Make a new work file in the existing RPG-centric process. Add a new
Python program that reads the work file, and only proper cases the
names. Then fire the existing RPG program. This one has promise, but I'm
running out of 10 character names for scratch files. OK, that was an
exaggeration, but in a CLP that runs a dozen RPG programs, does 5
tagalong sorts and an addrout, do I really want another work file?
Maybe. I'll profile that too when I catch my breath.

b) Abandon the whole idea of proper cased names. Do people really care
that much if the letters they get in the mail are all upper case?

c) Write an RPG proper case routine. Until a few years ago, this would
have been my default position, my starting point. I have some naive code
that does the bulk of this work already, but the devil's in the details
as always...


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.