MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to replace the first 10 records only thru batch file-aid

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
baansal
Beginner


Joined: 05 Jun 2007
Posts: 5
Topics: 4
Location: bangalore

PostPosted: Mon Sep 01, 2008 8:22 am    Post subject: How to replace the first 10 records only thru batch file-aid Reply with quote

Hello,

I want to replace some value only in the first 10 records using file-aid. Can any one help me in this matter.
I m using the below replace query.
$$DD01 UPDATE REPL=(51,EQ,C'abcdef',C'000000')

The above query is replacing all the records where it is finding 'abcdef' to '000000'. Could any one tell me what I need to add in this to make it update only first 10 records meeting condition, rest remain intact.


Many thanks
_________________
Cheers
----------
Baansal
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Mon Sep 01, 2008 10:03 am    Post subject: FEW mistakes Reply with quote

Hi,

Few mistakes were there..Sorry....Now, corrected.

Code:

//STEP1   EXEC PGM=FILEAID
.
.
//DD01     DD  DSN=YOUR.DATASET.NAME,DISP=SHR
//DD01O    DD DSN=&TEMP1,DISP=(NEW,PASS,DELETE),
//            UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)   
//*
//SYSIN    DD  *
$$DD01 COPY IF=(51,EQ,C'abcdef'),OUT=10
//*
//STEP2   EXEC PGM=FILEAID
.
.
//DD01     DD  DSN=&TEMP1,DISP=(OLD,PASS,PASS)
//DD01O    DD DSN=YOUR.OUTPUT.DATASET.NAME,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)   
//*
//SYSIN    DD  *
$$DD01 COPY REPL=(51,EQ,C'abcdef',C'000000')
//*


Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Sep 02, 2008 10:34 am    Post subject: Reply with quote

baansal,

The following DFSORT JCL will give you the desired results. It uses DFSORT's new FINDREP function available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008). I assumed that your input file length is 80 and is FB recfm.

Code:

//STEP0100 EXEC PGM=ICEMAN   
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=your input file,
//            DISP=SHR
//SORTOUT  DD DSN=your output file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFOUTLEN=80,                                               
        IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,PD)),               
        IFTHEN=(WHEN=(81,8,PD,LE,10),                             
        FINDREP=(IN=C'ABCDEF',OUT=C'000000',STARTPOS=51,ENDPOS=56))
/*


For complete details on the new FINDREP function and the other new functions available with PTF UK90013, see:

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

Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Sep 04, 2008 4:43 am    Post subject: SYNCSORT solution for this! Reply with quote

Hi,

It will be very interesting to know SYNCSORT solution for the same.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group