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
 

 

Overlaying fields depending on condition

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

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Thu May 24, 2007 2:45 pm    Post subject: Overlaying fields depending on condition
Reply with quote

Hi

I have a requirement as follows. I wrote a cobol program already. But its not efficient enough. I'm looking for an alternative using utilities. Please help. --------->

inputs:
File 1 :RECL=80
File 2 :RECL=81

Output:
File 3 :RECL=80

reqmt:

If record from file1 has match in postions 1-75 with any of the records in file2 AND 81st postion of file2 record is "A", Overlay the 76-80 bytes of file1 with the value from file2 same bytes and put in output

If record from file1 has match in postions 1-75 with any of the records in file2 AND 81st postion of file2 record is "B", eliminate the record.

If a record from file1 has no match in file2, write in file3

Eg:

File1:

1111111111111111.....11111
2222222222222222.....22222
3333333333333333.....33333
4444444444444444......44444

File2:

1111111111111111.....99999A
3333333333333333.....33333B

OUTPUT FILE3
1111111111111111.....99999
2222222222222222.....22222
4444444444444444.....44444
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu May 24, 2007 3:27 pm    Post subject:
Reply with quote

Shanu,

By any chance do you get duplicate records (between 1-75 columns which is considered as key) in both the files? If you have unique records -

(1) Extract all the 'A' records from the second file and build first 80 columns only (say this as tempfile).
(2) Concatenate above tempfile with file1 (in the order). Use ICETOOL SELECT FROM(....) TO(....) ON(1,75,CH) FIRST option to get the wanted records.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 24, 2007 9:57 pm    Post subject:
Reply with quote

Hello,

Please clarify this
Quote:
I wrote a cobol program already. But its not efficient enough


What measurement is being used to determine efficiency?

How many records are in the 2 files?

Both files are in the same sequence, right?

The COBOL code only reads each record one time?
Back to top
View user's profile Send private message
Shanu.sukoor

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Thu May 24, 2007 11:27 pm    Post subject: Re: Overlaying fields depending on condition
Reply with quote

There is no seq for the records. The program reads just one from file1 and compares with all in file2. Moreover I am not supposed to sort it. Usual counts are around 30K for file1 and 1K for file2.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu May 24, 2007 11:47 pm    Post subject:
Reply with quote

You are not supposed to sort it (like in classroom exercise) or not supposed to change its current sequence (like in sort/match/sort back to original sequence)?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 25, 2007 12:39 am    Post subject:
Reply with quote

Hello,

Please explain what business function might be supported by comparing 2 files that are not related (i.e. data sorted in the same sequence)?

Even if this is a student problem, it does not sound like it relates to the sort of requirements a student would be given when a programming position was found after graduating. . . .

Maybe there is more info that we are not aware of. . . .
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri May 25, 2007 5:42 am    Post subject:
Reply with quote

Sounds a lot like the thread in the PL/1 forum.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 25, 2007 5:48 am    Post subject:
Reply with quote

Yup, other than record counts if i recall correctly. . . icon_smile.gif
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri May 25, 2007 11:08 am    Post subject: ICETOOL SOLUTION
Reply with quote

ICETOOL SOLUTION FOR YOR QUESTION IS AS FOLLOWS:

Code:
//*******************************************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
1111111111111111.....11111                                             
2222222222222222.....22222                                             
3333333333333333.....33333                                             
4444444444444444.....44444                                             
/*                                                                     
//IN2      DD *                                                         
1111111111111111.....99999A                                             
3333333333333333.....33333B                                             
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//BOTH     DD SYSOUT=*                                                 
//F1ONLY   DD SYSOUT=*                                                 
//F2ONLY   DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COPY FROM(IN1)  TO(TMP1) USING(CP01)                                   
 COPY FROM(IN2)  TO(TMP1) USING(CP02)                                   
 SPLICE FROM(TMP1) TO(BOTH) ON(1,16,CH) WITH(17,12) WITH(41,1) -       
                            USING(CP03) KEEPNODUPS                     
/*                                                                     
//CP01CNTL DD   *                                                       
  OUTREC BUILD=(1,30,40:C'11')                                         
/*                                                                     
//CP02CNTL DD   *                                                       
  OUTREC BUILD=(1,30,40:C'22')                                         
/*                                                                     
//CP03CNTL DD   *                                                       
  OUTFIL FNAMES=BOTH,INCLUDE=(40,2,CH,EQ,C'12'),BUILD=(1,30)           
  OUTFIL FNAMES=F1ONLY,INCLUDE=(40,2,CH,EQ,C'11'),BUILD=(1,30)         
  OUTFIL FNAMES=F2ONLY,INCLUDE=(40,2,CH,EQ,C'22'),BUILD=(1,30)         
/*                                                                     



Now the o/p BOTH contains:
Code:
1111111111111111.....99999A
3333333333333333.....33333B


and the o/p F1ONLY conatins
Code:
2222222222222222.....22222
4444444444444444.....44444




Now merge both the files -(BOTH & F1ONLY), by omiting the records that contain 'B' in 27th position.

Hope this is wt u required.
Back to top
View user's profile Send private message
Shanu.sukoor

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Fri May 25, 2007 4:36 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

Please explain what business function might be supported by comparing 2 files that are not related (i.e. data sorted in the same sequence)?

Even if this is a student problem, it does not sound like it relates to the sort of requirements a student would be given when a programming position was found after graduating. . . .

Maybe there is more info that we are not aware of. . . .



It is financial level information that comes to my system and ouput goes to another vendor. Both the files come from 2 vendors and it should be in the order of file1. In between it should be processed in the above explained way. So I should not change the sequence. I'm sorry that I cannot brief the business implication here.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri May 25, 2007 9:22 pm    Post subject:
Reply with quote

Hello,

The explained way may not always give good/accurate results as well as taking a very large amount of machine resources.

How should duplicates in either file be handled?

Is there some reason the files cannot be sorted into "new" work files and compared? What does the "explained way" provide that working with the same data properly ordered would not? When the work files were built, a "sequence number" could be appended so that there would be a reference back to the original input if that was needed. . .
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sat May 26, 2007 1:12 pm    Post subject: did my suggestion work?
Reply with quote

Shanu.sukoor

did u try my code?
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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am


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