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

Adding Trailer record for o/p file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Mon Sep 11, 2006 8:46 pm
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:

Use [URL] BBCode for External Links
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top