|
View previous topic :: View next topic
|
| Author |
Message |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
Hi,
I need to update a VSAM file using a Flat file.
File1 FLAT
FILE2 VSAM KSDS
File 1
| Code: |
<---CMP------> <F1--> <F2--> <F3--> <F4------> <F5------>
----+----1----+----2----+----3----+----4----+----5----+--
AAA DDDD 52549 0.5000 0.5000 0.4500 0002165.00 0002165.00
BBB BDDD 52717 0.5000 0.5000 0.4500 0002175.00 0002175.00
|
File 2 layout for same Fields
| Code: |
Field -PICTURE- -NUMBER START END LENGTH
CMP X(12) 1 1 12 12
F1 S9V9(4) 209 115 117 3
F2 S9V9(4) 257 315 317 3
F3 S9V9(4) 257 315 317 3
F4 S9(7)V99 210 118 122 5
F5 S9(7)V99 259 321 325 5
|
I need to compare the CMP field in File1 and File2, for the matching record i need to update the VSAM file with the flat file F1, F2 ,F3, F4 and F5
The problem for the Flat file, it is in ZD and for the VSAM file it is in Packed decimal COMP - 3.
Tried with Joinkey By keeping a vsam copy as i dont know how to compare and update a vsam file, also i am struggling how to move ZD to PD
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=F1,DISP=SHR
//SORTJNF2 DD DSN=VSAMFile,DISP=SHR
//SORTOUT DD DSN=VSAMFILECPY,DISP=OLD
//SYSIN DD *
* CONTROL STATEMENTS FOR JOINKEYS APPLICATION
JOINKEYS FILE=F1,FIELDS=(1,3,A,5,4,A,10,5,A)
JOINKEYS FILE=F2,FIELDS=(1,3,A,4,4,A,8,5,A) ==Need advice
TYPE=V
REFORMAT FIELDS=Need advice
* CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)
SORT FIELDS=COPY
/*
|
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
First - do NOT update one of the input files as the output . . . VSAM or Other.
Your input values are Not zoned-decimal (ZD).Can any of the input values be negative?
If you combine all of the key fields into one 12-byte field, the "match" need only know one field.
Is the vsam file in order by these 12 bytes? Is the input in order? |
|
| Back to top |
|
 |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
Hi dick,
i am not using same vsam file, i took a copy.
values might be negatives, the target field is signed
both files may not be in order.
vsam file key size 27
.
and we have only partial key to compare.
we need to update only the matching records, rest of the records in vsam file just needs to be copied.
i.e matching records should have the update of file 1.rest of the records from file 2 vsam, just needs to be copied. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
As Dick has said, you don't have ZD. Try with FS for your format,
| Code: |
| 81,7,FS,TO=PD,LENGTH=3 |
That your get " 0.1234" (actial decimal point, blank leading sign (example)) at position 81 into PIC S9V9(4) COMP-3.
You'll have to explain about the partial key you mention. Are you talking about the VSAM key, or the JOiNKEYS key?
If the JOINKEYS puts the VSAM data out of sequence (not a problem if it is the high-order part of the key being matched, but then your data from the VSAM is in sequence, and you've said it is not) you will need to SORT in the Main Task.
You will need a JOIN.
Can you get unpaired F2? What do you want to do with them if you can?
Your REFORMAT will contain the enire VSAM record, plus the matching fields. In the Main Task, check for a match, do the replacement. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|