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
 

 

Adding a String to end of file using trailer record in JCL.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sivakumar M

New User


Joined: 03 Jul 2011
Posts: 8
Location: india

PostPosted: Fri Jan 13, 2012 4:33 am    Post subject: Adding a String to end of file using trailer record in JCL.
Reply with quote

I have an input file which lot of numeric data in it. Using Sort I am doing some arithmetic operation and writing to the output file. At the end of the process, I do need to add a string which represents the process got over.
Is there any way to do this using Trailer in JCL SORT?

Input file:

xyz 01
XYZ 01
ABC 05
BBC 02
ABC 02

Output file:
XYZ 02
ABC 07
BBC 02
***End of process*** --> Please suggest how to add this string at this position.
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jan 13, 2012 4:45 am    Post subject:
Reply with quote

Hi,

yes, search for TRAILER1


Gerry
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: Fri Jan 13, 2012 6:27 am    Post subject:
Reply with quote

It's difficult to give you the exact control statements since we don't know if you're using SUM or OUTFIL to get the totals, but you could add a trailer record with a DFSORT OUTFIL statement like this:

Code:

   OUTFIL REMOVECC,TRAILER1=('***end of process***')


If you're already using OUTFIL, then add that to your OUTFIL statement.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
sivakumar M

New User


Joined: 03 Jul 2011
Posts: 8
Location: india

PostPosted: Fri Jan 13, 2012 9:18 pm    Post subject:
Reply with quote

Hi Frank,

Thanks for your suggestion. As you mentioned, I am already using OUTFIL statement in my SORT. When I use HEADER1 with TRAILER1, it is working fine. But when I use the combination of HEADER1,TRAILER1,HEADER2 in the SORT, I am getting error. Can you please suggest ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jan 13, 2012 9:25 pm    Post subject:
Reply with quote

Hello,

Quote:
But when I use the combination of HEADER1,TRAILER1,HEADER2 in the SORT, I am getting error.
And why is the error not posted. . . icon_confused.gif
Telling us "it didn't work" is probably the biggest waste of time / space on the forum.

You need to post the complete diagnostic information from the problem run along with the jcl and sort control statements.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7254

PostPosted: Fri Jan 13, 2012 9:27 pm    Post subject: Reply to: Adding a String to end of file using trailer recor
Reply with quote

Can you show the cards you have used and the messages you got/data you created which shows what did not work, including clear indication of what was not working.

All in the Code tags, please.
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: Fri Jan 13, 2012 11:57 pm    Post subject:
Reply with quote

Quote:
Thanks for your suggestion. As you mentioned, I am already using OUTFIL statement in my SORT. When I use HEADER1 with TRAILER1, it is working fine. But when I use the combination of HEADER1,TRAILER1,HEADER2 in the SORT, I am getting error. Can you please suggest ?


HEADER1, TRAILER1 and HEADER2 is a valid combination for OUTFIL so you most likely have a syntax error. Since I can't see what you're doing or read your mind, I can't suggest how to fix the error. You'd have to show me what your control statements look like for me to do that.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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