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
 

 

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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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