View previous topic :: View next topic
|
Author |
Message |
tusharguptait
New User
Joined: 15 Feb 2006 Posts: 32
|
|
|
|
Hi,
I have a VSAM file that contains a numeric field. My requirement is to add a fixed value to some selected records leaving others unchanged.
For e.g.
file contains numeric field START-POS (pos=15, length=3,type=numeric) and records look like
START-POS
120
112
100
210
156
190
145
189
I want to add 10 to START-POS of all records that have value greater than 150. Expected record set will be
120
112
100
220
166
200
145
199
Any solution for this requirement will be highly appreciable.
Thanks,
Tushar |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
tusharguptait
DFSORT statements for your requirement are as follows:
Code: |
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(15,3,ZD,GT,150),
OVERLAY=(15,3,ZD,ADD,+10,EDIT=(TTT)))
/*
|
|
|
Back to top |
|
|
tusharguptait
New User
Joined: 15 Feb 2006 Posts: 32
|
|
|
|
Thanks for such a quick reply.
Please help me understand "EDIT=(TTT)"
Thanks,
Satish |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Actually, the DFSORT statements should be:
Code: |
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(15,3,ZD,GT,150),
OVERLAY=(15:15,3,ZD,ADD,+10,EDIT=(TTT)))
/*
|
Without the 15: in OVERLAY, the changed field will be placed at position 1 (the default) rather than at position 15. |
|
Back to top |
|
|
tusharguptait
New User
Joined: 15 Feb 2006 Posts: 32
|
|
|
|
Thanks for providing the solution. I am facing some problem while using this.
I am using following card with EXEC PGM=SORT
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,1,ZD,EQ,2,
AND,2,7,CH,EQ,C'SCRN004',
AND,149,5,ZD,GT,159),
OVERLAY=(149:149,5,ZD,ADD,+2,EDIT=(TTT)))
Both input and output files are VSAM(KSDS).
Following are the field details reffered in WHEN and OVERLAY conditions
REC-TYPE-CODE
#4
ZD 1:1
MAP-NAME
#5
AN 2:7
M86-MF-LOCATION
#27
ZD 149:5
Everythying is working fine, all records got copied, but still 2 is not added to existing value of MF-LOCATION field. Please suggest some solution. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
tusharguptait
Quote: |
but still 2 is not added to existing value of MF-LOCATION field |
Just verify if the i/p record is satifying the IFTHEN conditions(check the positions).
Show the sample i/p, which includes the records to be modified and those to be retained as it is. |
|
Back to top |
|
|
tusharguptait
New User
Joined: 15 Feb 2006 Posts: 32
|
|
|
|
I got the problem.
I copied the card with "EDIT=(TTT)" but actual lenght of field to be updated was 5 and thus changed card to "EDIT=(TTTTT)". It is working fine now. Thanks for all your support.
Tushar Gupta |
|
Back to top |
|
|
|