Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Find&replace from other file.Is this possible in ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Thu Aug 23, 2007 7:14 pm    Post subject: Find&replace from other file.Is this possible in ICETOOL
Reply with quote

Hi,
My requirement:
I have two files
File A - FB, Lrecl=801
File B - FB,Lrecl=272.

I have to do the following steps:
1) Find the records present in FileA in File B.
File A key position - 2,6,CH and 10,5,PD
File B Key position - 2,6,CH and 8,5,PD
2) If match found, I want to verify the field1 in FileA (Position - 13,2,CH) and depending on its value, I want to move FIELDB from fileB (Position -113,8,CH) to field2 in fileA (Position - 200,8,CH)
example, if field1(fileA) = 'RR'
Move FieldB(FileB) To field2(FileA)

3) If match not found, then I need to have spaces in field2(FileA).

I was able to find ways to accomplish first and third requirement.But I am stuck with requirement 2. Is it possible in ICETOOL replacing one file value with another file value?

Any pointers will be of great help.
Appreciate everyone's time.

Thanks,
Viji
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: Thu Aug 23, 2007 8:54 pm    Post subject:
Reply with quote

Quote:
example, if field1(fileA) = 'RR'
Move FieldB(FileB) To field2(FileA)


If this the only condition or are there more? If there are more, what are they?

Please show a good example of the records in each input file (relevant fields only) with all variations and the expected output records.
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Thu Aug 23, 2007 9:50 pm    Post subject: Reply to: Find&replace from other file.Is this possible
Reply with quote

The conditions are
if field1(fileA) = 'RR'
Move FieldB(FileB) To field2(FileA)

if field1(fileA) = 'I1'
Move FieldC(FileB) To field2(FileA)

if field1(fileA) = 'IO'
Move FieldD(FileB) To field2(FileA)

FieldC(FileB) - Position 123,8,CH
FieldD(FileB) - position 133,8,CH

there are total 10 condition like this....IF I get to know for 3 I can extend to others.

Only the fields of interest
FileA:

Code:
FileA-F1 FileA-Key1-pre FileA-key1-suf FileA-Key2  Field1-FileA
1/AN       1/AN          5/AN          5/PS         2/AN       
(1-1)      (2-2)         (3-7)         (8-12)       (13-14)   
2--------- 4------------ 5------------ 6----------- 8----------
********************************* TOP OF DATA *****************
F          2             00103            324406493 RR         
F          2             00104             75400478 IO         
F          2             00104            149369958 RR         
F          2             00104            149369958 I1         
F          2             00104            149369958 IO         
F          2             00105            134581135 RR         


Field2-FileA
8/AN       
(200-207)   
7----------
***********
       
       
       
       
       
       


File B:
Code:
FileB-F1  FileB-Key1            FileB-F3          FileB-Key2
1/AN           6/AN             2/PS             5/PS           
(1-1)          (2-7)            (8-9)            (10-14)         
2------------- 3--------------- 4--------------- 5---------------
********************************* TOP OF DATA
F              200104                        100        149369958
F              200104                        100        149369958
F              200104                        100        266864572
F              200105                        100        134581135
F              200127                        100        389608168
F              200127                        100        433666666

FieldB-FileB   FILLER     FieldC-FileB   FILLER     FieldD-FileB   FILLER     
8/AN           2/AN       8/AN           2/AN       8/AN           2/AN       
(113-120)R     (121-122)R (123-130)R     (131-132)R (133-140)R     (141-142)R 
35------------ 36-------- 37------------ 38-------- 40------------ 41-------- 
********************************* TOP OF DATA
64A08A07                  64A08A08                    64A08A09                     
12345A34                                              5ZAR0987                     
43508A03                  43508A03                    43508A03                     
87A08A71                  87A08A71                                                       
                                                      33508A15                             
SD7658Z1                  GFT765K1                    YT678901


My desired output shouldbe:
its the fileA with only this field change.

Code:
Field2-FileA
8/AN       
(200-207)   
7----------
***********
       

12345A34       
87A08A71       
33508A15       
SD7658Z1 
*******************************   


File A should have all records irrespective of matched or non-matched but, the unmatched records will have SPACES in the field Field2-FileA.

Hope I am clear. Please let me know if you need anthing to help.

Thanks,
Viji
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: Thu Aug 23, 2007 11:00 pm    Post subject:
Reply with quote

You seem to have multiple matching keys in the two files, but no rules about which matching record in fileB to use. And your expected output doesn't seem to match up to the rules you've given.

For example, in FileA the indicated records appear to have duplicate keys:

Code:

