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 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 Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm


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