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
 
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
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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