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
 
SORT - Reformatting the input file into required format

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

New User


Joined: 22 Mar 2012
Posts: 4
Location: Pune

PostPosted: Sat Mar 24, 2012 3:20 pm    Post subject: SORT - Reformatting the input file into required format
Reply with quote

Hi,

I have a requirement to reformat the following input file into the required format.

The format of input file is as follows,

Code:
Level Pgm-Name
01    AAAAAAAA
02    BBBBBBBB
02    CCCCCCC
02    DDDDDDD
01    XXXXXXXX
02    YYYYYYYYY
02    ZZZZZZZZ


The 01 level program is calling programs in level-2. The input file will have the 01 level program name following by its calling programs in Level 02.

Hence I want the output in following format,

Code:
Level 1  Level 2
AAAAAAAA BBBBBBBB
AAAAAAAA CCCCCCC
AAAAAAAA DDDDDDD
XXXXXXXX YYYYYYYYY
XXXXXXXX YYYYYYYYY



Can this be done using SORT?

Best Regards,

Shankar Parab
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Mar 24, 2012 3:37 pm    Post subject: Re: SORT - Reformatting the input file into required format
Reply with quote

Yes, it is possible. With GROUP, for instance.

Please show your data in the Code tags next time, which preserves the spacing.

Presumably you input and output are FB?

Are you going to try this yourself? I think you should find some useful examples if you search the DFSORT forum where you have posted.

Posting your DFSORT level would be useful. There is a Sticky in the forum telling you how to find it.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Sat Mar 24, 2012 10:25 pm    Post subject:
Reply with quote

Hi,


Use below mentioned sort card.

Code:
//STEP01  EXEC PGM=SORT                             
//SYSPRINT  DD SYSOUT=*                             
//SYSOUT    DD SYSOUT=*                             
//SORTIN    DD *                                   
01 AAAAAAAA                                         
02 BBBBBBBB                                         
02 CCCCCCC                                         
02 DDDDDDD                                         
01 XXXXXXXX                                         
02 YYYYYYYYY                                       
02 ZZZZZZZZ                                         
/*                                                 
//SORTOUT  DD  SYSOUT=*                             
//SYSIN  DD  *                                     
   INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'01'),
                PUSH=(81:4,8))                     
   SORT FIELDS=COPY                                 
   OUTFIL INCLUDE=(1,2,CH,EQ,C'02'),               
          BUILD=(1:81,8,9:3,20,80:X)               
/*                                                 



Output:

Code:
AAAAAAAA BBBBBBBB   
AAAAAAAA CCCCCCC   
AAAAAAAA DDDDDDD   
XXXXXXXX YYYYYYYYY 
XXXXXXXX ZZZZZZZZ   
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Mon Mar 26, 2012 3:33 am    Post subject:
Reply with quote

Hi,

I'm assuming this is a TYPO
Code:
Level 1  Level 2
AAAAAAAA BBBBBBBB
AAAAAAAA CCCCCCC
AAAAAAAA DDDDDDD
XXXXXXXX YYYYYYYYY
XXXXXXXX YYYYYYYYY


The last line should be
Code:
XXXXXXXX ZZZZZZZZ   


Gerry
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: Mon Mar 26, 2012 11:52 pm    Post subject:
Reply with quote

Alternatively, you could use these DFSORT statements:

Code:

  INREC IFTHEN=(WHEN=INIT,BUILD=(1:7,10,12:7,10,81:2,1)),   
    IFTHEN=(WHEN=GROUP,BEGIN=(81,1,CH,EQ,C'1'),             
      PUSH=(1:1,10))                                       
  OPTION COPY                                               
  OUTFIL INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)             
Back to top
View user's profile Send private message
shankarparab80

New User


Joined: 22 Mar 2012
Posts: 4
Location: Pune

PostPosted: Tue Mar 27, 2012 5:20 pm    Post subject:
Reply with quote

Hi all,

Thanks a lot for your help.

The solution is working fine.

Best Regards,

Shankar Parab
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 Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 4 Fri Sep 22, 2017 4:56 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

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