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: 7314

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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 0 Thu Dec 14, 2017 8:13 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

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