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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm


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