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
 

 

Can we write trailer in required format with count in DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Can we write trailer in required format with count in DFSORT
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: 8593
Location: Back in jolly old England

PostPosted: Wed Mar 04, 2009 4:14 pm    Post subject:
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    Post subject:
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    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
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    Post subject:
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    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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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