IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Copy all except last record

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
View previous topic :: View next topic  
Author Message
kumara.kranthi



Joined: 03 Nov 2006
Posts: 19

Posted: Thu Jul 31, 2008 6:02 pm    Post subject: If i want to skip last record  

Hello All,

Please help me my file contain N records , i want to copy N-1 records and skip Last records,Please give Sort Card for this.

Thanks,
KK
Back to top  
expat



Joined: 14 Mar 2007
Posts: 3544
Location: Brussels once more ...

Posted: Thu Jul 31, 2008 7:22 pm    Post subject:  

kumara.kranthi

Please do not start a new topic in an existing thread.

Topic split.
Back to top  
ksk



Joined: 08 Jun 2006
Posts: 308
Location: Pune, India

Posted: Thu Jul 31, 2008 8:18 pm    Post subject:  

You can use the folowing code.

Code:
//STEP1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//INDD DD DSN= INPUT FILE
//OUTDD DD DISP=OUTPUT FILE
//TOOLIN DD *
   SUBSET FROM (INDD) TO (OUTDD) REMOVE INPUT LAST
/*
Back to top  
Frank Yaeger



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

Posted: Thu Jul 31, 2008 8:58 pm    Post subject:  

KK,

Note that you will need z/OS DFSORT V1R5 PTF UK90013 (July, 2008) in order to use the new SUBSET operator. Ask your System Programmer to install that PTF (it's free). For complete details on all of the new functions available with that PTF, see:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/

In the meantime, you can use the technique described in the "Keep the last n records" Smart DFSORT Trick at:

www.ibm.com/systems/support/storage/software/sort/mvs/tricks/
Back to top  
kumara.kranthi



Joined: 03 Nov 2006
Posts: 19

Posted: Fri Aug 01, 2008 10:49 am    Post subject:  

Frank,

Thanks for yours help!!

Example: My file contain 1000 records or N records (include header and trailer),now i want to do Skip 1st and last record and copy all the records.


Could you please help me for Sort card on this.

Thanks,
KK
Back to top  
Frank Yaeger



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

Posted: Fri Aug 01, 2008 8:32 pm    Post subject:  

Again, you can use the new SUBSET operator as follows if you have 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) REMOVE INPUT HEADER TRAILER
/*


I can show you a more complex way to do this without SUBSET, but I need to know the RECFM and LRECL of the input file.
Back to top  
kumara.kranthi



Joined: 03 Nov 2006
Posts: 19

Posted: Mon Aug 04, 2008 12:12 pm    Post subject:  

Thanks for yours quick response.

LRECL=210 and RECFM=FB
Back to top  
ksk



Joined: 08 Jun 2006
Posts: 308
Location: Pune, India

Posted: Mon Aug 04, 2008 5:03 pm    Post subject:  

Frank,

Just I want to ask a question on version of DFSORT.

How can we check whether the SORT we are using is z/OS DFSORT V1R5 PTF UK90013 or not?

When I am executing SORT, getting the following.

Quote:
CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5.


Is this updated version to execute newly included options like SUBSET?
Back to top  
Frank Yaeger



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

Posted: Mon Aug 04, 2008 9:05 pm    Post subject:  

Quote: How can we check whether the SORT we are using is z/OS DFSORT V1R5 PTF UK90013 or not?

Run a DFSORT job and look at the ICE201I message. If it has an F after ICE201I, you have PTF UK90013.

ICE201I F RECORD TYPE ...

If it has an E after ICE201I, you don't have PTF UK90013.

Note that your System Programmer must install PTF UK90013 in order to make it available.

Quote: When I am executing SORT, getting the following.

CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5.

Is this updated version to execute newly included options like SUBSET?


That message just tells you you're using z/OS DFSORT V1R5 ... it doesn't tell you which PTFs are installed. You need PTF UK90013 to use SUBSET (see ICE201I to determine if you have that PTF).
Back to top  
Frank Yaeger



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

Posted: Mon Aug 04, 2008 9:23 pm    Post subject:  

kumara.kranthi,

Here's a DFSORT job that will do what you asked for without PTF UK90013:

Code:
//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/210)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=C1,REMOVECC,NODETAIL,
    BUILD=(80X),
    TRAILER1=(' OPTION COPY,SKIPREC=1,',
     'STOPAFT=',COUNT-2=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/210)
//SORTOUT DD DSN=...  output file (FB/210)
//SYSIN DD DSN=&&C1,DISP=(OLD,PASS)
Back to top  
sri_mf



Joined: 31 Aug 2006
Posts: 197
Location: At my Desk

Posted: Wed Aug 06, 2008 4:15 pm    Post subject:  

Frank Yaeger wrote: Quote: How can we check whether the SORT we are using is z/OS DFSORT V1R5 PTF UK90013 or not?

Run a DFSORT job and look at the ICE201I message. If it has an F after ICE201I, you have PTF UK90013.

ICE201I F RECORD TYPE ...

If it has an E after ICE201I, you don't have PTF UK90013.

Note that your System Programmer must install PTF UK90013 in order to make it available.

Quote: When I am executing SORT, getting the following.

CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5.

Is this updated version to execute newly included options like SUBSET?


That message just tells you you're using z/OS DFSORT V1R5 ... it doesn't tell you which PTFs are installed. You need PTF UK90013 to use SUBSET (see ICE201I to determine if you have that PTF).

Hi Frank i found this :
Code:
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1


Does this mean that PTFs are installed.
Back to top  
dick scherrer



Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St

Posted: Wed Aug 06, 2008 9:10 pm    Post subject:  

Hello,

Look at your message and Frank's info.

Your message has an E following ICE201I - which is not PTF UK90013 (which is an F).
Back to top  
sri_mf



Joined: 31 Aug 2006
Posts: 197
Location: At my Desk

Posted: Thu Aug 07, 2008 9:46 am    Post subject:  

dick scherrer wrote: Hello,

Look at your message and Frank's info.

Your message has an E following ICE201I - which is not PTF UK90013 (which is an F).

Little confused earlier..Now Got it..Thank you dick..
Back to top  
dick scherrer



Joined: 23 Nov 2006
Posts: 8733
Location: 221 B Baker St

Posted: Thu Aug 07, 2008 7:22 pm    Post subject: Reply to: Copy all except last record  

You're welcome :)

Quote: Little confused earlier.. Not to worry, we all get there sometimes :wink:

d
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM