Comapare Two Records in the same File

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Wed Jul 20, 2011 1:23 pm

Hi Frank,

I am trying to run this JOb, becos i have to check the record from coloumn 20 to 301.

Code: Select all

//S1       EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN DD DSN=...  input file (FB/301) 
//SORTOUT DD DSN=...  output file (FB/301) 
//SYSIN    DD *                                        
  OPTION COPY                                          
  OUTFIL REMOVECC,NODETAIL,                            
    SECTIONS=(20,301                                   
      HEADER3=(1,301))                                 
/*                       

But i am getting the following error.
Can you please help me out?

Code: Select all

ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 09:18 ON WED JU
            OPTION COPY                                                         
            OUTFIL REMOVECC,NODETAIL,                                           
              SECTIONS=(19,301                                                  
                              £                                                 
ICE007A 6 SYNTAX ERROR                                                          
                HEADER3=(1,301))                                                
                £                                                               
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY           
ICE751I 0 C5-K51707 C6-K51707 C7-K54603 C8-K51707 E7-K51707                     
ICE052I 3 END OF DFSORT                                                         
                              
Raul

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Wed Jul 20, 2011 4:42 pm

Also please find the File details

Code: Select all

General Data                           Current Allocation                      
 Management class . . : TESTSTD         Allocated cylinders : 4,153            
 Storage class  . . . : STANDARD        Allocated extents . : 1                
  Volume serial . . . : T0Q1T4 +                                               
  Device type . . . . : 3390                                                   
 Data class . . . . . : DB2CLASS                                               
  Organization  . . . : PS             Current Utilization                     
  Record format . . . : FB              Used cylinders  . . : 4,153            
  Record length . . . : 301             Used extents  . . . : 1                
  Block size  . . . . : 27993                                                  
  1st extent cylinders: 4153                                                   
  Secondary cylinders : 500            Dates                                   
  Data set name type  : EXTENDED        Creation date . . . : 2011/07/11       
  SMS Compressible. . : YES             Referenced date . . : 2011/07/20       
                                        Expiration date . . : ***None***       

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Jul 20, 2011 10:27 pm

You have several problems including a missing comma and incorrect SECTION fields - too large and too far out. If I understand what you want, you can use these DFSORT control statements:

Code: Select all

  OPTION COPY                 
  OUTFIL REMOVECC,NODETAIL,   
    SECTIONS=(20,256,276,26,  
      HEADER3=(1,301))        
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Thu Jul 21, 2011 9:06 am

Dear Frank,

I am still getting the error,

Code: Select all

            OPTION COPY                                                         
              OUTFIL REMOVECC,NODETAIL,                                         
                SECTIONS=(20,256,276,26,                                        
                  HEADER3=(1,301))                                              
                             £                                                  
ICE223A F REPORT FIELD ERROR                                                    
ICE751I 0 C5-K51707 C6-K51707 C7-K54603 C8-K51707 E7-K51707                     
ICE052I 3 END OF DFSORT                                                         
What i am trying to do is ...

Code: Select all

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
2009-01-1310.43.11     0 1000000198<ADDRESS_LINE_1>>>>>>>>>>>>>>><ADDRESS_LINE_2
2008-04-2308.42.40 20102 1000000205<ADDRESS_LINE_1>>>>>>>>>>>>>>><ADDRESS_LINE_2
2008-04-1810.13.40-19854 1000000232<ADDRESS_LINE_1>>>>>>>>>>>>>>><ADDRESS_LINE_2
2008-11-0714.26.05     0 1000000731<ADDRESS_LINE_1>>>>>>>>>>>>>>><ADDRESS_LINE_2
From column 20 - 301, if the consecutive record's are same will remove the duplicate. Hope you remember, you gave me the solution for similar one.

Code: Select all

OPTION COPY              
OUTFIL REMOVECC,NODETAIL,
  SECTIONS=&#40;1,23,        
    HEADER3=&#40;1,80&#41;&#41;      
This was worked well....., Can you please help me out & let me know what is the problem here with the bigger file. ?

Regards,
Raul

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Jul 22, 2011 1:31 am

You are missing the DFSORT PTF that allows header fields greater than 256 bytes, so you'll need to use:

HEADER3=(1,256,257,45)

Ask your System Programmer to install PTF UK90025 for z/OS DFSORT V1R10 or PTF UK90026 for z/OS DFSORT V1R12 (Oct, 2010) so you can use the newest DFSORT/ICETOOL functions.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Fri Jul 22, 2011 11:25 am

Thanks a lot frank, it worked.

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Fri Jul 22, 2011 11:31 am

Hello Frank,

I have two files with different record length.

Code: Select all

Management class . . &#58; TESTSTD 
Storage class  . . . &#58; STANDARD
 Volume serial . . . &#58; TTQ1Z0 +
 Device type . . . . &#58; 3390    
Data class . . . . . &#58; DB2CLASS
 Organization  . . . &#58; PS      
 Record format . . . &#58; FB      
 Record length . . . &#58; 308     
 Block size  . . . . &#58; 27720   
 1st extent cylinders&#58; 500     
 Secondary cylinders &#58; 500     
 Data set name type  &#58; EXTENDED
 SMS Compressible. . &#58; YES     

file 2&#58;
Management class . . &#58; TESTSTD 
Storage class  . . . &#58; STANDARD
 Volume serial . . . &#58; T0Q1T4 +
 Device type . . . . &#58; 3390    
Data class . . . . . &#58; DB2CLASS
 Organization  . . . &#58; PS      
 Record format . . . &#58; FB      
 Record length . . . &#58; 301     
 Block size  . . . . &#58; 27993   
 1st extent cylinders&#58; 4153    
 Secondary cylinders &#58; 500     
 Data set name type  &#58; EXTENDED
 SMS Compressible. . &#58; YES     
can you please let me know how to merge them. One column in file 1 is more than file2. I want the output file with all the column's. (Lrec = 308).

thanks,
Raul

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Fri Jul 22, 2011 1:30 pm

For example

Code: Select all

File1&#58;
Date   	time   	Operatorid	Cust-id	Field-1	Field-2
01/01/201111&#58;11&#58;11  aaaaaa      	111111	asa   	sas
01/01/201011&#58;11&#58;11  aaaaaa      	111111	asa   	sas

File2&#58;
Date   	time  	Cust-id	Field-1	Field-2	
01/01/200911&#58;11&#58;11	111111	asa   	sas	
01/01/200811&#58;11&#58;11	222222	asa   	sas	


Output file&#58;
Date   	time  	Operatorid	Cust-id	Field-1	Field-2
01/01/201111&#58;11&#58;11	aaaaaa	111111   	asa   	sas
01/01/201011&#58;11&#58;11	aaaaaa	111111   	asa   	sas
01/01/200911&#58;11&#58;11 	        111111   	asa   	sas
01/01/200811&#58;11&#58;11      		222222   	asa   	sas

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Jul 22, 2011 10:26 pm

What is the starting position of Cust-id, Field-1 and Field-2 in file1?

What is the starting position of Cust-id, Field-1 and Field-2 in file2?

Do you just want to copy the file2 records after the file1 records in the output file (that's not a "merge", it's a MOD)?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Mon Jul 25, 2011 9:24 am

starting position of Cust-id = 26, Field-1 = 36 and Field-2 =51 and so on till 308 in file1. Can we take it as one string ( from 36 to 308) ?
starting position of Cust-id = 20, Field-1 = 30 and Field-2 =46 and so on till 301 in file2. Can we take it as one string ( from 30 to 301) ?

the files are same, but File1 have an additional field called Operator-is. So when we combine both the feilds. As you said it is MOD. And in the output file we have to get all the column's including operator -id for all the rows.

I guess i am clear. Please let me know if not. :)

Raul

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Jul 26, 2011 1:03 am

You can use a DFSORT/ICETOOL job something like this (I'm not sure if I understood the positions just right as you described them, but you can adjust as needed):

Code: Select all

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 &#40;FB/308&#41;
//IN2 DD DSN=...  input file2 &#40;FB/301&#41;
//OUT DD DISP=MOD,DSN=...  output file &#40;FB/308&#41;
//TOOLIN DD *
COPY FROM&#40;IN1&#41; TO&#40;OUT&#41;
COPY FROM&#40;IN2&#41; TO&#40;OUT&#41; USING&#40;CTL1&#41;
/*
//CTL1CNTL DD *
  INREC BUILD=&#40;1,19,26&#58;20,282&#41;
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Post by raulravi » Wed Jul 27, 2011 10:57 am

Frank,

I have a input file as below.

Code: Select all

Input file&#58;
Date  	feild2&3custid	FLD-1	FLD-2	FLD-3	
20110101      	111111	london	Real	Fraud	
20101201      	111111	Madrid	Real	Fraud	
20101101      	111111	london	Real	Fraud	
20110101      	222222	Madrid	Real	Fraud	
20101201      	222222	london	Real	Fraud	
20101101      	222222	Madrid	Real	Fraud	
20101101      	333333	Madrid	Real	Fraud	
1) I have to write the first record of every customer as it is.
2) And again write the first record as it is, but with date from the below
record if the customer is same for both the records.
3) And delete the last record of a customer.
4) But if there is only one record for a customer then write it down to the
output.

the output file should be as below:

Code: Select all

Output file&#58;
Date  	feild2&3custid	FLD-1	FLD-2	FLD-3	
20110101      	111111	london	Real	Fraud	
20111201      	111111	london	Real	Fraud	
20101101      	111111	Madrid	Real	Fraud	
20110101      	222222	Madrid	Real	Fraud	
20111201      	222222	Madrid	Real	Fraud	
20101101      	222222	london	Real	Fraud	
20101101      	333333	Madrid	Real	Fraud	
Can you please help me out at this.

Raul

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Jul 28, 2011 12:41 am

Sorry, but I don't understand your rules as described. Perhaps a larger set of input records (with different variations of two customer id records, three customer id records, four customer id records) and expected output records would help.

At any rate, I'm locking this thread since you seem to be using it for every new unrelated question you have. Please start a new Topic for each new unrelated question.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Locked

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others