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

Re: [Ftpapi] YAJL -



Sorry here is the JSON file.  I need to read the arrt-id from the extras DS.  I am able to read the data from the first part of the data DC.

 

{"rows":1,"offset":0,"limit":20,"message":"ok","data":[{"id":"3697869","status":"active","referenceId":"","firstName":"Minnie","lastName":"Rybak","middleName":null,"email":"georgeann_vogel@xxxxxxxxx","mobile":"","title":"","phone":"","company":"","gender":"","gradSemester":"","gradYear":"0","birthdate":null,"address":"","address2":"","city":"","state":"","postal":"","disasterContact":"0","dateUserAccountExpires":null,"dateAdded":"2020-10-29T07:51:09-05:00","dateUpdated":"2020-10-29T08:36:30-05:00","dateLastLogin":null,"extras":{"arrt-id":"547465","no-arrt-id":"","arrt-credentials":"","additional-discipline-":"","previous-experience":"","privacy-policy":""}}]}

 

 

Not sure exactly what you mean by the DS for line idsave  = result.list(i).id;     

 

Here is my result DS and I already provide the DS for list – is that what you need?

 

0135.01 D  result         DS                  qualified              

0135.02 D    success                     1n                          

0135.03 D    message                   500a   varying                

0137.01 D    errmsg                    500a   varying                

0137.02 D    list                             likeds(list_T) dim(999)

 

 

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 12:35 PM
To: FTPAPI/HTTPAPI mailing list <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [Ftpapi] YAJL -

 

We still need the JSON.  Plus this is a template - so we still need the definition of the DS that this line:

 

 idsave  = result.list(i).id;     



refers to.   There is no array in your template and the template could not be used as is to create a structure where the array was at the "list" level - which is what  result.list(i).id implies.

 

 



On Nov 1, 2020, at 1:19 PM, Georgeann Rybak <georgeann.rybak@xxxxxxxx> wrote:

 

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

 

 

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

 

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