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

Vetical to Horizontal Transformation


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

New User


Joined: 28 Mar 2014
Posts: 2
Location: USA

PostPosted: Thu Jun 12, 2014 8:31 pm
Reply with quote

Hi All,

I have a input file and it needs to transformed as explained below using
SORT( I execute PGM=SORT)

Input file:
-----------
Code:
       col1         col2     space
DBNAME1 DB2A  10
DBNAME1 DB2B  12
DBNAME1 DB2C  14
DBNAME1 DB2D  20
DBNAME2 DB2A  10
DBNAME2 DB2C  15
DBNAME2 DB2D  20


Output :
---------
Code:
       col1    col2 col3  col4  col5
DBNAME1  10     12   14     20
DBNAME2  10     15   20


I dont need the DB2* column as the 2nd column in outfile will be populated from DB2A ,3rd column from DB2B, 4th from DB2C and 4th from DB2D.
If space is not found for a system in the 2nd column of input file it has to be filled with spaces.

The input file will be sorted on Column 1 and Column 2

Code'd and de-mangled
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Jun 17, 2014 1:58 am
Reply with quote

If you have a syncsort then you can refer to the below example and try to make the necessary changes as per your requirements otherwise please ignore,

Code:
//SORT1 EXEC PGM=SORT,PARM='EQUALS'                         
//STEPLIB DD DSN=WCS.TS.SS12DN,UNIT=SYSDA,DISP=SHR 
//SORTIN  DD *                                       
KEY1 DATA1                                         
KEY1 DATA2                                         
KEY2 DATA3                                         
KEY2 DATA4                                         
KEY3 DATA5                                         
KEY3 DATA6                                         
KEY4 DATA7                                         
KEY4 DATA8                                         
//SORTOUT DD SYSOUT=*                           
//SYSOUT  DD SYSOUT=*                           
//SYSIN   DD *                                   
  INREC IFTHEN=(WHEN=INIT,                     
       OVERLAY=(81:SEQNUM,1,ZD,RESTART=(1,4))),
        IFTHEN=(WHEN=(81,1,ZD,EQ,1),           
         BUILD=(1:1,11,12:6Z)),                 
        IFTHEN=(WHEN=(81,1,ZD,EQ,2),           
         BUILD=(1:1,5,6:6Z,12:6,5,1Z))         
   SORT FIELDS=(1,4,CH,A)                       
   SUM FIELDS=(6,4,BI,10,4,BI,14,4,BI)


Output :

Code:
KEY1 DATA1 DATA2
KEY2 DATA3 DATA4
KEY3 DATA5 DATA6
KEY4 DATA7 DATA8   
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 Merge horizontal DFSORT/ICETOOL 1
No new posts Transpose values from Vertical to hor... DFSORT/ICETOOL 14
No new posts XML numeric parse transformation problem COBOL Programming 10
No new posts Vertical records into horizontal layo... DFSORT/ICETOOL 11
No new posts Formatting vertical records into hori... DFSORT/ICETOOL 3
Search our Forums:

Back to Top