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

Reset only perticular records by specifing IF condition


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

New User


Joined: 19 Dec 2004
Posts: 23
Location: hyderabad

PostPosted: Tue May 08, 2007 4:19 pm
Reply with quote

Hi,


In one File i would like to set one field(having length 1 byte) value to 'Y' using DFSORT utility, if the Field Value in the File is 'N'.

I am not sure how to use IF condition in Sort to Reset that value after checking value of that Field.

Field position in the file is 2585.



Thanks

venkat

Warning: Do not use Forum name as Topic Title. Title Edited
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue May 08, 2007 4:25 pm
Reply with quote

This is almost identical to your previous post.

http://ibmmainframes.com/viewtopic.php?t=20571
Back to top
View user's profile Send private message
venkatarao

New User


Joined: 19 Dec 2004
Posts: 23
Location: hyderabad

PostPosted: Tue May 08, 2007 5:12 pm
Reply with quote

Hi,

yes. it's almost similar.

Here i am asking about how to Reset only perticular records(value which is having 'N') by specifing if condition in DFSort.

pls let me know if need any information.


Thanks
Venkat
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Tue May 08, 2007 5:59 pm
Reply with quote

Hey,


Try this one..

Code:

  SORT FIELDS=COPY                                         
  OUTREC FIELDS=(1:1,2584,2585:2585,1,CHANGE=(1,C'N',C'Y'))
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Tue May 08, 2007 7:34 pm
Reply with quote

oops... sorry..u have to add this NOMATCH to get the correct result for ur requirement..

Code:

  SORT FIELDS=COPY                                         
  OUTREC FIELDS=(1:1,2584,2585:2585,1,CHANGE=(1,C'N',C'Y'),NOMATCH=(2585,1))


the earlier code will give an abend if any value except N comes in that particular position.

When u add NOMATCH, the records which has a different value than N in position 2585 will have the same value.. i.e. it won't get changed.
Back to top
View user's profile Send private message
venkatarao

New User


Joined: 19 Dec 2004
Posts: 23
Location: hyderabad

PostPosted: Tue May 08, 2007 9:04 pm
Reply with quote

Hi raak,

can u please explain the given syntax.

OUTREC FIELDS=(1:1,2584,2585:2585,1,CHANGE=(1,C'N',C'Y'),NOMATCH=(2585,1))

I am not clear how u r spcifing positions 1:1,2584,2585:2585,1


Thanks
venkat
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: Tue May 08, 2007 9:24 pm
Reply with quote

Venkat,

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(2585,1,CH,EQ,C'N'),OVERLAY=(2585:C'Y'))
/*
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: Tue May 08, 2007 9:31 pm
Reply with quote

raak,

Your "solution" will truncate any bytes in the input file past position 2585 so it only works if the LRECL is 2585. You would need to add in the other input positions to make it work for an LRECL greater than 2585. But for this kind of thing, it's much easier to use DFSORT's OVERLAY function so you don't have to worry about the positions before and after the position to be changed. Also DFSORT's newer IFTHEN/OVERLAY function is easier to use then DFSORT's older CHANGE function. You need to update your bag of tools.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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
Search our Forums:

Back to Top