[Info-vax] RMS record metadata, was: Re: Re; Spiralog, RMS Journaling (was

Jan-Erik Soderholm jan-erik.soderholm at telia.com
Thu Jun 23 04:10:38 EDT 2016


Den 2016-06-23 kl. 09:18, skrev lawrencedo99 at gmail.com:
> On Thursday, June 23, 2016 at 11:40:06 AM UTC+12, Jan-Erik Soderholm wrote:
>> You do not need any string handling at all to run SQL databases from Cobol.
>
> Really?

Yes, really. The SQLMOD and embedded SQL is what is used i our
business applications.

For more ad-hoc query and reporting needs (that are web-driven)
we use Paython as the backend mostly becuse it has the web and
OCI parts built-in. And there it is simple to substitue different
SORT clauses depending on user input and so on.

But the core business applications doen't have those wildly
dynamic SQL needs, the operations are quite well defined and
tested. And we do not want the performance overhead with
dynamic SQL, of course. Doing things like the Python code
below does is totaly out of the question in high volume,
high performance code and applications.

And yes, our Cobol applications are easier to support and
manage then if they had been written in C (or whatever).
I find it easier to read and understand a 30 year old
Cobol application then a 30 year old C application.




  I’d be curious as to how you’d handle more dynamic query constructions 
like (Python code):
>
>     condition = \
>         (
>             list
>                 ( # free-text fields
>                     "%(name)s like %(value)s"
>                 %
>                     {
>                         "name" : field[0],
>                         "value" :
>                             SQLString("%" + EscapeSQLWild(Params.getvalue(field[1])) + "%"),
>                     }
>                 for field in
>                     (
>                         ... predefined substring-match fields ...
>                     )
>                 if Params.getvalue(field[1]) != ""
>             )
>         +
>             list
>                 ( # exact-match fields
>                     "%(name)s = %(value)s"
>                 %
>                     {
>                         "name" : field[0],
>                         "value" : SQLString(Params.getvalue(field[1])),
>                     }
>                 for field in
>                     (
>                         ... predefined exact-match fields ...
>                     )
>                 if Params.getvalue(field[1]) != ""
>                 )
>         +
>             list
>                 ( # date fields
>                     "("
>                 +
>                     " or ".join
>                         (
>                             "%(name)s %(op)s %(value)s"
>                         %
>                             {
>                                 "name" : field[0],
>                                 "op" : op[0],
>                                 "value" : SQLString(Params.getvalue(field[1])),
>                             }
>                         for op in
>                             (
>                                 ("<", "lt"),
>                                 ("=", "eq"),
>                                 (">", "gt"),
>                             )
>                         if GetCheckbox("%(name)s[%(op)s]" % {"name" : field[1], "op" : op[1]})
>                         )
>                 +
>                     ")"
>                 for field in
>                     (
>                         ... date fields ...
>                     )
>                 if any
>                     (
>                         GetCheckbox("%(name)s[%(op)s]" % {"name" : field[1], "op" : op})
>                             for op in ("lt", "eq", "gt")
>                     )
>                 )
>         )
>     if len(condition) != 0 :
>         process results of "select «fields» from «table» where" + " and ".join(condition)
>         ...
>     #end if
>




More information about the Info-vax mailing list