To delete the Trailer REcord from the file

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
mkk157
Member
Posts: 37
Joined: Wed Feb 07, 2007 2:00 pm
Location: Hyderabad

To delete the Trailer REcord from the file

Post by mkk157 » Tue Nov 27, 2007 2:28 pm

Dear Experts,

My requirement is to delete the trailer record from the Input file and keep all the records as it is.

The format of the Trailer record:

1000 rows selected.
12345 rows selected.
123456 rows selected.

for this requirement, I am able to remove the trailer record with the SORT card,

SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT1,
INCLUDE=(1,80,SS,NE,C'ROWS SELECTED')


but In the worst case, If any of the actual records contains the string 'rows selected' then they are also getting removed in addition to the trailer record.

Is there any command to point the Trailer record / Last record while using this sort card.
Kumar
If u can dream it, U can do it.

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

Post by Frank Yaeger » Tue Nov 27, 2007 9:31 pm

Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code: Select all

//S1    EXEC  PGM=ICEMAN                                           
//SYSOUT    DD  SYSOUT=*                                           
//SORTIN DD DSN=...  input file (FB/80)                               
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)         
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)        
//SYSIN    DD    *                                                 
  OPTION COPY                                                      
  OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,PD)                        
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,                             
    TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8),80:X)               
/*
//S2  EXEC  PGM=ICEMAN                                             
//SYSOUT    DD  SYSOUT=*                                           
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                             
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)                               
//SORTOUT1 DD DSN=...  output file (FB/80)                                             
//SYSIN    DD    *                                                 
  SORT FIELDS=COPY                                                 
  OUTFIL FNAMES=SORTOUT1,                                          
    OMIT=(81,8,PD,EQ,LASTREC),                                     
    BUILD=(1,80)                                                   
/*
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

Nanda Kishore
Member
Posts: 5
Joined: Mon Dec 10, 2007 7:48 pm

Post by Nanda Kishore » Tue Dec 18, 2007 5:26 pm

Dear Frank,

I check the above jcl.Its great.
I am very curious to know the syntax.Can you please explain

Code: Select all

//SYSIN    DD    *                                                  
  OPTION COPY                                                      
  OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,PD)                        
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,                              
    TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8),80:X)                
/* 

//SYSIN    DD    *                                                  
  SORT FIELDS=COPY                                                  
  OUTFIL FNAMES=SORTOUT1,                                          
    OMIT=(81,8,PD,EQ,LASTREC),                                      
    BUILD=(1,80)                                                    
/*

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

Post by Frank Yaeger » Tue Dec 18, 2007 9:44 pm

Code: Select all

  OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,PD)                        
Adds a sequence number to the end of each input record to create the T1 records.

Code: Select all

  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,                              
    TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8),80:X)                
Creates a DFSORT Symbol like this:

LASTREC,+dddddddd

where dddddddd is the count of the input records = the sequence number for the last record.

Code: Select all

                                    
  OUTFIL FNAMES=SORTOUT1,                                          
    OMIT=(81,8,PD,EQ,LASTREC),                                      
    BUILD=(1,80)                                     
The OMIT operand uses the LASTREC symbol to omit the last T1 record (remember that T1 has each input record with a sequence number at the end of it).

The BUILD operand removes the sequence number.

Does that help?
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

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 Jul 30, 2008 1:29 am

You can remove the last record quite easily without worrying about the RECFM or LRECL using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008):

Code: Select all

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DISP=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT REMOVE LAST
/*
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/sof ... /mvs/ugpf/
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

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 10:59 pm

<< Content deleted By Admin >>

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