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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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