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



Vern, no worries about Jon crossing the border for several more weeks, so
feel free to make as many lame jokes as you want. We'll let David decide
when to close the thread.

-reeve

On Wed, May 20, 2020 at 12:40 PM Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:

<vendor reply>.... as the topic lives on here in the forum...


https://www.itjungle.com/2020/05/20/a-simple-web-service-framework-from-core-i-solutions/


Jay

On Tue, May 19, 2020 at 4:02 PM Jack Prucha <Jack.Prucha@xxxxxxx> wrote:

The devil is in the details and the RPG SQL precompiler....

Unlike many of the examples I'm not reading the JSON from a IFS document.
It's in a clob in a db2 table. So on the select, the clob is put into
this field:

Dcl-s wrkContent SQLTYPE(Clob:128000);

I've done this before but a few years ago. It gets generated as this:

//*DCL-S WRKCONTENT SQLTYPE(CLOB:128000);

DCL-DS WRKCONTENT;
//SQL
WRKCONTENT_LEN UNS(10);
//SQL
WRKCONTENT_DATA CHAR(128000) CCSID(*JOBRUNMIX);
//SQL
END-DS WRKCONTENT;
//SQL

So to access the JSON I should have been pointing the parser to
wrkContent_Data, not the array name.

This:
Data-Into txJSONDoc
%Data(wrkContent_DATA:'doc=string ' +

Not:
Data-Into txJSONDoc
%Data(wrkContent:'doc=string ' +


After fixing that I had all sorts of data mismatches and type errors.
There were numeric fields being passed in blanks. I found this to be
useful:

ADDENVVAR QIBM_RPG_DATA_INTO_TRACE_PARSER VALUE('*STDOUT')

See

https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzasd/zzdatainto.htm

As it provided a nice running trace of what the parser was doing.

Thanks to all for their suggestions. I appreciate the quick responses.

Jack

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Nathan
Andelin
Sent: Tuesday, May 19, 2020 12:25 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: JSON Error Message

Although Jay may have been promoting a vendor product, I'd encourage the
list to download and review it, if for no other reason than to compare it
with IWS. People would benefit by understanding the interface.

IWS generates Java components and implements a Java runtime environment,
whereas Jay eschews that middle-ware layer and rather offers a generic
HTTP-CGI interface.

If you consider all the steps involved in IWS wizards just to configure
and deploy a web service; the process is tedious. The IWS admin and
programming guide is 170 pages filled with technical acronyms and
unfamiliar concepts.

Formatted input and output streams in IWS web services are super tightly
coupled with procedure interfaces in ILE programs or service programs,
while Jay's interface is whatever JSON input or JSON output you might
want
to implement, which is super flexible.

In regard to flexible interfaces, you might deploy say "employee" web
services that support create, read, update, delete, list, fetch name
(formatted L, F M), fetch address, etc. all within a single program,
because all of the web services share the same database table
(employees).
It's architecturally sound.

This is the type of interface that can give ODBC and JDBC a run for its
money.

You can parse/generate JSON with YAJL or SQL, or whatever.

It's not perfect. I can think of a lot of things I would change. But
people would benefit by getting a feel for how the interface works.

I've also been reviewing a couple of ILE RPG interfaces that bypass the
HTTP / CGI interface by implementing their own socket listeners. It's
interesting.









On Mon, May 18, 2020 at 5:54 PM Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:

No biggie guys!
Yes, lets keep the standard high on this forum.

Jay

On Mon, May 18, 2020 at 7:09 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:

For some reason Jay's response did not reach me. Due to to the
vagaries of gmail it may show up in a few hours.

So I will repeat here what I said to Nathan which is that I
apologize to Jay if indeed these were genuine code samples he was
posting.

I took a shortcut and was wrong and I apologize.



On May 18, 2020, at 6:29 PM, Vernon Hamberg
<vhamberg@xxxxxxxxxxxxxxx>
wrote:

Hi Jay

Sharing source is fine - I suspect you already know the difference
now!
The main thing to avoid is to have product recommendations by the
vendor look like advice from the community of a solution to a
question. You
always
said something was a product of yours, so I wasn't too concerned -
still, I
and others here treasure this resource and are glad David puts a
pretty high fence around it.

Regards and thanks
Vern

On 5/18/2020 3:20 PM, Jay Vaughn wrote:
Sorry. Will try and remember nxt time.
If I just posted the program source code instead of the entire
link
would that been better? Just saved time by posting the entire link.

Not sure how sharing source code is violation? But whatever. I
will
try and remember next time.

Jay

On May 18, 2020, at 4:13 PM, midrangel@xxxxxxxxxxxxxxxxx wrote:

I've been waiting for David to say something, buy I agree, I'm
tired
of the advertisements without the ability to <delete before read>.

--
Jim Oberholtzer
Agile Technology Architects

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf
Of
Jon
Paris
Sent: Monday, May 18, 2020 3:05 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: JSON Error Message

Jay - maybe it is just me but I think it really is time you
started
tagging things with <Vendor response> when you do this.


On May 18, 2020, at 4:00 PM, Jay Vaughn
<jeffersonvaughn@xxxxxxxxx>
wrote:

Jack,

Sql json functions can look complex on the service but it can
easily be implemented using a programming approach I take in
something I've developed. Take a look at the sql json api
program at the end of
this
document to see how you can easily build complicated json
structures.
The idea is to keep them strings and create multiple procedures
to keep appending to the json structure (ie. the
getJsonResponseObject_01 procedure can be replicated many times
for
different related objects).

https://jeffersonvaughn.com/gallery/coreiRST%20Overview.pdf

Jay

On Mon, May 18, 2020 at 2:33 PM Jack Prucha
<Jack.Prucha@xxxxxxx>
wrote:

Hello Jon,

I attended your RPG/DB2 seminars in the suburbs of Chicago.
Although
I live far from there now I grew up a few miles away from the
hotel.
It was convenient to visit family and save the company some $
by having my sister pick me up at the airport.

Yes, I successfully validated with JSONLINT. Copied the
results
out of
the Run SQL Scripts result window.

This is what I pasted in:

{"id":1,"userId":10415785,"accountNumber":null,"dateOfBirth":"1999-08

-12","name":{"id":4,"firstName":"Arun","middleName":null,"lastName":"
Sashidhar","suffix":null},"permanentAddress":{"id":5,"street":
"999 Chase Hill Blvd Apt 922","street2":null,"city":"San

Antonio","state":"TX","postalCode":"78256-1041","country":"US","count
y":null},"mailingAddress":{"id":3,"street":"999
Chase Hill Blvd Apt 922","street2":null,"city":"San




Antonio","state":"TX","postalCode":"78256-1041","country":"US","county":null},"identification":"2001","identificationType":"SSN","contact":{"id":2,"mobilePhone":"","textOptIn":false,"homePhone":"","workPhone":"","email":"
dsad@xxxxxxx
","emailIsValid":false},"account":{"id":6,"status":"KS","

type":"IND","subType":"UTMA","beneficiary":{"id":7,"name":{"id":8,"fi

rstName":"Arun","middleName":null,"lastName":"J","suffix":null},"dob"

:"1969-09-18","identification":"2001","identificationType":"SSN","sta

teOfResidence":"NC"},"investment":{"id":10,"investmentOptions":[{"inv

estmentOptionId":"cd","percentContribution":3},{"investmentOptionId":

"de","percentContribution":97}]},"contribution":{"id":13,"amount":100

01.1,"paymentMethod":{"paymentType":"ACH","id":11,"as400Id":0,"routin

gNumber":"999999999","newRoutingNumber":"000000000","bankName":"STATE
EMPLOYEES CREDIT

UNION","accountNumber":"999999999","accountType":"C","accountName":nu

ll,"status":"A","preferred":false,"saveForFuture":true},"frequency":"
ONCE"},"application":{"id":9,"startDate":"2020-03-31

09:31:33","completedDate":null,"submissionDate":null,"isReadProgramDe

scription":true,"isAgreedToTerms":true,"electronicSignature":true},"e
Statements":true}}

The SQL JSON looked complex. I'll research that idea.

Thx
Jack

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf
Of
Jon
Paris
Sent: Monday, May 18, 2020 2:03 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: JSON Error Message

Have you validated the JSON with something like JSONLINT ? I
have found several times that I had invisible characters in
the JSON
that
screwed it up.

It would also help if you showed the json and not just the DS.

Since you are already using SQL to access the JSON why use
DATA-INTO
and not just use the SQL abilities?


On May 18, 2020, at 12:57 PM, Jack Prucha
<Jack.Prucha@xxxxxxx>
wrote:

I'm working with our web team who is sending me a JSON
document.
After
a simple proof of concept many months ago and test documents,
I received the first real output from the web process.
After changing my DS to look more like the output of
YAJLGEN, I'm getting this error message out of YAJLINTO

1002: lexical error: invalid char in json text.█ The parser
for
the
DATA-INTO operation detected error code 1002.

The unprintable character displays on a green screen as a
question
mark. I don't see any unusual characters when viewing the
JSON
data using
Run SQL Scripts or in debug.
Any suggestions about how to fix this? I tried filtering the
JSON
hoping to make sure that there's no unprintable characters
under
x'40'.

wrkContent = %ScanRpl(x'000102030405060708090A0B0C0D0E0F'
+
'101112131415161718191A1B1C1D1E1F'
+
'202122332425262728292A2B2C2D2E2F'
+
'303132333435363738393A3B3C3D3E3F':
' ':wrkContent);

We're on 7.3. The web process inserts a record into a db2
file
with
a
CLOB column. This is what the column definition looks like:
Transaction_Content FOR WTCONTENT CLOB ALLOCATE(100) CCSID 37
NOT NULL DEFAULT '' )

