Progress


 

2020/02/24
Numeric zero key not working SACASCR1 & SACBEER1

2020/02/07
Added File/Table SACBEEP. 
Now to complete my CRUD

2020/02/06
Removed four unnecessary lines off SACASCR1

2020/01/31
Copying an exiting working program and changing it to another file takes 10 lines of code to change and an additional 3 lines per field on the file to be used. (Updated 2020/02/07)


2020/01/24
Please could someone point me to open source RPG using YAJL consuming JSON on a simple file with GET, PUT, POST and DELETE. 

2020/01/27

2020/01/20
Thank you all for your assistance, you know who you are.
I have completed the JSON YAJL provider REST API (GET) in Totally/Fully Free RPG, comments and corrections are welcome.
This is open source, the data is also provided for the file/table SACADCP

Please could you comment on my blog  https://ibmrestapi.blogspot.com as this is part of my SEO experiment.

Why YAJL?




2020/02/07
I (ex legacy coder) can now in five minutes create a provider GET REST API for a master file/table.

YAJL an Open Source JSON Tool (YAJL = Yet Another JSON Library)
  • Open Source
  • Ported to IBM i (ILE C) by Scott Klement & David Russo
    • Scott has provided an RPG layer to simplify its usage also added direct RPG interfaces (YAJLR4)
  • Generating JSON with RPG
  • For both reading and writing JSON
  • Originally created by Mozilla's Lloyd Hilaiel, He now works at Facebook
  • Written in C and very, very fast
  • Handles the UTF-8/EBCDIC translation for you
Notes
Scott Klement's port of YAJL is a great tool both for creation and consumption of JSON.
You can download the latest version of YAJL free of charge from Scott's site (www.scottklement.com/yajl/) and the install process is very simple and well documented. Did I mention that YAJL is very fast? Blazingly fast!
And of course Scott has done his usual stellar job of "RPGizing" the API calls to make it easy to use. For example, his RPG interfaces automatically take care of translating between EBCDIC and UTF-8.

2020-01-23
from http://www.scottklement.com/presentations/Options%20for%20Consuming%20REST%20APIs%20from%20RPG.pdf



HTTPAPI / YAJL 
  • Easy to use
  • Full-featured, offers capabilities that none of the others do
  • Performs very well
  • Requires you to download/install 3rdparty software
Db2 SQL Functions in SYSTOOLS
  • Easy to use
  • Has most needed features; missing multipart; missing error details
  • Performs slowly, uses a lot of resources (due to Java JVMs)
  • Included with OS, nothing to install


AXIS C Transport API 
  • More difficult to use; pointer techniques; more code to do the same things
  • Only does HTTP, none of the additional needed features
  • Performs very well
  • Included with OS, nothing to install

Why JSON?


So why would I use JSON rather than XML ?

Other than in cases such as web services that demand the use of JSON.

Notes
JSON (JavaScript Object Notation) is fast becoming an essential technology in modern IBM i shops. From web services to browser interfaces and data exchange—it has seen a remarkable growth in usage over the last few years. In recent times IBM have even added direct JSON support to DB2.
JSON began basically as a replacement for XML in Ajax calls. That’s somewhat ironic when you consider that the "x" in Ajax actually stands for XML—“Asynchronous Javascript and XML" ... But then the X in XML stands for eXtensible so a little irony is perhaps appropriate.

JSON is "Better" Because ...
  • It is far more compact
    • Only 60 - 70% of the size of comparable XML
    • Shorter transmission overhead
  • Its syntax is simpler
    • No namespaces
    • Simpler approach to escaping special characters
    • Only UTF-8 is supported
      • XML has to worry about multiple encodings
  • Faster to decode
    • For example arrays have a specific syntax
      • Whereas arrays in XML are just repeats of an element
XML had proven just too big and lumpy, requiring too much horsepower to parse in Web 2.0 type applications. JSON on the other hand is not only far more compact than XML, but because it is based on Javascript's own object data initialization definitions, a fast parser was already effectively built into every browser. So there was very little additional support needed in the browser.
JSON also only uses UTF-8 encoding and so the multiple data encodings supported by XML do not have to be dealt with.
With this three-fold advantage (compactness, ease of parsing, everything in UTF-8) it was hardly surprising that JSON rapidly replaced XML in most Ajax calls. From there it has gone on to become the vehicle of choice for web service requests and responses, and is making significant strides in the area of data interchange.