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

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


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1702
Location: Australia

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

Hi,

yes, search for TRAILER1


Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Jan 13, 2012 6:27 am
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:

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
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

Moderator Emeritus


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

PostPosted: Fri Jan 13, 2012 9:25 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jan 13, 2012 9:27 pm
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 Developer


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

PostPosted: Fri Jan 13, 2012 11:57 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top