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

Overlaying fields depending on condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Thu May 24, 2007 3:27 pm
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

Moderator Emeritus


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

PostPosted: Thu May 24, 2007 9:57 pm
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
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: 3156
Location: Tucson AZ

PostPosted: Thu May 24, 2007 11:47 pm
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

Moderator Emeritus


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

PostPosted: Fri May 25, 2007 12:39 am
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
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

Moderator Emeritus


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

PostPosted: Fri May 25, 2007 5:48 am
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
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
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

Moderator Emeritus


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

PostPosted: Fri May 25, 2007 9:22 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How can I select certain file dependi... JCL & VSAM 12
This topic is locked: you cannot edit posts or make replies. How can I select certain file dependi... Compuware & Other Tools 1
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts How to give complex condition in JCL . CLIST & REXX 30
No new posts selectively copy based on condition DFSORT/ICETOOL 3
Search our Forums:

Back to Top