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

Add a fixed value to some selected records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tusharguptait

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Mon Jun 18, 2007 3:58 pm
Reply with quote

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

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jun 18, 2007 4:44 pm
Reply with quote

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

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Mon Jun 18, 2007 5:42 pm
Reply with quote

Thanks for such a quick reply.

Please help me understand "EDIT=(TTT)"

Thanks,
Satish
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jun 18, 2007 5:48 pm
Reply with quote

tusharguptait
Check this topic Editing Numeric Fields @ this link
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1cg20/2.4.8?ACTION=MATCHES&REQUEST=EDIT&TYPE=FUZZY&SHELF=ICE1SH20.bks&DT=20060615173822&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
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: Mon Jun 18, 2007 8:46 pm
Reply with quote

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

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Tue Jun 19, 2007 2:12 pm
Reply with quote

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

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Jun 19, 2007 3:28 pm
Reply with quote

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

New User


Joined: 15 Feb 2006
Posts: 32

PostPosted: Tue Jun 19, 2007 4:25 pm
Reply with quote

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
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top