View previous topic :: View next topic
|
Author |
Message |
gayathrinag
New User
Joined: 16 Oct 2008 Posts: 37 Location: chennai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
gayathrinag
New User
Joined: 16 Oct 2008 Posts: 37 Location: chennai
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
gayathrinag
New User
Joined: 16 Oct 2008 Posts: 37 Location: chennai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
If you are not sure of rows and columns each time why not create the file as Transposed ?? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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
don' t You know the answer already ?
that's the requirement |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Yes Enrico
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 |
|
Back to top |
|
|
gayathrinag
New User
Joined: 16 Oct 2008 Posts: 37 Location: chennai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
gayathrinag
New User
Joined: 16 Oct 2008 Posts: 37 Location: chennai
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 ?
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 |
|
|
|