View previous topic :: View next topic
|
Author |
Message |
Prakashreddy
New User
Joined: 11 Aug 2005 Posts: 10 Location: Bangalore
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Prakashreddy
New User
Joined: 11 Aug 2005 Posts: 10 Location: Bangalore
|
|
|
|
Thanks a lot Yaeger. I will go through the link. |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Neat! |
|
Back to top |
|
|
|