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 records under sub-header

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

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Tue May 12, 2009 2:33 pm    Post subject: sort records under sub-header
Reply with quote

Hi,

I had a file in below format.

Code:

000SSC ORDERS          207649220090507120353WFPOM      - MAIN HEADER 
030A7082598011111S708259801                            - SUB HEADER   
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
031AAAA3333220903054544010601800000000411111708259801  - DETAIL RECORD
031BBBB3333220903054544010604200000000411111708259801  - DETAIL RECORD
031CCCC3333220903054544010608300000000611111708259801  - DETAIL RECORD
031DDDD3333220903054544010611700000000611111708259801  - DETAIL RECORD
030A7082598555555S708259851                            - SUB HEADER   
03170825985944903054544010601800000001655555708259851  - DETAIL RECORD
03170825985944903054544010604200000001655555708259851  - DETAIL RECORD
999000011195                                           - TRAILER     


1-3 -> ID
17-31 -> Sort Key
LRECL = 53
RECFM = FB

Header is identified by 000
Trailer is identified by 999
Sub Header is identified by 030
Detail record is identified by 031

i want to sort detail records under each sub header. Kindly guide me how i can do this.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue May 12, 2009 4:46 pm    Post subject:
Reply with quote

Click HERE to view DFSORT smart tricks, and see the section sort groups of records, which I believe will help you.
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: Tue May 12, 2009 8:56 pm    Post subject:
Reply with quote

Bhaskar,

Here's a DFSORT job that will do what you asked for.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/53)
//SORTOUT DD DSN=...  output file (FB/53)
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,SS,EQ,C'000,030,999'),
    PUSH=(54:ID=8))
  SORT FIELDS=(54,8,ZD,A,1,3,CH,A,17,15,CH,A)
  OUTREC BUILD=(1,53)
/*
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Wed May 13, 2009 4:33 pm    Post subject: Reply to: sort records under sub-header
Reply with quote

Hi Frank,

Thanks for providing solution. But my installation doesnt support WHEN=GROUP option. Is there any other way other than this. Kindly let me know whenther we can do this other than this option.
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: Wed May 13, 2009 9:01 pm    Post subject:
Reply with quote

Here's a DFSORT job without WHEN=GROUP that will do what you asked for:

Code:

//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/53)
//SORTOUT DD DSN=...  output file (FB/53)
//SYSIN    DD    *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(54:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,3,SS,EQ,C'000,030,999'),
                OVERLAY=(54:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(62:SEQNUM,8,ZD,
                         54:54,8,ZD,SUB,62,8,ZD,TO=ZD,LENGTH=8))
  SORT FIELDS=(54,8,ZD,A,1,3,CH,A,17,15,CH,A)
  OUTREC BUILD=(1,53)
/*
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Thu May 14, 2009 11:24 am    Post subject: Reply to: sort records under sub-header
Reply with quote

Hi Frank,

Excellent solution. This job worked perfectly. The logic you have coded is simple and nice. thank you so much frank.
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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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