Hi Kelly,
I've been an RPG/Free-Format programmer for more than 20 years, and I've worked with COBOL here & there in that time. I'm currently a COBOL programmer, and I'm honing my COBOL skills.
I'm not familiar with developing REST APIs in general, but I have done some API development with RPG & SQL.
First, you can totally embed SQL in COBOL. I do it every day. The syntax is similar to that in RPG. I have an example below. I don't know if this is much use, but I did want to answer as much of your question as I can.
?* Set up for BASETBL retrieval
MOVE "N" TO DONE-FLAG.
MOVE "N" TO PRT-FLAG.
MOVE "0010-GET-BASETBL" TO PGMERR-PARA1.
MOVE "BASETBL" TO PGMERR-FILE.
MOVE 0 TO SQLCODE.
EXEC SQL
SELECT BTDRMO,
BTLOT,
BTPRJ
INTO :BC-LOCAL-DRMO-SRAN,
:BC-LOT-PROCESS-SRAN-FOR-DRMO,
:BC-VAL-PROJ-CODE
FROM BASETBL
END-EXEC.
Bobby Jackson
Senior COBOL Software Developer
Leidos - ALMSS
Bobby.Jackson@xxxxxxxxxx
Work..: 571.521.3874
Mobile: 206.529.7478
-----Original Message-----
From: COBOL400-L <cobol400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Kelly Cookson via COBOL400-L
Sent: Wednesday, February 9, 2022 10:07
To: cobol400-l@xxxxxxxxxxxxxxxxxx
Cc: Kelly Cookson <KCookson@xxxxxxxxxxxx>
Subject: EXTERNAL: [COBOL400-L] SQL COBOL to Consume REST APIs
Hi,
I am looking for a way to develop a REST API client with COBOL. I know it can be done with RPG. But I want to know if it can be done with COBOL.
Is it possible for a COBOL program to use embedded SQL to do the following?
1. Use the new QSYS2 HTTP functions to consume a REST API. (Needs to be the new QSYS2 functions and not the old SYSTOOLS functions.)
2. Use the SQL function JSON_TABLE to get the data from the JSON returned by the REST API.
I am not asking for examples. I just want to know if anyone has already done this, so I know it is possible. Or know if it is not possible and not waste my time trying.
Thanks,
Kelly Cookson
Senior Software Engineer II
Dot Foods, Inc.
1-217-773-4486 ext. 12676
https://urldefense.us/v3/__http://www.dotfoods.com__;!!Az_Xe1LHMyBq19w!Z9SHSuH5_fhZ1hsqVxkDXH3hNOiY-TaFU_XEk5QiBeo56a78lH1aUjCoA97fCm-r9l_C$ <
https://urldefense.us/v3/__http://www.dotfoods.com__;!!Az_Xe1LHMyBq19w!Z9SHSuH5_fhZ1hsqVxkDXH3hNOiY-TaFU_XEk5QiBeo56a78lH1aUjCoA97fCm-r9l_C$ >
--
This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.us/v3/__https://lists.midrange.com/mailman/listinfo/cobol400-l__;!!Az_Xe1LHMyBq19w!Z9SHSuH5_fhZ1hsqVxkDXH3hNOiY-TaFU_XEk5QiBeo56a78lH1aUjCoA97fCq0HKB7C$
or email: COBOL400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.us/v3/__https://archive.midrange.com/cobol400-l__;!!Az_Xe1LHMyBq19w!Z9SHSuH5_fhZ1hsqVxkDXH3hNOiY-TaFU_XEk5QiBeo56a78lH1aUjCoA97fCgGRSLlE$ .
As an Amazon Associate we earn from qualifying purchases.