/* read-json-pds2.p */
{pi-json-parameterVarDefs.i} /* parameter variable definitions */ DEFINE TEMP-TABLE ttCustomer NO-UNDO FIELD CustNum LIKE Customer.CustNum FIELD Name LIKE Customer.Name FIELD State LIKE Customer.State. DEFINE TEMP-TABLE ttOrder NO-UNDO FIELD OrderNum LIKE Order.Ordernum FIELD CustNum LIKE Order.CustNum FIELD ShipDate LIKE Order.ShipDate. DEFINE TEMP-TABLE ttInvoice NO-UNDO FIELD Invoicenum LIKE Invoice.Invoicenum FIELD OrderNum LIKE Invoice.OrderNum FIELD InvoiceDate LIKE Invoice.InvoiceDate. DEFINE DATASET dsOrderLog FOR ttCustomer, ttOrder, ttInvoice DATA-RELATION CustOrd FOR ttCustomer, ttOrder RELATION-FIELDS(CustNum,CustNum) NESTED DATA-RELATION OrdInv FOR ttOrder, ttInvoice RELATION-FIELDS(OrderNum,OrderNum) NESTED. DEFINE VARIABLE hdsOrderLog AS HANDLE NO-UNDO. DEFINE VARIABLE lRetOK AS LOGICAL NO-UNDO. hdsOrderLog = DATASET dsOrderLog:HANDLE. ASSIGN cSourceType = "file" cFile = "dsOrderLog2.json" cReadMode = "EMPTY". lRetOK = hdsOrderLog:READ-JSON(cSourceType, cFile, cReadMode). ASSIGN cTargetType = "file" cFile = "dsOrderLog3.json" lFormatted = TRUE cEncoding = ?. lRetOK = hdsOrderLog:WRITE-JSON(cTargetType, cFile, lFormatted). |