--key1- -key2---- f1                            -field2-
F200103 324406493 RR
F200104  75400478 IO
F200104 149369958 RR <--- dup1
F200104 149369958 I1 <--- dup2
F200104 149369958 IO <--- dup3
F200105 134581135 RR


In FileB, the indicated records appear to have duplicate keys that all match the previously indicated records in fileA:

Code:

--key1- -key2----           -fieldB-   -fieldC-  -fieldD-
F200104 149369958 <--dupa   64A08A07   64A08A08  64A08A09
F200104 149369958 <--dupb   12345A34             5ZAR0987
F200104 266864572           43508A03   43508A03  43508A03
F200105 134581135           87A08A71   87A08A71
F200127 389608168                                33508A15
F200127 433666666           SD7658Z1   GFT765K1  YT678901


Then for the output, you show:

Code:

--key1- -key2---- f1                            -field2-
F200103 324406493 RR
F200104  75400478 IO
F200104 149369958 RR                            12345A34
F200104 149369958 I1                            87A08A71
F200104 149369958 IO                            33508A15
F200105 134581135 RR                            SD7658Z1


The dup1 record matches the dupa and dupb records. It has an RR so you want FileB FieldB and you chose the one from the dupb record - why?

The dup2 record matches the dupa and dupb records. It has I1 so you want FileB FieldC, but you chose 87A08A71 which doesn't come from either dupa or dupb - why?

The dup3 record matches the dupa and dupb records. It has IO so you want FileB FieldD, but you chose 33508A15 which doesn't come from either dupa or dupb - why?

The F200105 134581135 RR record in FileA matches the F200105 134581135 87A08A71 87A08A71 record in FileB, so I would have expected 87A08A71 in the output but you have SD7658Z1 - why?

You can see my confusion given that some of your output records don't seem to match up to what you've said you want.
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Thu Aug 23, 2007 11:57 pm    Post subject: Reply to: Find&replace from other file.Is this possible
Reply with quote

I am sorry, I tried to edit all scenarios and messed..
FileB doesnot have duplicates.
FileA can have duplicates.

FILEA:
Code:
Key1   Key2   Field1                           Field2
F200103   324406493   RR      
F200104   75400478    IO      
F200104   149369958   RR   <--- dup1   
F200104   149369958   I1   <--- dup2   
F200104   149369958   IO   <--- dup3   
F200105   134581135   RR      
F200127   433666666   RR      


FileB:
Code:
--key1-   -key2----      -fieldB-   -fieldC-   -fieldD-
F200104   149369958      64A08A07   34540U21   45678Y01
F200104   266864572      43508A03   43508A03   43508A03
F200105   134581135      87A08A71   87A08A71       
F200127   389608168                            33508A15             
F200127   433666666      SD7658Z1   GFT765K1   YT678901

Output file:
Code:
Key1   Key2   Field1                         Field2
F200103   324406493   RR      
F200104   75400478    IO      
F200104   149369958   RR   <--- dup1        64A08A07
F200104   149369958   I1   <--- dup2        34540U21
F200104   149369958   IO   <--- dup3        45678Y01
F200105   134581135   RR                    87A08A71
F200127   433666666   RR                    SD7658Z1


Hope I gave the examples correct.
Thanks,
Viji
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: Fri Aug 24, 2007 1:45 am    Post subject:
Reply with quote

Yes, it makes sense now.

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

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/801)
//IN2 DD DSN=...  input file2 (FB/272)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/801)
//TOOLIN   DD    *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(2,6,CH) ON(8,5,PD) -
  KEEPNODUPS KEEPBASE -
  WITHALL WITH(1,802) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,7,8:10,5,802:C'BB',
   804:113,8,123,8,133,8)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(802:C'VV',804:24X)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(802,2,CH,EQ,C'BB'),
    IFOUTLEN=801,
    IFTHEN=(WHEN=(802,2,CH,EQ,C'VB',AND,13,2,CH,EQ,C'RR'),
      OVERLAY=(200:804,8)),
    IFTHEN=(WHEN=(802,2,CH,EQ,C'VB',AND,13,2,CH,EQ,C'I1'),
      OVERLAY=(200:812,8)),
    IFTHEN=(WHEN=(802,2,CH,EQ,C'VB',AND,13,2,CH,EQ,C'IO'),
      OVERLAY=(200:820,8))
/*
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Fri Aug 24, 2007 11:16 pm    Post subject: Reply to: Find&replace from other file.Is this possible
Reply with quote

Frank,
Awesome.. It worked perfectly fine.
I extended to have 10 conditions.
Thanks for your timely help.
-Viji
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: Sat Aug 25, 2007 12:51 am    Post subject:
Reply with quote

Thanks for the feedback. Glad I could help.
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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us