335 pts.
 AS400 – Physical Files
Hi I have some qusetion in AS400 How can we convert rows into columns and columns into row for a PF in AS400. Please send me the coding for this requirement. Thanks

Software/Hardware used:
AS400
ASKED: January 21, 2011  11:01 AM
UPDATED: January 22, 2011  1:17 AM

Answer Wiki:
The question is not logical if you are only doing it on the AS400 It sounds what you want to do is to download the file to a .CSV and then use the transpose function Excel. This will take the sample file below and convert it to the 2nd example A B C D E 1 2 3 4 5 X Y 8 9 Z ----------------------- A 1 X B 2 Y C 3 8 D 4 9 E 5 Z
Last Wiki Answer Submitted:  January 21, 2011  2:46 pm  by  CharlieBrowne   32,785 pts.
All Answer Wiki Contributors:  CharlieBrowne   32,785 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

What is your OS version and release?

In current releases of the OS, this would usually be done with recursive SQL.

You show initially three rows with five columns. Will there ever be a different number of rows or columns? The generation of a new column when an additional row is added to the table would be a problem, though not insurmountable. The logic just gets complex.

Tom

 107,695 pts.

 

Also (in V6R1 and later), you might choose to use OLAP specifications to create a CUBE ‘super-aggregate’ set of rows. That might help simplify coding.

Tom

 107,695 pts.