Remove columns in detail rec Keeping header and trailer.

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
laksh74
Member
Posts: 4
Joined: Tue Aug 31, 2010 11:49 pm

Remove columns in detail rec Keeping header and trailer.

Post by laksh74 » Wed Sep 01, 2010 12:04 am

Hi,

I have the following input file for example.

HeaderRecord
AAAAABBBBBCCCCCDDDDDEEEEEFFFFF
AAAAABBBBBCCCCCDDDDDEEEEEFFFFF
AAAAABBBBBCCCCCDDDDDEEEEEFFFFF
TrailerRecord

I am trying to get the output file as below by skipping the B column and E column. Is there anyway that we could do this through jcl using ICETOOL ?
I want the header record and trailer record in the output file. Please help.

HeaderRecord
AAAAACCCCCDDDDDFFFFF
AAAAACCCCCDDDDDFFFFF
AAAAACCCCCDDDDDFFFFF
TrailerRecord


Thanks in advance.

Thanks
Raj

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Sep 01, 2010 12:56 am

Is there something in the header that identifies it (e.g. H in position 1)?

Is there something in the trailer that identifies it (e.g. T in position 1)?

What is the starting position and length of each relevant "column" for input and output?

What is the RECFM and LRECL of the input file and output file?

Are the data records in sorted order? If not, can they be placed in sorted order for output?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

laksh74
Member
Posts: 4
Joined: Tue Aug 31, 2010 11:49 pm

Remove columns in detail rec Keeping header and trailer

Post by laksh74 » Wed Sep 01, 2010 1:20 am

Hi Frank,

Thanks for the response.

Please see the answers below.

Yes, in Header and Trailer the first position is 'H' and 'T' respectively.

RECFM=FB and LRECL is 156 for input and output.

It can be sorted or not, it doesn't matter.

For the third question, I am giving you an example.

The detail record contains First name Last name Phone number City.
I need to have the phone number removed while writing to output file.(First name Last name City). The length of phone number is 10. Does this answer your question?


Thanks
Raj

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Sep 01, 2010 1:33 am

Since you didn't give me the starting positions for your fields in your new example, let's just go back to your original example and assume the columns are as you've shown. You can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code: Select all

//S1    EXEC  PGM=ICETOOL                    
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG  DD SYSOUT=*                                       
//IN DD DSN=...  input file                                                   
//OUT DD DSN=...  output file                                           
//TOOLIN DD *                                               
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)        
/*
//CTL1CNTL DD *                                             
  INREC BUILD=(1,5,11,5,16,5,26,5)                          
  SORT FIELDS=(1,5,CH,A)                                    
/*                                                          
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

laksh74
Member
Posts: 4
Joined: Tue Aug 31, 2010 11:49 pm

Remove columns in detail rec Keeping header and trailer

Post by laksh74 » Wed Sep 01, 2010 5:28 pm

Hi Frank,

Thanks a lot for helping me out.

I have a couple of questions. Just curious to know.

1. Is it possible to get the same output file without sorting (SORT FIELDS=(1,5,CH,A) ) ? (Just to have the input and output records in the same order) When I tried it throwed me error.

2. Lets say the input file length is 150, and after eliminating some of the columns the actual output length comes to 120. Is there anyway that we could make the length of the output file to be 120 instead of 150 ?

Thanks
Raj

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Sep 01, 2010 10:18 pm

DATASORT keeps the header and trailer in their original positions, but it requires a SORT statement. Since you have an H for the header and a T for the trailer, you could avoid sorting by using a DFSORT job like this which will also set the output length to 120:

Code: Select all

//S1    EXEC  PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/150)
//SORTOUT DD DSN=...  output file (FB/120)
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=120,
    IFTHEN=(WHEN=(1,1,CH,NE,C'H',AND,1,1,CH,NE,C'T'),
       BUILD=(1,5,11,5,16,5,26,5))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

laksh74
Member
Posts: 4
Joined: Tue Aug 31, 2010 11:49 pm

Post by laksh74 » Wed Sep 01, 2010 11:01 pm

Thanks a lot Frank.


Thanks
Raj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others