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
 

 

Columns to Rows

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 04, 2011 4:04 pm    Post subject: Columns to Rows
Reply with quote

Hi,

I have a requirement where I have a input file having 10 records each of 5 bytes. I want to write these 10 records to one row in the output file.

Example
Code:

INPUT:
AAAAA
12345
BBBBB
64321
CCCCC
FFFFF
QQQQQ
ZZZZZ

OUTPUT
AAAAA 12345 BBBBB 64321 CCCCC FFFFF QQQQQ ZZZZZ


Please let me know how can i achieve this using sysncsort?
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 04, 2011 4:18 pm    Post subject:
Reply with quote

Is input going to have only 10 records always?

What is the version of SYNCSORT you are using?

LRECL and RECFM of input and output files Please...
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 04, 2011 4:38 pm    Post subject:
Reply with quote

Yes, the number of records will be constant.

SYNCSORT version - SYNCSORT FOR Z/OS 1.3.2.0RI

LRECL of INPUT file - 5
RECFM of INPUT file - FB

Output - LRECL - 80
RECFM FB
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu Aug 04, 2011 11:22 pm    Post subject:
Reply with quote

gylbharat,
If you haven't already got the solution then try below(tested on DFSort)...
Code:
//STEP0001 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD  SYSOUT=*                                       
//DFSMSG   DD  SYSOUT=*                                       
//IN       DD  YOUR INPUT FB/5                                 
//OUT      DD  OUTPUT FB/80                                   
//TOOLIN   DD  *                                               
 SPLICE FROM(IN) TO(OUT) ON(89,1,CH) WITHEACH WITH(07,5) -     
 WITH(14,5) WITH(21,5) WITH(28,5) WITH(35,5) WITH(42,5) -     
 WITH(49,5) WITH(56,5) WITH(63,5) USING(CTL1)                 
/*                                                             
//CTL1CNTL DD *                                               
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,C'1')),     
        IFTHEN=(WHEN=(81,8,ZD,EQ,02),OVERLAY=(07:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,03),OVERLAY=(14:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,04),OVERLAY=(21:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,05),OVERLAY=(28:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,06),OVERLAY=(35:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,07),OVERLAY=(42:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,08),OVERLAY=(49:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,09),OVERLAY=(56:1,5)),       
        IFTHEN=(WHEN=(81,8,ZD,EQ,10),OVERLAY=(63:1,5))         
  OUTFIL FNAMES=OUT,BUILD=(1,80)                               
                                                               
/*                                                             
//SYSOUT   DD  SYSOUT=*                                       
//*                                                           

Thanks,
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Aug 05, 2011 10:58 am    Post subject:
Reply with quote

Thanks Sqlcode1.... I wanted to know how the same can be achieved without using ICETOOL and DFSORT ....
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 05, 2011 1:30 pm    Post subject:
Reply with quote

Hello,

Suggest you try the solution given and post back if there are problems.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Fri Aug 05, 2011 7:38 pm    Post subject:
Reply with quote

gylbharat,
Well I only have DFSort installed at my shop but the posted solution "should" also work for Syncsort.

Quote:
I wanted to know how the same can be achieved without using ICETOOL and DFSORT ...
I am not sure if I understood this correctly but by this, if you meant using other functions, then DFSort has RESIZE function which one can use but I am not sure if Syncsort has similar function available. Only other way I can think of would using IFTHEN GROUP 9 times, and selecting last record.

Thanks,
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Aug 06, 2011 9:40 am    Post subject:
Reply with quote

Hello,

Have you tried running this with Syncsort?

What happened?
Back to top
View user's profile Send private message
Vasanthr

New User


Joined: 24 Jan 2011
Posts: 21
Location: India

PostPosted: Wed Aug 10, 2011 2:03 pm    Post subject: Reply to: Columns to Rows
Reply with quote

I tried the same JCl with syncsort . It worked perfectly
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Can we use OPTIMIZE FOR 1 ROWS for fe... cvijay784 DB2 1 Fri Aug 05, 2016 11:56 am


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