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

How to remove the trailer record from the File


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Nov 27, 2007 12:29 pm
Reply with quote

Hi,

I have a quick query regarding the removal of a trailer record from a file.

The structure of the trailer record is not fixed. At the end of the file they are forcefully inserting

the trailer record with the record count and with the text 'rows selected'

Ex: 122394 rows selected

I am able to remove the trailer can use the INCLUDE COND=(???,13,CH,EQ,C'rows selected').

But when the record count changes the starting position of the text 'rows selected' will be changed

automatically.

In this case is there any command to remove the trialer record from the file.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Nov 27, 2007 12:39 pm
Reply with quote

mkk,

Try this -

Code:
//S1     EXEC PGM=SORT                             
//SYSOUT DD SYSOUT=*                               
//SYSPRINT DD SYSOUT=*                             
//SORTIN DD *                                     
1 ROWS SELECTED                                   
1000 ROWS SELECTED                                 
200000 ROWS SELECTED                               
DUMMY RECORD                                       
/*                                                 
//SORTOUT DD SYSOUT=*                             
//SYSIN  DD *                                     
  OPTION COPY                                     
  INCLUDE COND=(1,80,SS,NE,C'ROWS SELECTED')       
/*                                                 
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Tue Nov 27, 2007 1:41 pm
Reply with quote

Murali,

the sort card that you gave here is working fine. But In the worst case scenario, If the actual records contains the string 'rows selected' then those records are also removing in addition to the trailer record.

Here I need to point only the trailer record that is the last record in the file.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Nov 27, 2007 2:59 pm
Reply with quote

M K K,

Quote:
But In the worst case scenario, If the actual records contains the string 'rows selected' then those records are also removing in addition to the trailer record.


Follwoing is one of the the today's post. Might be you can use 'the jcl' and develop your own sort card -

ibmmainframes.com/viewtopic.php?t=26249
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: Tue Nov 27, 2007 11:04 pm
Reply with quote

M K K,

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:

//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,ZD)
  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)
//OUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUT,
    OMIT=(81,8,ZD,EQ,LASTREC),
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Thu Nov 29, 2007 11:32 am
Reply with quote

Thanks Frank. Its working fine.
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: Tue Sep 02, 2008 11:29 pm
Reply with quote

You can now do this kind of thing quite easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008):


Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  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:

Use [URL] BBCode for External Links
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 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
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top