Quantcast
Viewing all articles
Browse latest Browse all 8500

DFSORT/ICETOOL :: RE: Group Data based on a key

Author: mrdinesh
Posted: Wed May 03, 2017 12:48 pm (GMT 5.5)

Arun Raj wrote:
mrdinesh,

The requirement is pretty much well explained in your example. Good job.

What if all the entries for an application are 'WAITING'? What status do you want to see for that application in that case?
Will that still be 'In-Progress' with start/end times as blanks?

If yes, you could use something like this :
Code:
//SYSIN DD *                                                 
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,21,15,39,15,57,8)),       
       IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,4),PUSH=(43:05,15)),   
       IFTHEN=(WHEN=(35,8,CH,EQ,C'ERROR'),                   
               OVERLAY=(58:C'1Error')),                       
       IFTHEN=(WHEN=(35,8,CH,EQ,C'WAITING'),                 
               OVERLAY=(58:C'2In-Progress')),                 
       IFTHEN=(WHEN=(35,8,CH,EQ,C'Started'),                 
               OVERLAY=(58:C'3In-Progress')),                 
       IFTHEN=(WHEN=(35,8,CH,EQ,C'Complete'),                 
               OVERLAY=(58:C'4Complete'))                     
 SORT FIELDS=(1,4,CH,A,58,1,CH,A,20,15,CH,D)                 
 OUTFIL REMOVECC,NODETAIL,BUILD=(80X),SECTIONS=(1,4,                     
        HEADER3=(01:1,4,11:43,15,30:20,15,48:59,11)),         
        HEADER1=('App-Name  Start_Date_Time    ',             
                 'End_Date_Time     Status')                 

Assumption : Output RECFM=FB/LRECL=80 and the input to be in sorted order of App-Name, Start_Date_Time .

Added the below lines to your test-input,
Code:
App5      J2588BG   20170427-060001                     Started
App5      J2588BG                                       WAITING
App6      J2599BG                                       WAITING
App6      J2599BG                                       WAITING

SORTOUT had:
Code:
App-Name  Start_Date_Time    End_Date_Time     Status     
App1      20170427-060001    20170427-065000   Complete   
App2      20170427-060001    20170427-064000   Error     
App3      20170427-060001                      In-Progress
App4      20170427-060001    20170427-063000   Error     
App5      20170427-060001                      In-Progress
App6                                           In-Progress
Ideally if all the jobs within an application are waiting, I would have expected the Appln status to be 'Waiting' instead of 'In-Progress'.
This can be slightly tweaked if that is what you want to show in the output.


EDIT : My bad, again kept the page open and missed Bill's response.


Thanks Arun Raj, the sort card worked well for us.


Viewing all articles
Browse latest Browse all 8500

Trending Articles