[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] YAJL -



Here is the DS  - the field names in the JSON file within the extras have ‘_’ in the name.  RPG will not let me use that as a field in the DS so I did not think I could use DATA_Into

 

Thank you

 

DCL-DS list_t    qualified template;        

   id              VARCHAR(150);             

   status          VARCHAR(150);             

   referenceId     VARCHAR(150);             

   firstName       VARCHAR(150);             

   lastName        VARCHAR(150);             

   middleName      VARCHAR(150);             

   email           VARCHAR(150);             

   mobile          VARCHAR(150);             

   title           VARCHAR(150);             

   phone           VARCHAR(150);             

   company         VARCHAR(150);             

   gender          VARCHAR(150);             

   gradSemester    VARCHAR(150);             

   gradYear        INT(10);                  

   birthdate       VARCHAR(150);             

   address         VARCHAR(150);             

address2        VARCHAR(150);             

city            VARCHAR(150);             

state           VARCHAR(150);             

postal          VARCHAR(150);             

disasterContact VARCHAR(150);             

dateUserAccountExpires VARCHAR(150);      

dateAdded       VARCHAR(150);             

dateUpdated     VARCHAR(150);             

datelastLogin   VARCHAR(150);              

                                           

DCL-DS extras;                            

  arrtid   VARCHAR(150);                  

  noarrtid      VARCHAR(150);             

  additionaldiscipline VARCHAR(150);      

  workextension  VARCHAR(150);             

  verifycredentials VARCHAR(150);         

  primarydiscipline VARCHAR(150);         

    jobdescription VARCHAR(150);           

    yrsemployed    VARCHAR(150);           

    institutiontype VARCHAR(150);          

    educationlevel VARCHAR(150);           

    examcommittee  VARCHAR(150);           

    specialprojectscommittee VARCHAR(150); 

    practiceanalysiscommittee VARCHAR(150);

    itemwriter     VARCHAR(150);           

  END-DS;                                   

END-DS;                                    

 

 

Georgeann Rybak

 

Software Engineer, Information Technology

The American Registry Of Radiologic Technologists®

 

Direct Phone & Fax 651.681.3133 | Main Phone 651.687.0048

1255 Northland Drive, St. Paul, MN 55120

arrt.org

 

 

From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx <ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Sunday, November 01, 2020 10:44 AM
To: FTPAPI/HTTPAPI mailing list <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [Ftpapi] YAJL -

 

It would be helpful to see the DS you are using and the relevant JSON.

 

P.S. Since you are apparently loading the JSON into a DS, why not just use DATA-INTO with the YAJL-INTO parser?

 

 



On Nov 1, 2020, at 9:48 AM, Georgeann Rybak <georgeann.rybak@xxxxxxxx> wrote:

 

I am able to read the information within the ‘data’ with the code below.  My issue is the ‘extras’ is a data structure within the ‘data’ data structure. 

 

I have tried to access the information via result.list.extras(i) and that does not work. 

 

Do I need to change ‘node’ and ‘list’?

 

Thanks for any help.

 

node = YAJL_object_find(docNode: 'message');    

result.message = YAJL_get_string(node);         

                                                 

list = YAJL_object_find(docNode: 'data');       

                                                 

i = 0;                                          

dow YAJL_ARRAY_LOOP( list: i: node );           

  j = 0;                                        

  Dow YAJL_OBJECT_LOOP( node: j: key: val);     

     exsr load_data;                            

  enddo;                                        

enddo;                

 

Begsr load_data;                                             

 // Use this bring in the fields we need from the Json file  

 // -------------------------------------------------------  

                                                              

 select;                                                     

 when key = 'id';                                             

   Result.list(i).id = yajl_get_string(val);                 

   idsave  = result.list(i).id;                              

 when key = 'referenceId';                                   

   Result.list(i).id = yajl_get_string(val);                  

   refidsave  = result.list(i).id;                           

 when key = 'extras';                                        

 endsl;                                                      

Endsr;                                                                                   

 

Georgeann Rybak

 

SOFTWARE ENGINEER, INFORMATION TECHNOLOGY

THE AMERICAN REGISTRY OF RADIOLOGIC TECHNOLOGISTS®

 

DIRECT PHONE & FAX 651.681.3133 | MAIN PHONE 651.687.0048

1255 NORTHLAND DRIVE, ST. PAUL, MN 55120

 

 

                

-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi

 

-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi