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 

Changing vertical grouping to horizontal

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


Joined: 16 Mar 2005
Posts: 3
Topics: 1

PostPosted: Thu Mar 17, 2005 12:27 am    Post subject: Changing vertical grouping to horizontal Reply with quote

I am having a requirement like this:

Input file :
Code:
----+----1----+
XXX TAG123     
XXX TAG134     
YYY 000001     
YYY 001234     
YYY 123456     
YYY 787878     

Now output file should have:
Code:
----+----1----+
XXX    YYY     
TAG123 000001 
TAG134 001234 
       123456 
       787878 


Can this be done with the help of any utility ?
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: Thu Mar 17, 2005 8:44 am    Post subject: Reply with quote

framermain,

Do you have only 2 groups(XXX & YYY) ? or more than 2?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
framermain
Beginner


Joined: 16 Mar 2005
Posts: 3
Topics: 1

PostPosted: Thu Mar 17, 2005 10:21 am    Post subject: Reply with quote

Only 2. But number of records in each group may vary.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 17, 2005 10:32 am    Post subject: Reply with quote

Please explain in more detail, with more examples, what you're trying to do. It appears from your one example that you're pairing up the first XXX with the first YYY and the second XXX with the rest of the YYY's. That's not much to go on and certainly not much help understanding what you want when "number of records in each group may vary". What do you want if there are three XXX's? Four XXX's? Five YYY's? Two YYY's?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
framermain
Beginner


Joined: 16 Mar 2005
Posts: 3
Topics: 1

PostPosted: Thu Mar 17, 2005 11:05 pm    Post subject: Reply with quote

There will always be 2 groups. One under 'XXX" and other under 'YYY'. I am pasting 3 sample inputs and respective desired outputs. Hope this will clarify my requirement:
Code:

INPUT1:
XXX 123455
XXX 555555
XXX 123455
XXX 125555
XXX 123455
XXX 125555
XXX 123455
YYY 123665
YYY 123655
YYY 177775
YYY 123458
YYY 123459

OUTPUT1:
XXX    YYY   
123455 123665
555555 123655
123455 177775
125555 123458
123455 123459
125555
123455


INPUT2:
XXX 123455
YYY 123665
YYY 123655
YYY 177775
YYY 123458
YYY 123459

OUTPUT2:
XXX    YYY
123455 123665
       123655
       177775
       123458
       123459

INPUT3:
XXX 123455
XXX 555555
XXX 123455
YYY 123458
YYY 123459

OUTPUT3:
XXX    YYY
123455 123458
555555 123459
123455

Back to top
View user's profile Send private message
mithun466
Beginner


Joined: 14 Apr 2004
Posts: 3
Topics: 0

PostPosted: Fri Mar 18, 2005 12:16 am    Post subject: Reply with quote

Framermain,

The following JCL will give you the desired results. INFILE is the i/p file with data vertically grouped and OUTFILE is the o/p file with data horizontally grouped. I have assumed that there will be a max of 999999 records for each of the groups.
Code:

//**********************************************************************
//JSTEP010 EXEC PGM=ICETOOL
//**********************************************************************
//TOOLMSG   DD  SYSOUT=*
//DFSMSG     DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//TOOLIN     DD *
   COPY FROM(INFILE)  USING(CTL1)
   SORT FROM(INTEMP)  TO(INTEMP1)    USING(CTL2)
   COPY FROM(INTEMP2) TO(OUTFILE)
//INFILE   DD *
XXX 123455
XXX 555555
XXX 123455
YYY 123458
YYY 123459
//CTL1CNTL DD *
    OUTFIL FNAMES=INTEMPX1,INCLUDE=(1,3,CH,EQ,C'XXX'),
          OUTREC=(SEQNUM,6,ZD,5,6,C'   ',X'0000000000000000')
   OUTFIL FNAMES=INTEMPY1,INCLUDE=(1,3,CH,EQ,C'YYY'),
          OUTREC=(SEQNUM,6,ZD,X'0000000000000000',C' ',5,6,2C' ')
   OUTFIL FNAMES=XXXYYY,STARTREC=1,ENDREC=1,
          OUTREC=(C'XXX    YYY   ')
//CTL2CNTL DD *
   SORT   FIELDS=(1,6,BI,A),EQUALS
   SUM    FIELDS=(7,8,BI,16,8,BI)
   OUTREC FIELDS=(7,6,C' ',16,6)
//INTEMPX1 DD DSN=&&INTEMPX1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//INTEMPY1 DD DSN=&&INTEMPY1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//XXXYYY   DD DSN=&&XXXYYY,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//INTEMP1  DD DSN=&&INTEMP1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)
//INTEMP   DD DSN=*.INTEMPX1,VOL=REF=*.INTEMPX1,DISP=(OLD,PASS)
//         DD DSN=*.INTEMPY1,VOL=REF=*.INTEMPY1,DISP=(OLD,PASS)
//INTEMP2  DD DSN=*.XXXYYY,VOL=REF=*.XXXYYY,DISP=(OLD,PASS)
//         DD DSN=*.INTEMP1,VOL=REF=*.INTEMP1,DISP=(OLD,PASS)
//OUTFILE  DD SYSOUT=*


Thanks,
Mithun
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Mar 18, 2005 11:16 am    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will give you what you want. It uses the new IFTHEN parameter available with z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) so you'll need that PTF. If you have DFSORT, but you don't have that PTF, ask your System Programmer to install it (it's free).

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG     DD  SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN     DD *
* IN->T1: Reformat XXX records to:
* |xxxxxx|b|bbbbbb|seqnum|
* Reformat YYY records to:
* |bbbbbb|b|yyyyyy|seqnum|
   COPY FROM(IN)  TO(T1) USING(CTL1)
* Splice yyyyyy into xxxxxx record when seqnums match.
* Add header.  Remove seqnum.
   SPLICE FROM(T1) TO(OUT) ON(81,8,ZD) WITH(8,6) -
     KEEPNODUPS USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'XXX'),
    BUILD=(1:5,6,81:SEQNUM,8,ZD)),
   IFTHEN=(WHEN=(1,3,CH,EQ,C'YYY'),
    BUILD=(8:5,6,81:SEQNUM,8,ZD))
/*
//CTL2CNTL DD *
   OUTFIL FNAMES=OUT,REMOVECC,
     HEADER1=('XXX    YYY'),
     OUTREC=(1,80)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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