Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us