"concatenate" rows into a grid



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

"concatenate" rows into a grid

Postby LasseH » Thu Sep 08, 2011 1:45 pm

Report: Racf-User defined in Lpar

Looking for a way to "concatenate" rows into a grid.

Input: (userid=8char, Name=20char, Lpar=4char)
USERID1  NAME-OF-USER  PROD
USERID1  NAME-OF-USER  ACPT
USERID1  NAME-OF-USER  TEST
USERID2  NAME-OF-USER  PROD
USERID3  NAME-OF-USER  ACPT



Result:
User        Name          Prod  Acpt  Test
USERID1  NAME-OF-USER    Y      Y       Y
USERID2  NAME-OF-USER    Y
USERID3  NAME-OF-USER            Y


Managed to create the 'Y"s but on separate rows...

USERID1   NAME-OF-USER          Y             
USERID2   NAME-OF-USER          Y             
USERID2   NAME-OF-USER              Y           
USERID2   NAME-OF-USER                 Y       
USERID2   NAME-OF-USER                    Y   


...with these parms:
OUTREC IFTHEN=(WHEN=(LPAR,EQ,C'PROD'), 
        BUILD=(01,30,36:C'Y')),         
       IFTHEN=(WHEN=(LPAR,EQ,C'ACPT'), 
        BUILD=(01,30,39:C'Y')),         

.
.

Would even be nice with a header like

User    Name   P A T
xxxx   xxxxx   Y    Y


Can somebody help me with this?

//Lasse
LasseH
 
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 7 times
Been thanked: 1 time

Re: "concatenate" rows into a grid

Postby skolusu » Thu Sep 08, 2011 9:47 pm

LasseH,

Assuming the data is already sorted on the USERID and Name, the following DFSORT/ICETOOL JCL will give you the desired results. If the data is not sorted on the userid and name , change sort fields=copy to sort fields=(1,28,CH,A) in the CTL1CNTL statement.
//STEP0100 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//SYMNAMES DD *                                                 
LPAR,29,4,CH                                                     
//IN       DD *                                                 
USERID1 NAME-OF-USER1       PROD                                 
USERID1 NAME-OF-USER1       ACPT                                 
USERID1 NAME-OF-USER1       TEST                                 
USERID2 NAME-OF-USER2       PROD                                 
USERID3 NAME-OF-USER3       ACPT                                 
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
  SPLICE FROM(IN) TO(OUT) ON(1,28,CH) USING(CTL1) -             
  KEEPNODUPS WITHANY WITH(38,1) WITH(40,1)                       
//CTL1CNTL DD *                                                 
  SORT FIELDS=COPY                                               
  INREC IFTHEN=(WHEN=(LPAR,EQ,C'PROD'),OVERLAY=(36:C'Y')),       
  IFTHEN=(WHEN=(LPAR,EQ,C'ACPT'),OVERLAY=(38:C'Y')),             
  IFTHEN=(WHEN=(LPAR,EQ,C'TEST'),OVERLAY=(40:C'Y'))             
                                                                 
  OUTFIL REMOVECC,BUILD=(9,20,24:36,1,30:38,1,36:40,1,80:X),     
  HEADER2=(4:'USER NAME          PROD  ACPT  TEST',/,           
           1:20'=',2X,4'=',2X,4'=',2X,4'=')                     
//*


The output from this job is an 80 byte file
   USER NAME          PROD  ACPT  TEST
====================  ====  ====  ====
NAME-OF-USER1          Y     Y     Y   
NAME-OF-USER2          Y               
NAME-OF-USER3                Y         
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: "concatenate" rows into a grid

Postby LasseH » Mon Sep 12, 2011 11:32 am

That did it. (is this product nice or what?)
LasseH
 
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 7 times
Been thanked: 1 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post