Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DFSORT/ICETOOL :: RE: SORT JSON type of data

$
0
0
Author: Arun Raj
Posted: Thu Apr 20, 2017 9:02 pm (GMT 5.5)

maxsubrat,

Below is a RESIZE example based on your sample input. You could modify it once you have the actual requirements 'frozen'.
Code:
//STEP01  EXEC PGM=ICETOOL 
//TOOLMSG   DD SYSOUT=*     
//DFSMSG    DD SYSOUT=*     
//OUT       DD SYSOUT=*     
//IN        DD *           
{
     "requests": [
         {
             "confirmationNumber": "12345678",
             "userId": "22DD50D4-91C1-4B43-9F67-DB14976D72D9",
             "segmentId": "60142429549",
             "lastName": "User1LastName",
             "firstName": "User1FirstName",
             "segmentStartDate": "2017-04-14T15:05:00-0800",
             "segmentEndDate": "2017-04-15T15:05:00-0800",
             "requestDate": "2017-02-14T15:05:00-0800"
         }, {
             "confirmationNumber": "87654321",
             "userId": "DE78B6BB-18A8-4321-BE13-90D04A617A0F",
             "segmentId": "60142429550",
             "lastName": "User2LastName",
             "firstName": "User2FirstName",
             "segmentStartDate": "2017-03-14T15:05:00-0800",
             "segmentEndDate": "2017-03-16T15:05:00-0800",
             "requestDate": "2017-02-14T15:05:00-0800"
         }, {
             "confirmationNumber": "12348765",
             "userId": "85A0891D-B53B-4257-AE02-087409292F18",
             "segmentId": "6014242951",
             "lastName": "User3LastName",
             "firstName": "User2LastName",
             "segmentStartDate": "2016-05-14T15:05:00-0800",
             "segmentEndDate": "2016-05-15T15:05:00-0800",
             "requestDate": "2016-02-14T15:05:00-0800"
         }
     ]
 }
//TOOLIN   DD *                                               
 RESIZE FROM(IN) TO(OUT) TOLEN(288) USING(CTL1)               
//CTL1CNTL DD *                                               
 OMIT COND=(1,18,SS,EQ,C'{',OR,                               
            1,18,SS,EQ,C'}',OR,                               
            1,18,SS,EQ,C'[',OR,                               
            1,18,SS,EQ,C']')                                 
 SORT FIELDS=COPY                                             
 INREC PARSE=(%01=(STARTAFT=C'": "',ENDBEFR=C'"',FIXLEN=36)),
       BUILD=(%01)                                           
 OUTFIL BUILD=(001,08,C'|',                                   
               037,36,C'|',                                   
               073,11,C'|',                                   
               109,13,C'|',                                   
               145,14,C'|',                                   
               181,24,C'|',                                   
               253,24)   

OUT had :
Code:
12345678|22DD50D4-91C1-4B43-9F67-DB14976D72D9|60142429549|User1LastName|User1FirstName|2017-04-14T15:05:00-0800|2017-02-14T15:05:00-0800
87654321|DE78B6BB-18A8-4321-BE13-90D04A617A0F|60142429550|User2LastName|User2FirstName|2017-03-14T15:05:00-0800|2017-02-14T15:05:00-0800
12348765|85A0891D-B53B-4257-AE02-087409292F18|6014242951 |User3LastName|User2LastName |2016-05-14T15:05:00-0800|2016-02-14T15:05:00-0800


EDIT : Rahul - I had kept the page open and missed the response above!
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard


Viewing all articles
Browse latest Browse all 8500

Trending Articles