From: Tom Liotta
That's not how I view it. READ is 'integrated' because of its
relationship to the F-spec and the external file description ...
Yeah, the compiler probably generates quite a bit of code to implement READ, but I kind-of appreciated Walden's point about READ being syntactic sugar. I may not put it that way, but I'd say that regular folks can pack comparable functionality into a single procedure call.
I shared a complete code sample for a simple Web application in a previous message, but it might help if I explained the following two lines:
d order e ds extname(petorder) qualified
if wtnRecGet('PETORDER':%addr(order));
Note that wtnRecGet() is linked to the "PETORDER" data structure by name and address, much like the READ opcode.
PETORDER has the following definition:
A R PETORD TEXT('PET ORDERS')
A PET 1A
A ORDERDATE L DATFMT(*USA)
A COUNT 5S 0 EDTCDE(J)
A RANGE(1 1000)
A BID 7S 2 EDTCDE(J *)
A RANGE(1 1000)
A FIRSTNAME 16A CHECK(ME)
A VARLEN(16)
Behind the scenes, wtnRecGet() retrieves HTML form input elements, checks that ORDERDATE is a valid value in *USA format, checks that COUNT and BID are numeric values in the range of 1-1000, checks that FIRSTNAME is filled in; and finally maps the HTML input element values to the "order" data structure, automatically.
Otherwise wtnRecGet() automatically sends error messages to the browser, indicating the field or fields that didn't pass validity checks.
So from a programmer productivity point of view, wtnRecGet() is comparable to READ.
With respect to the HTTP protocol, it's not like IBM has the only access to low-level system routines. HTTP is more open than that.
As an Amazon Associate we earn from qualifying purchases.