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
 

 

How to update records in VSAM file using SYNCTOOL utility?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to update records in VSAM file using SYNCTOOL utility?
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 Moderator


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

PostPosted: Thu Jan 08, 2009 9:48 pm    Post subject:
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    Post subject: Reply to: How to update records in VSAM file using ICETOOL u
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    Post subject: Reply to: How to update records in VSAM file using ICETOOL u
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    Post subject: Reply to: How to update records in VSAM file using ICETOOL u
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    Post subject: Reply to: How to update records in VSAM file using SYNCTOOL
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts DB2 - TERMINATE utility vasanthz DB2 5 Mon May 15, 2017 11:49 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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