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

To delete a line in file using JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ralph_v

New User


Joined: 07 Jul 2005
Posts: 27

PostPosted: Fri May 05, 2006 10:41 am
Reply with quote

Hi,

Suppose there are 100 lines in a file and i want to delete only the 10th line in that file. Is that possible in JCL.
If yes , how is it possible.
Back to top
View user's profile Send private message
mainframesguru

New User


Joined: 24 Jun 2005
Posts: 36
Location: Hyderabad

PostPosted: Fri May 05, 2006 12:58 pm
Reply with quote

Hi

It can be done otherway round.Instead of Deleting, Copy records other
than 10th into other datasets.Check the following procedure.

STEP01: Copy 1-9 records into a temporary file, using IDCAMS REPRO COUNT(9).
STEP02: Copy 11-100 records into a temporary file, using IDCAMS REPRO SKIP(10)
STEP03: Concatenate Temporary files of STEP01 and STEP02 and copy it to Input file.


There can be other solutions to this one.....

Regards,
Vamshi Krishna Indla
Hyderabad
Back to top
View user's profile Send private message
ajayvamsi

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Fri May 05, 2006 5:14 pm
Reply with quote

go for sort
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Fri May 05, 2006 7:19 pm
Reply with quote

This works with ICETOOL

//ICE1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//REPORT DD SYSOUT=*
//*
//IN001 DD DSN=XXXXX.IN1,
// DISP=SHR
//TOOLIN DD *
COPY FROM(IN001) TO(OUT001) USING(S001)
COPY FROM(IN001) TO(OUT001) USING(S002)
/*
//S001CNTL DD *
SORT FIELDS=COPY,STOPAFT=0000009
//S002CNTL DD *
SORT FIELDS=COPY,SKIPREC=00010
//OUT001 DD DSN=XXXXX.OU1,DISP=MOD
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: Fri May 05, 2006 8:34 pm
Reply with quote

You can do it in one pass with DFSORT as follows. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN                         
//SYSOUT    DD  SYSOUT=*                         
//SORTIN DD DSN=...  input file (FB/80)             
//SORTOUT DD DSN=...  output file (FB/80)                           
//SYSIN    DD    *                               
  OPTION COPY                                   
  INREC OVERLAY=(81:SEQNUM,5,ZD)                 
  OUTFIL OMIT=(81,5,ZD,EQ,+10),BUILD=(1,80)     
/*
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: Fri May 05, 2006 8:36 pm
Reply with quote

IQofaGerbil,

When you specify a COPY operator, DFSORT automatically does a copy so you don't need SORT FIELDS=COPY. Your control statements should be:

Code:

//TOOLIN DD *
COPY FROM(IN001) TO(OUT001) USING(S001)
COPY FROM(IN001) TO(OUT001) USING(S002)
/*
//S001CNTL DD *
   OPTION STOPAFT=9
/*
//S002CNTL DD *
   OPTION SKIPREC=10
/*
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Fri May 05, 2006 9:09 pm
Reply with quote

Frank,

Thanks, old habits die hard!
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts DELETE SPUFI DB2 1
Search our Forums:

Back to Top