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

how can skip last record


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

New User


Joined: 11 Jan 2008
Posts: 5
Location: india

PostPosted: Thu Jan 17, 2008 4:50 pm
Reply with quote

is that possible, i skip last record from a file
and copy rest of record in new file
with the use of JCL only


if record count is not specify
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: Thu Jan 17, 2008 10:38 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN   DD    *
COPY FROM(IN) USING(CTL1)
COPY FROM(IN) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=CTL2CNTL,REMOVECC,NODETAIL,
    BUILD=(80X),
    TRAILER1=('  OPTION STOPAFT=',COUNT-1=(M11,LENGTH=8))
/*
Back to top
View user's profile Send private message
naveeneckumar

New User


Joined: 11 Jan 2008
Posts: 5
Location: india

PostPosted: Fri Jan 18, 2008 9:22 am
Reply with quote

thanks a lot
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Mon Jan 21, 2008 1:17 pm
Reply with quote

Pls explain the use of TRAILER1 here.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jan 21, 2008 2:04 pm
Reply with quote

Code:
TRAILER1=('  OPTION STOPAFT=',COUNT-1=(M11,LENGTH=8))

TRAILER1 builds a record with the count-1(total count of records - 1) at the last page of the report(however here we have mentioned NODETAIL, so TRAILER1 would be the only line on the o/p in this case). Finally TRAILER1 is building a control card CTL2CNTL.

To understand the working of TRAILER1 just try executing this
Code:
//****************************************
//STEP1    EXEC PGM=ICEMAN               
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *                           
ASDF                                     
qwer                                     
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                           
           OPTION COPY                   
           OUTFIL NODETAIL,REMOVECC,     
          TRAILER1=('  OPTION STOPAFT=',COUNT-1=(M11,LENGTH=8))


Also look at "Display the number of input or output records" here

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Mon Jan 21, 2008 2:49 pm
Reply with quote

Thanks. Is that possible to add sort condition also here??
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jan 21, 2008 2:59 pm
Reply with quote

Prabha wrote:
Thanks. Is that possible to add sort condition also here??
Please be clear!!
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: Mon Jan 21, 2008 9:24 pm
Reply with quote

Quote:
Is that possible to add sort condition also here??


It's not clear what you mean by this. What do you want to do exactly? Please be more specific.

If you're not familiar with DFSORT and DFSORT's ICETOOL, 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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 27, 2008 11:32 pm
Reply with quote

You can 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 DISP=...  output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT REMOVE LAST
/*



The above job removes the last input record. If you want to sort the records and remove the last sorted record, you can use a DFSORT/ICETOOL job like this:

Code:

//S2   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) OUTPUT REMOVE LAST USING(CTL1)
/*
//CTL1CNTL DD *
   SORT FIELDS=(1,10,CH,A)
/*


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 SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top