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

Transposing the columns to rows using FILEAID or SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Fri Sep 18, 2009 9:57 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Remote Unload of CLOB Columns DB2 6
Search our Forums:

Back to Top