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
 

 

Replace is not working!

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

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Fri Mar 25, 2011 6:31 pm    Post subject: Replace is not working!
Reply with quote

Hi,

I am copying PS file to KSDS file thru IDCAMS REPRO. PS file has 5 duplicate records.

When i copy those, job should not hang. Hence, i used REPLACE command. But the job abended with 'RECORD OUT OF SEQUENCE' issue.

Please help me how to resolve this. Thanks.

Vijay
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Mar 25, 2011 6:57 pm    Post subject: Reply to: Replace is not working!
Reply with quote

OK. Use a SORT, eliminate the duplicates, and make sure the key is in the proper sorted order.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri Mar 25, 2011 6:58 pm    Post subject: Reply to: Replace is not working!
Reply with quote

Quote:
But the job abended with 'RECORD OUT OF SEQUENCE' issue.


What is that You do not understand in the symptom 'RECORD OUT OF SEQUENCE' ???
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Fri Mar 25, 2011 7:12 pm    Post subject:
Reply with quote

Quote:
When i copy those, job should not hang.
What do you mean by "hang"? Jobs may go into a wait state for resources while executing, but copying records to a VSAM file typically won't cause this.

Further, if you've done any work at all with VSAM files, you have discovered that the key of a KSDS must consist of unique records. So why on earth are not you removing the duplicates BEFORE loading the records into the KSDS?
Back to top
View user's profile Send private message
cvijay784
Warnings : 1

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Sat Mar 26, 2011 10:52 am    Post subject: Reply to: Replace is not working!
Reply with quote

But I read that Replace keyword is used to remove the duplicates from being loaded into KSDS.

Does this abend mean that replace has no effect over KSDS?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Sat Mar 26, 2011 1:13 pm    Post subject:
Reply with quote

The problem is stated in plain English, right in front of your eyes, and Enrico has conveniently highlighted the exact problem for you, just in case you missed it yourself.

Kevin has given you the solution to the problem.

Had you of course bothered to read the related messages and codes then you would possibly have a slight understanding of why the problem occurred.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Sat Mar 26, 2011 2:09 pm    Post subject: Reply to: Replace is not working!
Reply with quote

it rally bothers me when people are so lazy/incapable to run a simple <benchamrk> like

step1 define and load(repro) a simple ksds with some records
Code:

000001 //ENRICO1K JOB (H001),'ZKSDS',NOTIFY=ENRICO,
000002 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
000003 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000004 //*
000005 //AMS      EXEC PGM=IDCAMS
000006 //SYSPRINT   DD SYSOUT=*
000007 //*4567890
000008 //KSDSDATA   DD *
000009 0000000000 ORIGINAL
000010 1111111111 ORIGINAL
000011 2222222222 ORIGINAL
000012 3333333333 ORIGINAL
000013 4444444444 ORIGINAL
000014 5555555555 ORIGINAL
000015 6666666666 ORIGINAL
000016 7777777777 ORIGINAL
000017 8888888888 ORIGINAL
000018 9999999999 ORIGINAL
000019 //*
000020 //SYSIN      DD *
000021   DELETE (ENRICO.MF.KSDS.CL)   CLUSTER PURGE
000022   SET LASTCC=0
000023   SET MAXCC=0
000024
000025   DEFINE CLUSTER( -
000026                 NAME(ENRICO.MF.KSDS.CL) -
000027                 INDEXED KEYS(10 0) -
000028                 SHR(2 3) CYL(1 1) VOL(STOR01) ) -
000029          DATA(    -
000030                 RECSZ(80 80) CISZ(4096) FREESPACE(0 0) )
000031
000032   IF MAXCC  = 0 THEN -
000033      REPRO INFILE(KSDSDATA) OUTDATASET(ENRICO.MF.KSDS.CL)
000034
000035   IF MAXCC  = 0 THEN -
000036      PRINT INDATASET(ENRICO.MF.KSDS.CL) CHAR


step2 repro replace some records - no duplicates )
Code:

000001 //ENRICO1K JOB (H001),'ZKSDS',NOTIFY=ENRICO,
000002 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
000003 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000004 //*
000005 //AMS      EXEC PGM=IDCAMS
000006 //SYSPRINT   DD SYSOUT=*
000007 //*4567890
000008 //KSDSDATA   DD *
000009 0000000000 REPLACE1
000010 2222222222 REPLACE1
000011 4444444444 REPLACE1
000012 6666666666 REPLACE1
000013 8888888888 REPLACE1
000014 //*
000015 //SYSIN      DD *
000016   REPRO INFILE(KSDSDATA) OUTDATASET(ENRICO.MF.KSDS.CL) -
000017         REPLACE
000018
000019   PRINT INDATASET(ENRICO.MF.KSDS.CL) CHAR


step3 repro replace some records - with duplicates
Code:

