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
 

 

Transposing the columns to rows using FILEAID or SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sashi

New User


Joined: 14 Sep 2005
Posts: 54
Location: Chennai

PostPosted: Fri Sep 18, 2009 7:23 pm    Post subject: Transposing the columns to rows using FILEAID or SORT
Reply with quote

Hi all,

i have a input file like this

INPUT
Acc No Indicator1 indicator2
1111 A 1
1111 B 2
1111 C 4
1111 D 3
2222 A 1
2222 C 2
2222 B 3
4444 A 1
4444 B 2
4444 C 3
4444 D 4

need to reformat the input file as follows.
each Acc No can repeated maximum 4 times.
and if Acc No repeated for 3 times the last byte should be blank(Check Acc No 2222)
and indicator order should be same as input file.

OUTPUT
1111 ABCD1243
2222 ACB 123
4444 ABCD1234


I know we can do it by COBOL program using arrays ...
but i need to do it in this in JCL
so please let me know is it possible to do in FILEAID or SYNCSORT?

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

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Sep 18, 2009 9:57 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
1111           A                1
1111           B                2
1111           C                4
1111           D                3
2222           A                1
2222           C                2
2222           B                3
4444           A                1
4444           B                2
4444           C                3
4444           D                4
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,4,CH) WITHANY KEEPNODUPS -
  WITH(6,1) WITH(7,1) WITH(8,1) WITH(9,1) -
  WITH(10,1) WITH(11,1) WITH(12,1) WITH(13,1) USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:SEQNUM,1,ZD,RESTART=(1,4))),
    IFTHEN=(WHEN=(41,1,ZD,EQ,1),BUILD=(1,4,6:16,1,10:33,1)),
    IFTHEN=(WHEN=(41,1,ZD,EQ,2),BUILD=(1,4,7:16,1,11:33,1)),
    IFTHEN=(WHEN=(41,1,ZD,EQ,3),BUILD=(1,4,8:16,1,12:33,1)),
    IFTHEN=(WHEN=(41,1,ZD,EQ,4),BUILD=(1,4,9:16,1,13:33,1))
/*
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 DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 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


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