Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Remove first and last record and copy other records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
squid_rocks

New User


Joined: 21 Mar 2005
Posts: 15
Location: Pune, INDIA

PostPosted: Wed Oct 25, 2006 12:06 am    Post subject: Remove first and last record and copy other records
Reply with quote

I want to eleminate first and last record from input file and copy rest of the records to an output file.
I can only use SORT (DFSORT or SYNCSORT) and FILEAID.

Please advice.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Oct 25, 2006 12:55 am    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/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=T1,OVERLAY=(101:SEQNUM,8,ZD)
  OUTFIL FNAMES=S1,REMOVECC,NODETAIL,BUILD=(80X),
    TRAILER1=('Lastrec,+',COUNT=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file (FB/100)
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(101,8,ZD,EQ,+1,OR,101,8,ZD,EQ,Lastrec)
  OUTREC BUILD=(1,100)
/*
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Fri Oct 27, 2006 10:49 am    Post subject:
Reply with quote

Frank,

How do we capture the removed header record into another flat file?

Many thanks,
Twissi.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Oct 27, 2006 8:30 pm    Post subject:
Reply with quote

If you want the data records in one file and the header record in another file, you can use this DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=T1,OVERLAY=(101:SEQNUM,8,ZD)
  OUTFIL FNAMES=S1,REMOVECC,NODETAIL,BUILD=(80X),
    TRAILER1=('Lastrec,+',COUNT=(M11,LENGTH=8))
/*
//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/100)
//HDR     DD DSN=... header record file (FB/100)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=OUT,
    OMIT=(101,8,ZD,EQ,+1,OR,101,8,ZD,EQ,Lastrec),
    BUILD=(1,100)
  OUTFIL FNAMES=HDR,ENDREC=1,BUILD=(1,100)
/*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Sep 05, 2008 9:45 pm    Post subject:
Reply with quote

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

Code:

//S1  EXEC  PGM=ICETOOL                                           
//TOOLMSG   DD  SYSOUT=*                                         
//DFSMSG    DD  SYSOUT=*                                         
//IN DD DSN=...  input file (FB/100)
//OUT     DD DSN=... output file (FB/100)
//HDR     DD DSN=... header record file (FB/100)
//TOOLIN DD *                                                     
SUBSET FROM(IN) TO(OUT) REMOVE INPUT HEADER TRAILER -             
  DISCARD(HDR) USING(CTL1)                                       
/*
//CTL1CNTL DD *                   
  OUTFIL FNAMES=OUT               
  OUTFIL FNAMES=HDR,ENDREC=1     
/*


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/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us