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

Changing a field


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

New User


Joined: 28 Jul 2009
Posts: 3
Location: hyderabad

PostPosted: Fri Jul 31, 2009 11:16 pm
Reply with quote

i have two input files
FILEA
001 999 C 01
002 888 C 02
003 777 C 03

FILEB
001 999 C 01
002 888 C 04
003 777 C 03

Here in the two input files first and second cols are the key fields

I want to change the 3rd column from C to D, only when there is a change in the change in the 4th column.

here in the 2nd record.. there is a change in 4th column.So i need to change it from C to D.

Finally i want the below record in the output file
002 888 D 04
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jul 31, 2009 11:32 pm
Reply with quote

bellamkondar,

1. What is the LRECL and RECFM of FILE A
2. What is the LRECL and RECFM of FILEB
3. What is the position and format of the key fields to be matched in both files?
4. What is the position of the change field?
5. Does any of the files have duplicates on the key?
Back to top
View user's profile Send private message
bellamkondar

New User


Joined: 28 Jul 2009
Posts: 3
Location: hyderabad

PostPosted: Sat Aug 01, 2009 1:09 am
Reply with quote

Skolusu,

1. Both files have same LRECL 200 and
2. Both files have same key pos(1-7)
3. values in position 9 - 'C' should be changed to 'D' when
there is a change in the vlaue of posion 11
4. No duplicates in both the files and
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Aug 01, 2009 3:00 am
Reply with quote

bellamkondar,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DUMMY,DCB=(LRECL=200,RECFM=FB,BLKSIZE=27800)
//SORTOUT  DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE) 
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  OUTFIL REMOVECC,                                         
  TRAILER1=(3C'$',11:2C'0',200:X)
//*
//STEP0200 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT             
//         DD DSN=Your input fileB,DISP=SHR
//         DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT             
//         DD DSN=Your input fileA,DISP=SHR                           
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(201:ID=1)),
  IFTHEN=(WHEN=(201,1,ZD,EQ,1),OVERLAY=(202:2X'00')),                 
  IFTHEN=(WHEN=(201,1,ZD,EQ,2),OVERLAY=(202:11,2))                   
 
  SORT FIELDS=(1,7,CH,A),EQUALS                                       
  SUM FIELDS=(201,1,ZD,202,2,BI)                                     
 
  OUTFIL INCLUDE=(201,1,ZD,EQ,3,AND,11,2,CH,NE,202,2,CH),             
  BUILD=(1,8,C'D',10,191)                                             
//*
Back to top
View user's profile Send private message
bellamkondar

New User


Joined: 28 Jul 2009
Posts: 3
Location: hyderabad

PostPosted: Sat Aug 01, 2009 11:13 am
Reply with quote

Thanks Skolusu...

If i have two keys say from pos(1-3) and pos(4-7)...then how can i use those two keys in the sort.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Aug 03, 2009 9:58 pm
Reply with quote

bellamkondar,

Unless the 2 keys are of different format , there is no difference in treating them as a single key since they are right next to each.

Are the 2 keys of different format?
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top