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

How to update records in VSAM file using SYNCTOOL utility?


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

New User


Joined: 08 Jan 2009
Posts: 3
Location: Mumbai

PostPosted: Thu Jan 08, 2009 11:25 am
Reply with quote

I have an input file with a few records. I need to search these records in an VSAM file one by one and if I find a matching record, then I need to update a field of that record in VSAM file with a fixed msg 'XXX'.

I am trying to avoid writing a new Cobol pgm for the above function. I'm not sure if it is possible using SYNCTOOL utility.

Thanks,
Preeti
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jan 08, 2009 9:48 pm
Reply with quote

Quote:
if I find a matching record


Matching what? Matching a particular constant? Matching another field in the record? You need to explain clearly what it is you're trying to do.

Show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of all relevant fields.

Are all of the VSAM records the same length and can they be different lengths?
Back to top
View user's profile Send private message
Preeti Goel

New User


Joined: 08 Jan 2009
Posts: 3
Location: Mumbai

PostPosted: Fri Jan 09, 2009 11:01 am
Reply with quote

Ok...I apologize for posting incomplete information. Here it goes in details:
The input flat file contains the following data:
'Emp-no' of 14 chars starting at column 01.

The VSAM is the I/O file (300 chars in length) that has its key as the Emp no of 14 chars. A "notes" field of 30 chars starts at col 199 in the VSAM file

I need to match the Emp-no of the i/p file with the Emp-no of VSAM file. If it matches then I need to update the "notes field" of the VSAM file with a fixed msg 'XXX' of 30 chars.

How can I achieve this using ICETOOL utility? Hope this query is much clearer now.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Fri Jan 09, 2009 2:27 pm
Reply with quote

Hi,

You need to do this in 2 steps.
1) JOIN the flat file and VSAM file on keys and update the required field. This can be done using SPLICE.
2) Use the o/p of step 1 as input in this step. You can do REPRO REPLACE to your original vsam file. All the updated key recs will be reflected in your VSAM file.

You can use the below job to JOIN both the files. I am assuming that key of VSAM file also start at pos 1 and is of 14 chars.

Code:
//*****************************************************
//STEP010  EXEC PGM=SYNCTOOL                           
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//IN1      DD DSN=FLAT FILE                                                                     
//IN2      DD DSN=VSAM FILE                                                       
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//BOTH     DD DSN=O/P FILE
//TOOLIN   DD *                                                       
 COPY FROM(IN1)  TO(TMP1) USING(CP01)                               
 COPY FROM(IN2)  TO(TMP1) USING(CP02) VSAMTYPE(F)                       
 SPLICE FROM(TMP1) TO(BOTH) ON(1,14,CH) WITH(15,286) WITH(302,1)-
                            USING(CP03)                     
/*                                                           
//CP01CNTL DD   *                                           
  OUTREC BUILD=(1,14,301:C'11')                               
/*                                                           
//CP02CNTL DD   *                                           
  OUTREC BUILD=(1,300,301:C'22')                               
/*                                                           
//CP03CNTL DD   *                                           
  OUTFIL FNAMES=BOTH,INCLUDE=(301,2,CH,EQ,C'12'),
                    BUILD=(1,198,c'XXXXXXXX',229,72)
/*                                                 
//*****************************************************


Note : replace c'XXXXXXXXX' with your customized message of 30 bytes.

Hope this works.
Thanks,
-Kapil.
Back to top
View user's profile Send private message
Preeti Goel

New User


Joined: 08 Jan 2009
Posts: 3
Location: Mumbai

PostPosted: Fri Jan 09, 2009 4:48 pm
Reply with quote

Hi Kapil,
Thanks for the reply. I tried using your method but the JCL failed with U0016 abend code. It failed in the statement:
CP01CNTL :
OUTREC BUILD=(1,14,301:C''11'')
The cause of the failure was explained as follows:
SyncSort was invoked by another program, and that program used a 31-bit parameter list where the "call identifier" parameter
was specified. xxxx is the identifier specified by the calling program.


WER428I CALLER-PROVIDED IDENTIFIER IS "0001"

Kindly advise.

Thanks,
Preeti
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Fri Jan 09, 2009 6:03 pm
Reply with quote

Hi Preeti,

Sorry for the confusion. Uptill now, I thought your were using DFSORT.
If you are using SYNCSORT in your system. Then you should join files differently.

Try using the below JOB to JOIN both the files. Then do REPRO REPLACE to your original vsam file.

Code:
//SORT01   EXEC PGM=SORT                 
//SORTOUT  DD  DSN=O/P FILE (FLAT FILE)
//SYSOUT   DD SYSOUT=*
//SORTJNF1 DD  DSN=INPUT.FILE1,  (FLAT File)
//             DISP=(SHR,KEEP,KEEP)                       
//SORTJNF2 DD  DSN=INPUT.FILE2,  (VSAM)
//             DISP=(SHR,KEEP,KEEP)                       
//SYSIN    DD  *                                           
  JOINKEYS FILE=F1,FIELDS=(1,14,A)   
  JOINKEYS FILE=F2,FIELDS=(1,14,A)   
  REFORMAT FIELDS=(F2:1,300)
  OUTREC FIELDS=(1,198,C'YOUR CUSTOMISED MESSAGE OF 30 CHARS',229,72)
  SORT FIELDS=COPY                   
  END                               
/*                                   
//*


Hooe this works.
Thanks,
-Kapil.
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 How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top