000001 //ENRICO1K JOB (H001),'ZKSDS',NOTIFY=ENRICO,
000002 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
000003 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000004 //*
000005 //AMS      EXEC PGM=IDCAMS
000006 //SYSPRINT   DD SYSOUT=*
000007 //*4567890
000008 //KSDSDATA   DD *
000009 1111111111 REPLACE2
000010 1111111111 REPLACE2
000011 3333333333 REPLACE2
000012 3333333333 REPLACE2
000013 5555555555 REPLACE2
000014 5555555555 REPLACE2
000015 7777777777 REPLACE2
000016 7777777777 REPLACE2
000017 9999999999 REPLACE2
000018 9999999999 REPLACE2
000019 //*
000020 //SYSIN      DD *
000021   REPRO INFILE(KSDSDATA) OUTDATASET(ENRICO.MF.KSDS.CL) -
000022         REPLACE
000023
000024   PRINT INDATASET(ENRICO.MF.KSDS.CL) CHAR



and here is the output

and here is the output

( initial load )
Code:

IDCAMS  SYSTEM SERVICES                                           TIME: 09:29:52

DELETE (ENRICO.MF.KSDS.CL)   CLUSTER PURGE
IDC0550I ENTRY (D) ENRICO.MF.KSDS.CL.DATA DELETED
IDC0550I ENTRY (I) ENRICO.MF.KSDS.CL.INDEX DELETED
IDC0550I ENTRY (C) ENRICO.MF.KSDS.CL DELETED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0

SET LASTCC=0

SET MAXCC=0


DEFINE CLUSTER( -
NAME(ENRICO.MF.KSDS.CL) -
INDEXED KEYS(10 0) -
SHR(2 3) CYL(1 1) VOL(STOR01) ) -
DATA(    -
RECSZ(80 80) CISZ(4096) FREESPACE(0 0) )
IDC0508I DATA ALLOCATION STATUS FOR VOLUME STOR01 IS 0
IDC0509I INDEX ALLOCATION STATUS FOR VOLUME STOR01 IS 0
IDC0512I NAME GENERATED-(D) ENRICO.MF.KSDS.CL.DATA
IDC0512I NAME GENERATED-(I) ENRICO.MF.KSDS.CL.INDEX
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0


IF MAXCC  = 0 THEN -
REPRO INFILE(KSDSDATA) OUTDATASET(ENRICO.MF.KSDS.CL)
IDC0005I NUMBER OF RECORDS PROCESSED WAS 10
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0


IF MAXCC  = 0 THEN -
PRINT INDATASET(ENRICO.MF.KSDS.CL) CHAR
IDCAMS  SYSTEM SERVICES                                           TIME: 09:29:52
LISTING OF DATA SET -ENRICO.MF.KSDS.CL
KEY OF RECORD - 0000000000
0000000000 ORIGINAL
KEY OF RECORD - 1111111111
1111111111 ORIGINAL
KEY OF RECORD - 2222222222
2222222222 ORIGINAL
KEY OF RECORD - 3333333333
3333333333 ORIGINAL
KEY OF RECORD - 4444444444
4444444444 ORIGINAL
KEY OF RECORD - 5555555555
5555555555 ORIGINAL
KEY OF RECORD - 6666666666
6666666666 ORIGINAL
KEY OF RECORD - 7777777777
7777777777 ORIGINAL
KEY OF RECORD - 8888888888
8888888888 ORIGINAL
KEY OF RECORD - 9999999999
9999999999 ORIGINAL
IDC0005I NUMBER OF RECORDS PROCESSED WAS 10
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
IDCAMS  SYSTEM SERVICES                                           TIME: 09:29:52
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0


( first replace )
Code:

IDCAMS  SYSTEM SERVICES                                           TIME: 09:30:30

REPRO INFILE(KSDSDATA) OUTDATASET(ENRICO.MF.KSDS.CL) -
REPLACE
IDC0005I NUMBER OF RECORDS PROCESSED WAS 5
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0


PRINT INDATASET(ENRICO.MF.KSDS.CL) CHAR
IDCAMS  SYSTEM SERVICES                                           TIME: 09:30:30
LISTING OF DATA SET -ENRICO.MF.KSDS.CL
KEY OF RECORD - 0000000000
0000000000 REPLACE1
KEY OF RECORD - 1111111111
1111111111 ORIGINAL
KEY OF RECORD - 2222222222
2222222222 REPLACE1
KEY OF RECORD - 3333333333
3333333333 ORIGINAL
KEY OF RECORD - 4444444444
4444444444 REPLACE1
KEY OF RECORD - 5555555555
5555555555 ORIGINAL
KEY OF RECORD - 6666666666
6666666666 REPLACE1
KEY OF RECORD - 7777777777
7777777777 ORIGINAL
KEY OF RECORD - 8888888888
8888888888 REPLACE1
KEY OF RECORD - 9999999999
9999999999 ORIGINAL
IDC0005I NUMBER OF RECORDS PROCESSED WAS 10
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
IDCAMS  SYSTEM SERVICES                                           TIME: 09:30:30

IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0


( second replace )
Code:

IDCAMS  SYSTEM SERVICES                                           TIME: 09:30:54

REPRO INFILE(KSDSDATA) OUTDATASET(ENRICO.MF.KSDS.CL) -
REPLACE
IDC3302I  ACTION ERROR ON ENRICO.MF.KSDS.CL
IDC3314I **RECORD OUT OF SEQUENCE - KEY FOLLOWS:
000000  F1F1F1F1 F1F1F1F1 F1F1

IDC3302I  ACTION ERROR ON ENRICO.MF.KSDS.CL
IDC3314I **RECORD OUT OF SEQUENCE - KEY FOLLOWS:
000000  F3F3F3F3 F3F3F3F3 F3F3

IDC3302I  ACTION ERROR ON ENRICO.MF.KSDS.CL
IDC3314I **RECORD OUT OF SEQUENCE - KEY FOLLOWS:
000000  F5F5F5F5 F5F5F5F5 F5F5

IDC3302I  ACTION ERROR ON ENRICO.MF.KSDS.CL
IDC3314I **RECORD OUT OF SEQUENCE - KEY FOLLOWS:
000000  F7F7F7F7 F7F7F7F7 F7F7

IDC31467I MAXIMUM ERROR LIMIT REACHED.
IDC0005I NUMBER OF RECORDS PROCESSED WAS 4
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12


PRINT INDATASET(ENRICO.MF.KSDS.CL) CHAR
IDCAMS  SYSTEM SERVICES                                           TIME: 09:30:54
LISTING OF DATA SET -ENRICO.MF.KSDS.CL
KEY OF RECORD - 0000000000
0000000000 REPLACE1
KEY OF RECORD - 1111111111
1111111111 REPLACE2
KEY OF RECORD - 2222222222
2222222222 REPLACE1
KEY OF RECORD - 3333333333
3333333333 REPLACE2
KEY OF RECORD - 4444444444
4444444444 REPLACE1
KEY OF RECORD - 5555555555
5555555555 REPLACE2
KEY OF RECORD - 6666666666
6666666666 REPLACE1
KEY OF RECORD - 7777777777
7777777777 REPLACE2
KEY OF RECORD - 8888888888
8888888888 REPLACE1
KEY OF RECORD - 9999999999
9999999999 ORIGINAL
IDC0005I NUMBER OF RECORDS PROCESSED WAS 10
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
IDCAMS  SYSTEM SERVICES                                           TIME: 09:30:54

IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 12


You should notice that since the error threshols was exceeded
the record with key 9999999999 was not replaced
and that to start with the sequence checking was done on the input file
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Sat Mar 26, 2011 5:14 pm    Post subject:
Reply with quote

Quote:
But I read that Replace keyword is used to remove the duplicates from being loaded into KSDS.

Does this abend mean that replace has no effect over KSDS?
I recommend you take the source where you read that statement, put it in the trash can, and forget everything you read in it. The source is flat out wrong. From the manual (link at the top of the page), section 30.1.2:
Quote:
REPLACE
When a key-sequenced data set (other than a catalog) is copied, each source record with a key matching a target record's key replaces the target record. Otherwise, the source record is inserted into its appropriate place in the target cluster.
The manual does not say anything about removing duplicates.

And to answer your question, REPLACE is extremely useful. If you are using REPRO to copy records into a KSDS file, and some of the keys are already in the file, the REPLACE option indicates that the copied data will replace the data in the file. Without the REPLACE option, the REPRO won't overlay the data.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Mar 28, 2011 9:22 pm    Post subject:
Reply with quote

Thank You Donald Knuth!

PS. Nothing! icon_biggrin.gif
Back to top
View user's profile Send private message
cvijay784
Warnings : 1

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Tue Mar 29, 2011 6:25 pm    Post subject: Reply to: Replace is not working!
Reply with quote

I got an idea now.

I tried to load flat file that has duplicate records to an empty KSDS file. That caused the problem.

Thanks All
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Tue Mar 29, 2011 6:59 pm    Post subject:
Reply with quote

Quote:
I tried to load flat file that has duplicate records to an empty KSDS file. That caused the problem.
Depending upon which "that" you mean, possibly. The empty file is not the problem -- REPRO loads records into empty VSAM files just fine. The problem is the duplicate records. You -- the programmer -- are responsible for removing duplicate records from the input before doing the REPRO since duplicate records cannot be loaded into a VSAM file (every primary key must be unique).
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 Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am
No new posts SCRNAME not working on my mainframe? mrsidhu12 TSO/ISPF 7 Thu Sep 01, 2016 2:17 pm
No new posts Need a help how to replace a string i... gurunath82 CLIST & REXX 12 Tue Jul 26, 2016 11:43 pm


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