Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can we combine the rows with same key... V S Amarendra Reddy DB2 12 Fri Dec 01, 2017 10:29 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us