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
 

 

Add a fixed value to some selected records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Add a fixed value to some selected records
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    Post subject:
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    Post subject: Re: Add a fixed value to some selected records
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    Post subject:
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 Moderator


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

PostPosted: Mon Jun 18, 2007 8:46 pm    Post subject:
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    Post subject: Re: Add a fixed value to some selected records
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    Post subject:
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    Post subject: Re: Add a fixed value to some selected records
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL 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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


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