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

DFSORT - change count in trailer


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

New User


Joined: 20 Sep 2005
Posts: 25

PostPosted: Wed Aug 27, 2008 11:23 pm
Reply with quote

I have an input file with the following records.

01 A01 OLS xxxxx xxx Extract ABC 20071205160019
02 52011447501A XXXXXX
02 60065593304B XXXXXX
02 71144687822C XXXXXX
02 60141379301A XXXXXX
02 60191546701D XXXXXX
02 60191747301E XXXXXX
02 60082525304Z XXXXXX
02 60082525401A XXXXXX
02 60082529804Z XXXXXX
02 60082529807P XXXXXX
02 60082529811B XXXXXX
02 60082529812E XXXXXX
02 60082820601F XXXXXX
99 13

It allways starts with 01 as the header with 02 as the detail and 99 as the trailer which has the count of 02 details records.

Our requirement is that we need to eliminate few detail records. Using Omit condition we are able to eliminate the records but the problem is in the trailer record is not reflecting the correct count. We would like the trailer record to be equal to the number of 02 records detail records after the omit condition.
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 Aug 27, 2008 11:43 pm
Reply with quote

Let's assume for the sake of an example that your OMIT statement looks like this:

Code:

     OMIT COND=(5,1,CH,EQ,C'5',OR,5,1,CH,EQ,C'7')   


You can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(1,2,CH,EQ,C'99',OR,
    5,1,CH,EQ,C'5',OR,5,1,CH,EQ,C'7')
  OUTFIL REMOVECC,TRAILER1=('99',X,COUNT-1=(EDIT=(TT)))
/*


For your example input records, SORTOUT would have:

Code:

01 A01 OLS xxxxx xxx Extract ABC 20071205160019       
02  60065593304B XXXXXX                               
02  60141379301A XXXXXX                               
02  60191546701D XXXXXX                               
02  60191747301E XXXXXX                               
02  60082525304Z XXXXXX                               
02  60082525401A XXXXXX                               
02  60082529804Z XXXXXX                               
02  60082529807P XXXXXX                               
02  60082529811B XXXXXX                               
02  60082529812E XXXXXX                               
02  60082820601F XXXXXX                               
99 11                                                 


Adjust the OMIT statement as needed like this:

Code:

  OMIT COND=(1,2,CH,EQ,C'99',OR,
    your conditions)
Back to top
View user's profile Send private message
ballaswaroop

New User


Joined: 20 Sep 2005
Posts: 25

PostPosted: Thu Aug 28, 2008 12:03 am
Reply with quote

Thanks Frank but can it be done using SORT instead of ICEMAN becuase COUNT-1 does not seems to be working
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: Thu Aug 28, 2008 1:11 am
Reply with quote

Quote:
can it be done using SORT instead of ICEMAN


PGM=ICEMAN and PGM=SORT are identical - they both invoke DFSORT in the same way. SORT is an alias for ICEMAN.

Quote:
COUNT-1 does not seems to be working


This has nothing to do with using PGM=ICEMAN vs PGM=SORT. It may have to do with DFSORT PTFs you don't have installed. Show all of the //SYSOUT messages you received.
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: Sat Nov 06, 2010 3:37 am
Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new IFTRAIL function to update the trailer record instead of rebuilding it like this:

Code:

//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(5,1,CH,EQ,C'5',OR,5,1,CH,EQ,C'7')
  OUTFIL IFTRAIL=(HD=YES,TRLID=(1,2,CH,EQ,C'99'),
    TRLUPD=(4:COUNT=(EDIT=(TT))))
/*


For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
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 To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top