Posted: Mon Nov 24, 2014 11:25 am Post subject: Joinkeys to remove records from VSAM
I need to delete a vsam file records post (1,1) record A,B,C
Sequential read vsam1 match with VSAM2, If Unmatched remove the record from vsam file and move it to another file. Exclude these records from deletion AA0035,BB0882,CC0225,DD0089 Position(2,6).
Tried following Sort.
Couple of issue.
1) I have duplicates in output, hence incldue SORTFIELDS. Please
2) I have Empty record a first in VSAM1CPY .
Please advice
Code:
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//TEMP1 DD SYSOUT=*
//SORTJNF1 DD DSN=VSAM1,DISP=SHR(VSAM/AVG 450 MAX 450)
//SORTJNF2 DD DSN=VSAM2,DISP=SHR(VSAM/AVG 3568 MAX 3568)
//SORTOUT DD DSN=VSAM1CPY,DISP=OLD
//OUT2 DD DSN=VSAM1RJT,DISP=OLD
//SYSIN DD *
OPTION DYNALLOC=(,16)
JOINKEYS FILE=F1,FIELDS=(2,11,A),TYPE=F
JOINKEYS FILE=F2,FIELDS=(1,11,A),TYPE=F
REFORMAT FIELDS=(F1:1,450,?)
JOIN UNPAIRED F1
SUM FIELDS=NONE
SORT FIELDS=(1,12,CH,A)
OUTFIL BUILD(1,450),
OMIT(1,1,SS,EQ,C'A,B,C',AND,
451,1,CH,EQ,C'1',AND,
2,6,SS,NE,C'AA0035,BB0882,CC0225,DD0089')
OUTFIL FNAMES=OUT2,BUILD(1,450),
INCLUDE(1,1,SS,EQ,C'A,B,C',AND,
451,1,CH,EQ,C'1',AND,
2,6,SS,NE,C'AA0035,BB0882,CC0225,DD0089')
OUTFIL INCLUDE(1,1,SS,EQ,C'A,B,C',AND,
451,1,CH,EQ,C'1',AND,
2,6,SS,NE,C'AA0035,BB0882,CC0225,DD0089'),
FNAMES=TEMP1,HEADER1=('MF11 FILE CLEANUP'),
SECTIONS=(1,1,
TRAILER3=(5:C'RECORD TYPE ',1,1,C' DELETED ',
COUNT=(EDIT=(III,III,III)))),
TRAILER1=(/,
03:'TOTAL NUMBER OF RECORDS DELETED : ',
COUNT=(EDIT=(III,III,III))),NODETAIL
1. I am getting duplicate records in output. Please advice, why I am getting it, My first file is key'ed file having no duplicates and i am just moving the same file to output.
2. Getting an empty record @ first in the output. But the vsam file 1 dosent have empty record.
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Nov 24, 2014 11:54 am Post subject:
Magesh_J wrote:
Typo in Issues.
1. I am getting duplicate records in output. Please advice, why I am getting it, My first file is key'ed file having no duplicates and i am just moving the same file to output.
Magesh_J,
In Joinkeys , the keys will be treated as binary, so they must be "normalized". For example, if the keys are actually zoned decimal, they must have all C and D signs, or all F and D signs. You can use an INREC statement in JNF1CNTL and/or JNF2CNTL to normalize the keys for the F1 file and/or F2 file, respectively, if appropriate.
I am guessing that is the reason for your duplicates. What is the COBOL definition of the keys you are matching? X(11)? or they numeric?
Magesh_J wrote:
2. Getting an empty record @ first in the output. But the vsam file 1 dosent have empty record.
Magesh_J,
Look at the JOIN UNPAIRED statement, You missed a COMMA in between them and DFSORT treated F1 as a comment and you are getting unmatched records from File 2. Since your reformat statement doesn't write anything from file 2 you are looking at a record with all spaces. Look at the indicator value in position 451 and you will notice that it has 2.
You also need to have the VSAM cluster defined as REUSE in order to write it to Output as well as VSAMIO parm in DFSORT. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Tue Nov 25, 2014 12:46 pm Post subject:
Magesh_J,
Apart from the obvious error ICE077A which terry pointed to, are you sure you had JNF1CNTL coded correctly? Based on your key definitions earlier, If your key in SORTJNF1 starts in position 6 shouldn't the numeric key which you are normalizing be at position 12 instead of 11? _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Tue Nov 25, 2014 12:57 pm Post subject:
Magesh_J wrote:
ThanksTerry for the kind response
tested 10k records it ran fine.. testing with full file it is failing...
is it possible to identify which record creating problem ?
Magesh_J,
Is the output VSAM file EMPTY before you overlay the contents of it? If not is the VSAM defined as REUSE? _________________ Kolusu
www.linkedin.com/in/kolusu
My First step is a idcams step, delete define the file.
Code:
//S1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE VSAMOUT CL PRG
DELETE VSAMOUT.NOT CL PRG
IF MAXCC LE 8 THEN SET MAXCC = 0
DEFINE CLUSTER -
( NAME ('VSAMOUT') -
MODEL('VSAM1'))
DEFINE CLUSTER -
( NAME ('VSAMOUT.NOT') -
MODEL('VSAM1'))
I think 12th position might be an issue. Thanks for checking this, Changed it and running it, it is consuming 1132 CPU Seconds, it will take a while for result, i.e it is failing only after 1132 CU seconds . Is they any way we can optimize it ?
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