IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Transpose values from Vertical to horizontal


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gayathrinag

New User


Joined: 16 Oct 2008
Posts: 37
Location: chennai

PostPosted: Mon Dec 03, 2012 12:11 am
Reply with quote

Hi,

I need to transpose the values from Vertical to Horizontal.

Input
Code:
====

AA  12  13
BB  12  12
CC 12 124

OUTPUT
Code:
=====
AA   BB    CC
12   12    12
13   12  124

I have tried for hit next key word. But didnt work in the format which i expected.

Your help will be greatly appreciatable.

Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 03, 2012 12:23 am
Reply with quote

if You had searched this section using the buzzword TRANSPOSE

You would have found
this
www.ibmmainframes.com/viewtopic.php?t=59033&highlight=transpose
and this
www.ibmmainframes.com/viewtopic.php?t=37038&highlight=transpose
and this
www.ibmmainframes.com/viewtopic.php?t=37296&highlight=transpose
Back to top
View user's profile Send private message
gayathrinag

New User


Joined: 16 Oct 2008
Posts: 37
Location: chennai

PostPosted: Mon Dec 03, 2012 1:00 am
Reply with quote

Hi

Thanks for your help!!!

I just saw the sort results, but when i see sort card i could find the hard coded values.

In my case i wouldnot know the first 2 bytes values its directly coming from file.

can you please help me with sort card for the input which i had posted.

Thanks in advance for your timely help.

Thanks
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Dec 03, 2012 1:31 pm
Reply with quote

Quote:
In my case i wouldnot know the first 2 bytes values its directly coming from file.


What do you mean here?
Back to top
View user's profile Send private message
gayathrinag

New User


Joined: 16 Oct 2008
Posts: 37
Location: chennai

PostPosted: Mon Dec 03, 2012 1:48 pm
Reply with quote

My input file has the first two bytes as "AA,BB like this.... i dont know the values for the first 2 bytes since the its directly coming from job....
and the my input file can have more number of rows and row count also im not sure....
so my basic aim is i need to transpose the input file n*n...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 03, 2012 1:51 pm
Reply with quote

the links I provided do not make any assumption on the content of the first column


this one in particular does exactly what You ask for !
www.ibmmainframes.com/viewtopic.php?t=37296&highlight=transpose
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Dec 03, 2012 1:51 pm
Reply with quote

If you are not sure of rows and columns each time why not create the file as Transposed ??
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 03, 2012 3:08 pm
Reply with quote

Quote:
If you are not sure of rows and columns each time why not create the file as Transposed ??


oh cm' on Pandora.. shame on You for asking such silly questions icon_wink.gif
don' t You know the answer already ?
that's the requirement icon_cool.gif
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Dec 03, 2012 3:14 pm
Reply with quote

Yes Enrico icon_smile.gif

I always think Prevention is better than cure

Rather implementing something extra for cure

It becomes something like when people ask for transpose why did design ended up in changing rows to columns

Atm it is very weird to me icon_eek.gif
Back to top
View user's profile Send private message
gayathrinag

New User


Joined: 16 Oct 2008
Posts: 37
Location: chennai

PostPosted: Mon Dec 03, 2012 3:52 pm
Reply with quote

Can you please explain about the TRANSPOSE process.. it would be grt if you could provide some samples

thanks for all your help
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 03, 2012 4:58 pm
Reply with quote

Quote:
Can you please explain about the TRANSPOSE process.. it would be grt if you could provide some samples


holy s**t ... are you click challenged perchance ???

what happened when You clicked on the last link I provided You and scrolled down a few posts

being an IT professional means that You should be able to build a solution for Your own needs
taking as example a similar one
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Dec 03, 2012 5:13 pm
Reply with quote

FYE

Please find the below input

Code:
AA  12  13
BB  12  12
CC  12  24

To transpose this to

Code:
AA  BB  CC
12  12  12
13  12  24

First fill the sequence number to the input


Code:
INREC IFTHEN=(WHEN=INIT,BUILD=(81:1,12,SEQNUM,2,ZD)),

This is very important step as the sequence number will help in identifying the number of rows and columns and also not that I have said 1,12 as this will help in overlaying at later part of the process

And based on the sequence number you could identify and group records for transpose

Code:
    INREC IFTHEN=(WHEN=INIT,BUILD=(81:1,12,SEQNUM,2,ZD)),
    IFTHEN=(WHEN=GROUP,BEGIN=(93,2,ZD,EQ,01),
    RECORDS=3,PUSH=(001:81,12)),
    IFTHEN=(WHEN=GROUP,BEGIN=(93,2,ZD,EQ,02),
    RECORDS=2,PUSH=(013:81,12)),
    IFTHEN=(WHEN=GROUP,BEGIN=(93,2,ZD,EQ,03),
    RECORDS=1,PUSH=(25:81,12))
So when Sequence number is 1 It is identified as first group and it is build from 1 till 12
and when it is 2 the record is build from 13 till 24
and when sequence number is 3 the record is build from 25 to 36

At intermediate stage your output looks like

Code:
AA  12  13                                                                                                AA  12  13  01
AA  12  13  BB  12  12                                                                                    BB  12  12  02
AA  12  13  BB  12  12  CC  12  24                                                                        CC  12  24  03
Now all we need is the last record to reformat

Code:
      OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
      TRAILER1=(0001,4,0013,4,25,4,/,
                0005,4,0017,4,29,4,/,
                0009,4,0021,4,33,4)

Gives the output

Code:
AA  BB  CC
12  12  12
13  12  24
Back to top
View user's profile Send private message
gayathrinag

New User


Joined: 16 Oct 2008
Posts: 37
Location: chennai

PostPosted: Mon Dec 03, 2012 6:49 pm
Reply with quote

Thanks for your detailed explanation.

when the i have the input like this

AA 12 13
BB 12 12
FF 12 24
EE 12 24
GG 12 24
HH 12 24

The same code will not work as i need to IFTHEN and trailer since i am not sure how many rows i will get in the file
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Dec 03, 2012 6:53 pm
Reply with quote

You need to know atleast max how many rows you get and the columns you get in your file and have a similar code to work it outfor you

Also For example

When you use a code of 4 * 4 for a input of 2 * 2 you would get blank lines in output

You might also need to think about removing them
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 03, 2012 8:24 pm
Reply with quote

I wonder why the TS does not want to do the job for which he/she gets paid for ...
and sits lazily waiting for a ready to run solution ? icon_evil.gif

why in hell doesn' t he/she run the last sample with his data
from the link I posted and tells us the result ???

the number of rows that can be transposed to columns depends on the record length of the output file
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
Search our Forums:

Back to Top