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
 
Adding Trailer record for o/p file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Prakashreddy

New User


Joined: 11 Aug 2005
Posts: 10
Location: Bangalore

PostPosted: Mon Sep 11, 2006 12:53 pm    Post subject: Adding Trailer record for o/p file
Reply with quote

Hi,
Here I am posting one typical question, which I faced in an interview. Please let me know the answer. I guess Frank Yaeger can do this.

I have one i/p file in the following format.

Code:

---------------------------------------------------
Emp#  Emp_Name   Emp_Sal   Emp_Dept
---------------------------------------------------


in this we may have many number of records, but i need to copy to o/p file with trailer record(at the end of file). The trailer record format would be

Code:

---------------------------------------------------
Emp_Count  'Trailer Record'  Sum_Sal
---------------------------------------------------


Emp_count means: total number of employees
Trailer Record means: we need to insert string ' Trailer Record'
Sum_ Sal means: Total sal. of all employees.

I need to use only JCL. I don't want to write program logic. If possible provide me total code for this.

This is the requirement. I think I am clear. Do let me know if not.

Thanks,
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: Mon Sep 11, 2006 8:46 pm    Post subject:
Reply with quote

Well, the exact control statements you'd use depend on the starting position, length and format of the Salary field and what exactly you want the output to look like. Assuming the Salary field was an 8-byte ZD field starting at position 30, the DFSORT job might look something like this:

Code:

//S1 EXEC PGM=ICEMAN                         
//SYSOUT DD SYSOUT=*                         
//SORTIN DD DSN=...  input file         
//SORTOUT DD DSN=...  output file                       
//SYSIN    DD *                             
    OPTION COPY                             
    OUTFIL REMOVECC,                         
       TRAILER1=(COUNT=(M11,LENGTH=8),       
         12:'Trailer Record',               
         30:TOT=(30,8,ZD,M11,LENGTH=8))     
//*                                         


If you want to prepare yourself for interview questions on DFSORT, 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/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
Prakashreddy

New User


Joined: 11 Aug 2005
Posts: 10
Location: Bangalore

PostPosted: Tue Sep 12, 2006 12:05 pm    Post subject:
Reply with quote

Thanks a lot Yaeger. I will go through the link.
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Tue Sep 12, 2006 4:40 pm    Post subject:
Reply with quote

Neat!
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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

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