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
 

 

DFSORT - change count in trailer

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

New User


Joined: 20 Sep 2005
Posts: 24

PostPosted: Wed Aug 27, 2008 11:23 pm    Post subject: DFSORT - change count in trailer
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 Moderator


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

PostPosted: Wed Aug 27, 2008 11:43 pm    Post subject:
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: 24

PostPosted: Thu Aug 28, 2008 12:03 am    Post subject:
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 Moderator


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

PostPosted: Thu Aug 28, 2008 1:11 am    Post subject:
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 Moderator


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

PostPosted: Sat Nov 06, 2010 3:37 am    Post subject:
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:

http://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    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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Fail to change physical VSAM filename... jacobdng CICS 7 Fri Jan 20, 2017 12:36 pm


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