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

Can we write trailer in required format with count in DFSORT


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

New User


Joined: 07 Oct 2008
Posts: 3
Location: Bangalore, India

PostPosted: Wed Mar 04, 2009 4:11 pm
Reply with quote

Hi!

I have a requirement wherein I need to append a trailer record to a file in a specific format. The input file will have header and detail records. Assume header format like something having rec type, date created, file type fields. I need to write the trailer which is same as the header, except for an additional field with the count value (which includes the header and trailer while counting).

Can this be achieved through DFSORT/ICETOOL? I do not want to write a new COBOL program just for counting and attaching the trailer.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Mar 04, 2009 4:14 pm
Reply with quote

Had you have searched you would have found this topic posted today.

Click HERE to see anvery similar request.
Back to top
View user's profile Send private message
Dhivya Santosh

New User


Joined: 07 Oct 2008
Posts: 3
Location: Bangalore, India

PostPosted: Wed Mar 04, 2009 4:21 pm
Reply with quote

Hi,
I saw the reply already, but it did not answer one question. Sorry I had not been elaborate in my previous post.

Eg.
<header> 020080303K
<detail1> 1002897189009I20041201
<detail2> 1009922308245I20060923
:
:
<trailer> 920080303K002902 <say>

I can hardcode the rec type and file type, but I need to copy the date (which changes daily) from the header record to the trailer.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Mar 04, 2009 10:41 pm
Reply with quote

dhivya santhosh,

You can very easily push the header record on to the trailer using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

I assumed your input is 80 byte lrecl and FB recfm

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
<HEADER> 020080303K                                     
<DETAIL1> 1002897189009I20041201                         
<DETAIL2> 1009922308245I20060923                         
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,8,CH,EQ,C'<HEADER>'),
  PUSH=(81:11,9))                                       
  OUTFIL REMOVECC,BUILD=(1,80),                         
  TRAILER1=('<TRAILER> 9',81,9,COUNT=(M11,LENGTH=6))     
/*


The output from this job is
Code:

<HEADER> 020080303K                 
<DETAIL1> 1002897189009I20041201     
<DETAIL2> 1009922308245I20060923     
<TRAILER> 920080303K000003           


If you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).

For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Dhivya Santosh

New User


Joined: 07 Oct 2008
Posts: 3
Location: Bangalore, India

PostPosted: Mon Mar 16, 2009 5:02 pm
Reply with quote

Hi,

Thanks for the resolution. Sorry for the delay in getting back.
The above function is very useful and I used it for manipulating header record as well for another application.

Thanks again!!
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 Populate last day of the Month in MMD... SYNCSORT 2
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top