Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

DFHRESPONSE returns issue

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
divated

New User


Joined: 30 Sep 2016
Posts: 5
Location: south africa

PostPosted: Wed Nov 02, 2016 6:32 pm    Post subject: DFHRESPONSE returns issue
Reply with quote

Hello,

I am getting below JSON DFHRESPONSE in my CICS webservice call.

Code:
{
   "prov_name": "GAUTENG                                                                                             ",
   "city_name":    [
      "JNB1                                                                                                ",
      "JNB2                                                                                                "
   ],
   "suburb_name":    [
      "SUBURB1                                                                                             ",
      "SUBURB2                                                                                             "
   ],
   "message_status": 0,
   "response_message": "successful                                                            "
}


but i am expecting the below response.


Code:
{
[
{
"province_name": "GAUTENG ",
"region_name": "PRETORIA ",
"suburb_name": "SAULSVILLE "
},
{

"province_name": "GAUTENG ",
"region_name": "PRETORIA ",
"suburb_name": "SAULSVILLE UIT 4 "
}
],
"message_status": 0,
"response_message": "successful "
}

this is how i have defined by array.

Code:
01 WS-ARRAY-FIELDS.                                             
   05 WS-POST-RECORDS OCCURS 1 TO 500 TIMES                     
                      DEPENDING ON W01-TOTAL-CNT.               
     10 LB-PROVINCE-N      PIC X(13) VALUE '"prov_name":"'.     
     10 WS-PROVINCE-NAME        PIC X(100).                     
     10 FILLER                PIC X(02) VALUE '",'.             
     10 LB-REGION-N          PIC X(13) VALUE '"city_name":"'.   
     10 WS-REGION-NAME          PIC X(100).                     
     10 FILLER                PIC X(02) VALUE '",'.             
     10 LB-SUBURB-N           PIC X(15) VALUE '"suburb_name":"'.
     10 WS-SUBURB-NAME          PIC X(100).                     
     10 FILLER               PIC X(02) VALUE '",'.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Nov 02, 2016 6:43 pm    Post subject:
Reply with quote

First, your expected results do not match your defined array -- the variable LB-REGION-N is defined as "city_name" and hence will NEVER be "region_name" as you expect.

Second, there is pretty much no JSON expertise on this forum so you're probably not going to get many (if any) answers here. Your best bet is to do LOTS of debugging -- displaying the ENTIRE value you get back, then figuring out how your program is parsing it out into variables. Or you could convince your management to hire a consultant to help you figure out your issues.
Back to top
View user's profile Send private message
divated

New User


Joined: 30 Sep 2016
Posts: 5
Location: south africa

PostPosted: Wed Nov 02, 2016 7:00 pm    Post subject: Reply to: DFHRESPONSE returns issue
Reply with quote

Sorry for confusing with the different field labels.

But my question is related to grouping.

My table has values
province city suburb
abc jnb sub1
abc jnb sub2

All i want in my result is grouping ( province, city and suburb) as groups
but my current results are giving me all separate group for province, and separate for city and separate for suburb.

The grouping is shown by [ ], which is not generated correctly.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Thu Nov 03, 2016 12:38 am    Post subject: Reply to: DFHRESPONSE returns issue
Reply with quote

Your logic to create/build the response is Not right. So, the code where you are doing the grouping doesn't seem to be correct.

Moreover, If you have a field with X(100) then you'll get:
Code:
"prov_name": "GAUTENG                                                                                             ",

i.e. spaces after value and don't expect the value to be like below, unless you modify it:
Code:
"province_name": "GAUTENG ",


.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts REXX Screen not working due to LINKED... sundarkudos CLIST & REXX 1 Mon May 09, 2016 1:44 pm
No new posts Issue in sending zip file as mail att... ajithajt JCL & VSAM 8 Thu Apr 07, 2016 9:11 am
No new posts GetObjectArrayElement returns NULL Majid Hussain Java & MQSeries 2 Wed Mar 30, 2016 2:59 am
No new posts Include Cond issue vickey_dw DFSORT/ICETOOL 6 Tue Mar 29, 2016 8:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us