MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pivot Table using DFSort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
cyberuser
Beginner


Joined: 15 Oct 2005
Posts: 29
Topics: 12

PostPosted: Sun Sep 30, 2018 9:15 am    Post subject: Pivot Table using DFSort Reply with quote

Would be possible to create a pivot table using dfsort ?

Code:


input file FB/80:
10:01  w1   5
10:01  w2  15
10:01  w4  30
10:02  w2  18
10:02  w3   5
10:02  w5  10

Code:

output file FB/80:
        w   w   w   w   w
        1   2   3   4   5

10:01   5  15      30
10:02      18   5      10



[/code]
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Sun Sep 30, 2018 11:55 am    Post subject: Reply with quote

cyberuser,

Here is an untested DFSORT JCL which will give you the desired results. I assumed that numeric in W1/W2/.. decide which slot the value goes and also assumed that you have a max of 5 occurrences ( 1 thru 5).

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
10:01  W1   5                                             
10:01  W2  15                                             
10:01  W4  30                                             
10:02  W2  18                                             
10:02  W3   5                                             
10:02  W5  10                                             
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  OPTION COPY                                             
  INREC IFOUTLEN=80,                                     
        IFTHEN=(WHEN=INIT,                               
         BUILD=(01:01,05,              $ KEY             
                81:09,01,              $ COUNTER/SLOT     
                82:12,02)),            $ VALUE           
        IFTHEN=(WHEN=(81,1,ZD,EQ,1),                     
       OVERLAY=(08:82,02)),            $ VALUE 1         
        IFTHEN=(WHEN=(81,1,ZD,EQ,2),                     
       OVERLAY=(12:82,02)),            $ VALUE 2         
        IFTHEN=(WHEN=(81,1,ZD,EQ,3),                     
       OVERLAY=(16:82,02)),            $ VALUE 3         
        IFTHEN=(WHEN=(81,1,ZD,EQ,4),                     
       OVERLAY=(20:82,02)),            $ VALUE 4         
        IFTHEN=(WHEN=(81,1,ZD,EQ,5),                     
       OVERLAY=(24:82,02))             $ VALUE 5         
                                                         
  OUTFIL REMOVECC,NODETAIL,                               
  HEADER2=('        W   W   W   W   W',/,                 
           '        1   2   3   4   5',/),               
  SECTIONS=(1,5,                                         
  TRAILER3=(1,5,                                         
            08:MAX=(08,2,UFF,EDIT=(II)),                 
            12:MAX=(12,2,UFF,EDIT=(II)),                 
            16:MAX=(16,2,UFF,EDIT=(II)),                 
            20:MAX=(20,2,UFF,EDIT=(II)),                 
            24:MAX=(24,2,UFF,EDIT=(II))))                 
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group