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

Get the corresponding col3 value from fileB


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

New User


Joined: 19 Nov 2007
Posts: 8
Location: cheanni

PostPosted: Thu Jan 31, 2008 10:27 am
Reply with quote

Hi,

Can anyone help me out for my below requirement?

I have a requirement. If you have any idea to complete this in a easy way, let me know.

File a:
Col1 Col2 Col4 Col5
Reca3 -- --- ---
Reca5 -- --- ---



File B (Master File)
Col1 Col2 Col3 Col4 Col5
Reca1 -- --- --- ---
Reca2 -- --- --- ---
Reca3 -- --- --- ---
Reca4 -- --- --- ---

I need to get the corresponding col3 value from fileB for the records(2recs) in filea.

Is there any easy way???


Thanks,
Muralirajan S.
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: Thu Jan 31, 2008 10:05 pm
Reply with quote

It's not clear what you want to do. Please show an example of the records in the input file (with sample values for all cols) and the expected output. Please explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Fri Feb 01, 2008 8:20 am
Reply with quote

Hi Frank,

I can understand the requirement of murali.

File A: Input
Col1 Col2 Col4 Col5
111 222 444 123
123 456 888 999


File B: Input
File B (Master File)
Col1 Col2 Col3 Col4 Col5
ABC PQR XYZ IJK MNR
111 222 333 444 123
AAA 234 VVV KKK 567
123 456 678 888 999
345 ABA VSF SGG SDG


File A Output :
Col1 Col2 Col3 Col4 Col5
111 222 333 444 123
123 456 678 888 999


He wants to search the File B with the entries in File A and if it matches the record in file A should be iverriten by the record in File B.

But I wonder, whether it is an assignment or requirement.

but It looks interesting.

We are waiting for ur answer.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Feb 01, 2008 9:13 am
Reply with quote

for the i/p that MKK has shown , the ICETOOL solution would be
Code:
//*******************************************************             
//STEP001  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD File-1
//           DD File-2   
//BOTH     DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
 SPLICE FROM(IN1) TO(BOTH) ON(1,3,CH) WITH(9,3)                       
/*                                                                     
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Fri Feb 01, 2008 12:55 pm
Reply with quote

Hi krisprems,

I got the below tool message when I use this sort card.

ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED
ICE650I 0 VISIT www.ibm.com/storage/dfsort FOR ICETOOL PAPERS, EXAMPLES A
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS: TOOLIN

ICE630I 0 MODE IN EFFECT: STOP
SPLICE FROM(IN1) TO(BOTH) ON(1,3,CH) WITH(9,3)
ICE627I 0 DFSORT CALL 0001 FOR SORT FROM IN1 TO BOTH COMPLETED
ICE628I 0 RECORD COUNT: 000000000000007
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000000002
ICE602I 0 OPERATION RETURN CODE: 00

ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 00


And under the DDNAME BOTH I got the message like this

111 222 333 123
123 456 678 999


But the query is the records in the FileA were not updated as expected.

Expected :
111 222 333 444 123
123 456 678 888 999

Results came:
111 222 333 123
123 456 678 999
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Feb 01, 2008 2:22 pm
Reply with quote

Quote:
Expected :
111 222 333 444 123
123 456 678 888 999

If this is the case then just swap the files in the DD statement for IN1 like this
Code:
//IN1      DD File-2
//         DD File-1


But that is not the req as per the statement by muralirajansm,
Quote:
I need to get the corresponding col3 value from fileB for the records(2recs) in filea.


mkk157: And one more thing if you observe in muralirajansm's example
Reca3 is present in both File-1 and File2, but Reca5 is not found in File2 but is in File-1. To solve this i have the below ICETOOL solution
Code:

//*******************************************************             
//STEP001  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                       
111 222 444 123                                                       
123 456 888 999                                                       
444 456 238 999                                                       
/*                                                                     
//IN2      DD *                                                       
ABC PQR XYZ IJK MNR                                                   
111 222 333 444 123                                                   
AAA 234 VVV KKK 567                                                   
123 456 678 888 999                                                   
345 ABA VSF SGG SDG                                                   
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
 COPY FROM(IN1) TO(TMP1) USING(CP01)                                   
 COPY FROM(IN2) TO(TMP1) USING(CP02)                                   
 SPLICE FROM(TMP1) TO(OUT) ON(1,3,CH) WITH(9,3) WITH(82,1) KEEPNODUPS-
 USING(CP03)                                   
/*                                             
//CP01CNTL DD *                                 
  INREC OVERLAY=(81:C'11')                     
//CP02CNTL DD *                                 
  INREC OVERLAY=(81:C'22')                     
//CP03CNTL DD *                                 
  OUTFIL INCLUDE=(81,2,CH,NE,C'22'),BUILD=(1,80)



muralirajansm: These all are our assumptions, tell us what you want with some sample records of i/p and o/p...
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 problem while Copy records from fileA... COBOL Programming 8
No new posts Select only records in FileB DFSORT/ICETOOL 1
No new posts Replace all the records of fileA to f... JCL & VSAM 3
Search our Forums:

Back to Top