Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : programming pearls - The fastest algorithm can frequently be replaced by one that is almost as fast and much easier to understand.

Google
 
Web mainframegurukul.com

Welcome to the mainframegurukul forums.

You are currently viewing our mainframe forums as a guest which gives you limited access to view most discussions, articles. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support at admin@mainframegurukul.com


To delete the Trailer REcord from the file

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
mkk157
Member


Joined: 07 Feb 2007
Posts: 37
Location: Hyderabad

PostPosted: Tue Nov 27, 2007 2:28 pm    Post subject: To delete the Trailer REcord from the file Reply with quote

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.
Back to top
View user's profile Send private message Yahoo Messenger

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 487
Location: San Jose, CA

PostPosted: Tue Nov 27, 2007 9:31 pm    Post subject: Reply with quote

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,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/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nanda Kishore
Member


Joined: 10 Dec 2007
Posts: 5

PostPosted: Tue Dec 18, 2007 5:26 pm    Post subject: Reply with quote

Dear Frank,

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

Code:

//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)                                                   
/*
Back to top
View user's profile Send private message
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 487
Location: San Jose, CA

PostPosted: Tue Dec 18, 2007 9:44 pm    Post subject: Reply with quote

Code:

  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:

  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:
                                   
  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/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 487
Location: San Jose, CA

PostPosted: Wed Jul 30, 2008 1:29 am    Post subject: Reply with quote

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:

//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/software/sort/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/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Easytrieve program for getting Recound counts. 1 prakash.subramaniam 1578 Mon Oct 05, 2009 5:09 pm
Natarajan View latest post
No new posts Getting Error while using ICEMAN tool 4 giri211 2138 Mon Aug 31, 2009 3:59 pm
giri211 View latest post
No new posts Replacing characters Using JCL 5 rachitsethcse 2942 Thu Jul 23, 2009 9:46 pm
Frank Yaeger View latest post
No new posts Getting no of records in a file 8 Rajapriyaa 2479 Mon May 18, 2009 11:30 am
Anuj Dhawan View latest post
No new posts Calling COBOL from C - getting SOC1 0 balajiiinx 2673 Tue Sep 23, 2008 10:25 am
balajiiinx View latest post
 



This widget requires Flash Player 9 or better








Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB