MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Updating Records in VSAM file using JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Thu Oct 18, 2007 12:18 pm    Post subject: Updating Records in VSAM file using JCL Reply with quote

i need to update certain certain records given a condition in a vsam file using JCL .

example:
Code:
Y0000JOE
Y0001JOHN
Y0002MARY
Y0003MIKE
Y0004TOM


I have a list of names and if the name is matching the file, i will need to update the first element of the record.
my list:
JOE
JOHN

expected output:
Code:
X0000JOE
X0001JOHN
Y0002MARY
Y0003MIKE
Y0004TOM


Can this be done by using a JCL?
Thanks.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Thu Oct 18, 2007 12:23 pm    Post subject: Reply with quote

Not by JCL - you need a program - either written by yourself or more likely using whichever sort tool your shop uses. search on matching files in the utilities forum for a start.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Thu Oct 18, 2007 2:58 pm    Post subject: Reply with quote

What Sort Tool can i use? thanks.
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Fri Oct 19, 2007 12:10 am    Post subject: Reply with quote

davinski,

The below job gives you the desired results.

Code:
//S1    EXEC  PGM=ICEMAN                                     
//SYSOUT    DD  SYSOUT=*                                     
//SORTIN DD *                                               
Y0000JOE                                                     
Y0001JOHN                                                   
Y0002MARY                                                   
Y0003MIKE                                                   
Y0004TOM                                                     
/*                                                           
//SORTOUT DD SYSOUT=*                                       
//SYSIN    DD    *                                           
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=(6,3,CH,EQ,C'JOE',OR,6,4,CH,EQ,C'JOHN'),
  OVERLAY=(1:C'X'))                                         
/*                                                           


Output:
Code:
X0000JOE 
X0001JOHN
Y0002MARY
Y0003MIKE
Y0004TOM 
Back to top
View user's profile Send private message Send e-mail
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 1:41 am    Post subject: Reply with quote

vkphani
Always try to use OUTREC where ever possible, avoid using INREC. This improves the efficiency of Your SORT JCL.
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Fri Oct 19, 2007 1:48 am    Post subject: Reply with quote

krisprems wrote:
vkphani
Always try to use OUTREC where ever possible, avoid using INREC. This improves the efficiency of Your SORT JCL.


Kris,

Is it? I am not aware of this. Thanks for letting me know.

davinski,

Just replace INREC by OUTREC in the above JCL. You will get teh same output.
Back to top
View user's profile Send private message Send e-mail
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 3:38 am    Post subject: Reply with quote

vkphani
yes its true, but may not find the difference in performance untill and unless you process huge file's.
Note Some times by using INREC also you can improve the efficiency, consider a scenario like this:
In i/p file if you have data of LRECL=3000 and you require the o/p of LRECL=100 then in this scenario use INREC and reformat the records then perform SORT.
Since the flow of SORT would be like this:
1. INREC
2. SORT/SUM FIELDS
3. OUTREC
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 3:42 am    Post subject: Reply with quote

You can refer to this link for further details


INREC Statement Notes
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Fri Oct 19, 2007 4:12 am    Post subject: Reply with quote

Thaks for the link kris.
Back to top
View user's profile Send private message Send e-mail
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Fri Oct 19, 2007 8:11 am    Post subject: Reply with quote

When I read the link provided there is no mention of OUTREC being better performance than INREC. Only that it's more convenient using OUTREC because the SORT FIELD positions are the original record locations.

As kris admits, INREC is actually better for performance when you can reduce the record to only the meaningful fields.
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Oct 19, 2007 9:32 am    Post subject: Reply with quote

Bill Dennis
Quote:

yes its true, but may not find the difference in performance untill and unless you process huge file's.

Please conceterate on this statement too, for the scenario that davinski.bby has asked, if its a pretty huge file OUTREC is better choice.
_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Oct 19, 2007 10:36 am    Post subject: Reply with quote

Actually, for a COPY, there is usually no difference in performance between INREC and OUTREC. For a SORT, there can sometimes be a difference in performance.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group