This is the JSOSN code from the program:

EXEC SQL DECLARE CWE100R0 CURSOR FOR
SELECT a.wtRecID, a.wtWebID, a.wtSts, a.wtStsDte,
a.wtContent
FROM cvWebTx A

EXEC SQL FETCH NEXT FROM CWE100R0 INTO
:wtRecID, :wtWebID, :wtSts, :wtStsDte, :wrkContent;

Dcl-s wrkContent SQLTYPE(Clob:128000);

// Extract data from JSON document (cvWebTX.wtContent)
Data-Into txJSONDoc
%Data(wrkContent:'AllowExtra=Yes ' +
'doc=string ' +
'AllowMissing=Yes ' +
'Case=Convert ' +
'CountPrefix=Count_')
%Parser('YAJLINTO':'{"value_null":" "}');


Thanks in Advance
Jack


[CFNC]

This email, including any documents, files, or previous email
messages
attached to it, has been sent from an email account of College
Foundation Inc., (CFI) and may contain confidential,
proprietary,
or
legally privileged information belonging to CFI. If you are
not the intended recipient, any dissemination, distribution,
or copying of this email or its attachments is strictly
prohibited. If you have received this email in error, please
immediately notify the sender
by
email and destroy the original email and any attachments.
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To
post
a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list
To
post
a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list
To
post
a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list To
post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list To
post
a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list To
post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list To
post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list To post
a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-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 RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-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 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.