Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Transpose values from Vertical to horizontal

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Transpose values from Vertical to horizontal
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Dec 03, 2012 12:23 am    Post subject: Reply to: Tranpose values from Vertical to horizontal
Reply with quote

if You had searched this section using the buzzword TRANSPOSE

You would have found
this
http://www.ibmmainframes.com/viewtopic.php?t=59033&highlight=transpose
and this
http://www.ibmmainframes.com/viewtopic.php?t=37038&highlight=transpose
and this
http://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    Post subject:
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

Moderator


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

PostPosted: Mon Dec 03, 2012 1:31 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Dec 03, 2012 1:51 pm    Post subject: Reply to: Transpose values from Vertical to horizontal
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 !
http://www.ibmmainframes.com/viewtopic.php?t=37296&highlight=transpose
Back to top
View user's profile Send private message
Pandora-Box

Moderator


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

PostPosted: Mon Dec 03, 2012 1:51 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Dec 03, 2012 3:08 pm    Post subject: Reply to: Transpose values from Vertical to horizontal
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

Moderator


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

PostPosted: Mon Dec 03, 2012 3:14 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Dec 03, 2012 4:58 pm    Post subject: Reply to: Transpose values from Vertical to horizontal
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

Moderator


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

PostPosted: Mon Dec 03, 2012 5:13 pm    Post subject:
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    Post subject: Reply to: Transpose values from Vertical to horizontal
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

Moderator


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

PostPosted: Mon Dec 03, 2012 6:53 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Dec 03, 2012 8:24 pm    Post subject: Reply to: Transpose values from Vertical to horizontal
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm
No new posts Sync sort - Transpose TS70363 SYNCSORT 5 Tue Jun 28, 2016 3:18 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us