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
 

 

DFSORT to Update a VSAM file using Flat file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 161
Location: Chennai

PostPosted: Fri Nov 22, 2013 11:44 pm    Post subject: DFSORT to Update a VSAM file using Flat file
Reply with quote

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 icon_sad.gif
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
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Nov 23, 2013 12:55 am    Post subject:
Reply with quote

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
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 161
Location: Chennai

PostPosted: Sat Nov 23, 2013 2:10 am    Post subject: Reply to: DFSORT to Update a VSAM file using Flat file
Reply with quote

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
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Nov 23, 2013 3:34 pm    Post subject: Reply to: DFSORT to Update a VSAM file using Flat file
Reply with quote

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.

Code:
  JOIN UNPAIRED,F1


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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm


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