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

SORT - Reformatting the input file into required format


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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Mar 24, 2012 3:37 pm
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
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: 1702
Location: Australia

PostPosted: Mon Mar 26, 2012 3:33 am
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 Developer


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

PostPosted: Mon Mar 26, 2012 11:52 pm
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
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 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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top