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

sort records under sub-header


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Tue May 12, 2009 2:33 pm
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: 8797
Location: Welsh Wales

PostPosted: Tue May 12, 2009 4:46 pm
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 Developer


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

PostPosted: Tue May 12, 2009 8:56 pm
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: 123
Location: Hyderabad

PostPosted: Wed May 13, 2009 4:33 pm
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 Developer


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

PostPosted: Wed May 13, 2009 9:01 pm
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: 123
Location: Hyderabad

PostPosted: Thu May 14, 2009 11:24 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top