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

Merge two VSAM KSDS files into third VSAM KSDS file


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

New User


Joined: 20 Sep 2023
Posts: 7
Location: India

PostPosted: Fri Sep 29, 2023 7:54 pm
Reply with quote

Hello Team,

I have two KSDS file with keys on the first 5 bytes but when I tried to merge two files into third VSAM KSDS file(first 5 bytes as key) then I am getting error. Please assist.

Please find below more details.

XXXX.VSAM.KSDSFILE.TEST --- first file
12345Devesh
12346Devesh
12347Devesh
12348Devesh

XXXX.VSAM.KSDSFILE.TEST1 --- second file
12340Devesh
12347Devesh
12348Devesh
12349Devesh


ouput file - XXXX.VSAM.KSDSFILE.TEST2 ---- KSDS file


Tried -

//STEP001 EXEC PGM=ICETOOL ----- didn't work
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN1 DD DSN=XXXX.VSAM.KSDSFILE.TEST,DISP=SHR
//IN2 DD DSN=XXXX.VSAM.KSDSFILE.TEST1,DISP=SHR
//OUT DD DSN=XXXX.VSAM.KSDSFILE.TEST2,DISP=OLD
//TOOLIN DD *
COPY FROM(IN1) TO(OUT) VSAMTYPE(V)
COPY FROM(IN2) TO(OUT) VSAMTYPE(V)
/*


//STEP0001 EXEC PGM=SORT ---- didn't work
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=XXXX.VSAM.KSDSFILE.TEST,DISP=SHR
//SORTIN02 DD DSN=XXXX.VSAM.KSDSFILE.TEST1,DISP=SHR
//SORTOUT DD DSN=XXXX.VSAM.KSDSFILE.TEST2,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
MERGE FIELDS=(1,5,CH,A)
/*
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 29, 2023 8:23 pm
Reply with quote

You don't really want help, do you, since you did not tell us what error you got. Hard for us to do much without knowing that.

However, I'm guessing you got duplicate keys messages since the sample data you gave has records with the same key in both files.
Back to top
View user's profile Send private message
Devrana88

New User


Joined: 20 Sep 2023
Posts: 7
Location: India

PostPosted: Fri Sep 29, 2023 8:27 pm
Reply with quote

Apologies for that!

Actually I was expecting unique records in the output KSDS file.

Below errors I was getting:

1- SORT -

WER168I CONTROL FIELD WITHIN RDW
WER410B 9,800K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16-MEGABYTE LINE
WER410B 0 BYTES RESERVE REQUESTED, 284,160 BYTES USED
WER255A VSAM LOGICAL ERROR 0C ON OUTPUT
WER578I SORTL INSTRUCTION NOT USED; REASON CODE=F6
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

2- ICETOOL -

WER164B 10,828K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 1,241K BYTES USED
WER146B 32K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I IN1 : RECFM=V ; LRECL= 80; CISIZE = 4096
WER073I IN1 : DSNAME=SNRT.VSAM.KSDSFILE.TEST
WER110I OUT : RECFM=V ; LRECL= 80; CISIZE = 4096
WER074I OUT : DSNAME=SNRT.VSAM.KSDSFILE.TEST2
WER410B 9,800K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16-MEGABYTE LINE,
WER410B 0 BYTES RESERVE REQUESTED, 252K BYTES USED
WER255A VSAM LOGICAL ERROR 08 ON OUTPUT
WER578I SORTL INSTRUCTION NOT USED; REASON CODE=F6
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Please let me know if you need any more details from my end.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2131
Location: USA

PostPosted: Fri Sep 29, 2023 8:49 pm
Reply with quote

Devrana88 wrote:
Hello Team,

I have two KSDS file with keys on the first 5 bytes but when I tried to merge two files into third VSAM KSDS file(first 5 bytes as key) then I am getting error. Please assist.

Please find below more details.

XXXX.VSAM.KSDSFILE.TEST --- first file
Code:
12345Devesh
12346Devesh
12347Devesh
12348Devesh


XXXX.VSAM.KSDSFILE.TEST1 --- second file
Code:
12340Devesh
12347Devesh
12348Devesh
12349Devesh


ouput file - XXXX.VSAM.KSDSFILE.TEST2 ---- KSDS file


Tried -

Code:
//STEP001  EXEC PGM=ICETOOL                  ----- didn't work         
//DFSMSG  DD SYSOUT=*                               
//TOOLMSG DD SYSOUT=*                               
//IN1     DD DSN=XXXX.VSAM.KSDSFILE.TEST,DISP=SHR   
//IN2     DD DSN=XXXX.VSAM.KSDSFILE.TEST1,DISP=SHR 
//OUT     DD DSN=XXXX.VSAM.KSDSFILE.TEST2,DISP=OLD 
//TOOLIN    DD *                                   
COPY FROM(IN1) TO(OUT) VSAMTYPE(V)                 
COPY FROM(IN2) TO(OUT) VSAMTYPE(V)                 
/*                                                 


Code:
//STEP0001 EXEC PGM=SORT              ---- didn't work                 
//SYSPRINT DD  SYSOUT=*                               
//SYSOUT   DD  SYSOUT=*                               
//SORTIN01 DD  DSN=XXXX.VSAM.KSDSFILE.TEST,DISP=SHR   
//SORTIN02 DD  DSN=XXXX.VSAM.KSDSFILE.TEST1,DISP=SHR   
//SORTOUT  DD  DSN=XXXX.VSAM.KSDSFILE.TEST2,DISP=SHR   
//SYSOUT   DD  SYSOUT=*                               
//SYSIN    DD  *                                       
  MERGE FIELDS=(1,5,CH,A)       

/*


1. Please learn how to use the Code button when posting your code and/or data

2. Your question is not related neither to JCL, nor to VSAM. This is DFSORT/SYNCSORT/ICETOOL/SYNCTOOL question.

3. You cannot get rid of duplicates when using just COPY or MERGE statements. RTFM, please

4. Try to search from Google: "SORT eliminate duplicates"
Back to top
View user's profile Send private message
Devrana88

New User


Joined: 20 Sep 2023
Posts: 7
Location: India

PostPosted: Fri Sep 29, 2023 8:52 pm
Reply with quote

Hello sergeyken,

Is there any way that we can merge two VSAM KSDS file into the third VSAM KSDS file without duplicates through JCL ?

Thanks in advance!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2131
Location: USA

PostPosted: Fri Sep 29, 2023 8:56 pm
Reply with quote

Devrana88 wrote:
Hello sergeyken,

Is there any way that we can merge two VSAM KSDS file into the third VSAM KSDS file without duplicates through JCL ?

Thanks in advance!


I repeat once again:

You cannot do anything like this in JCL!!!!!!!!!!

This can be done (and you really started doing this) via any SORT product.
It is highly recommended to start from reading any SORT manual, before coding and/or posting your questions to a Forum.

This is a Help forum, not Do-My-Job-For-Me forum 358.gif

Note:
Any software developer's job is NOT copying messy letters and characters from others, but the ability TO THINK WITH YOUR OWN MIND.
Back to top
View user's profile Send private message
Devrana88

New User


Joined: 20 Sep 2023
Posts: 7
Location: India

PostPosted: Fri Sep 29, 2023 8:59 pm
Reply with quote

Got you, Thanks!
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 Unable to interpret a hex value to De... COBOL Programming 4
No new posts 3 files concatenated to 1 DFSORT/ICETOOL 2
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts how to eliminate null indicator value... DB2 7
No new posts SORT JCL to merge multiple tow into s... DFSORT/ICETOOL 6
Search our Forums:

Back to Top