Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To delete a line in file using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: To delete a line in file using JCL
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    Post subject: 1 Solution
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
Currently Banned

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Fri May 05, 2006 5:14 pm    Post subject: ur solution
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    Post subject: Re: To delete a line in file using JCL
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 Moderator


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

PostPosted: Fri May 05, 2006 8:34 pm    Post subject:
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 Moderator


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

PostPosted: Fri May 05, 2006 8:36 pm    Post subject:
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    Post subject: Re: To delete a line in file using JCL
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    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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us