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
 

 

Comparing two files of different lengths.

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

New User


Joined: 28 Mar 2012
Posts: 2
Location: USA

PostPosted: Thu Mar 29, 2012 9:32 pm    Post subject: Comparing two files of different lengths.
Reply with quote

Hi,

I need to compare two files of different lengths and key fields are also in different positions. Please find the details as below:

FILE-1, LRECL=2000 & FB, Key field position - 1 to 20 (X(20)).
Sample data:

Key-Field Field-2 (Pos-145 len-9) Fild-3(pos-511-len-1)
--------- ------------------------ -----------
0000000000000000000003/29/2012 ==> Header with date
11111111111111111111 123456789 C
22222222222222222222 777888999 O
33333333333333333333 666333222
44444444444444444444 111444777 O
55555555555555555555 111555999 C
66666666666666666666 888555222 C
77777777777777777777 111222333 E
88888888888888888888 999666333 E
9999999999999999999900000010 ==> Trailer with record count

FILE-2, LRECL=691 & FB, Key field position - 280 to 299 (X(20)).
Sample data:

Key-Field
-----------
1111111111111111111
3333333333333333333
5555555555555555555

The output file will be LRECL=2000 & FB and this needs to created based on below conditions.

1. Header and trailer needs to copied as is, but trailer should be updated with latest count of records.
2. The output file will have all matching and non-matching record but with Field-3 NOT = 'E' and with another below condition.
3. For all matching record, Field-2 should be copied as it is and for all non-matching records Field-2 should be masked (spaced out). Field-2 has sensitive data and we need to mask it for all non-matching records.

The desired output would looks like:
Key-Field Field-2 (Pos-145 len-9) Fild-3(pos-511-len-1)
--------- ------------------------ -----------
0000000000000000000003/29/2012 ==> Header with date
11111111111111111111 123456789 C
22222222222222222222 O
33333333333333333333 666333222
44444444444444444444 O
55555555555555555555 111555999 C
66666666666666666666 C
9999999999999999999900000008 ==> Trailer with record count

I am sorry, if I am having too many condition check here, I am not sure whether we can achieve this using ICETOOL/DFSORT. Please let me know.

I am attaching the document which has screen prints of sample data.
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Mar 29, 2012 10:23 pm    Post subject: Reply to: Comparing two files of different lengths.
Reply with quote

Mahan Mh,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//INA      DD DSN=Your Input FB 2000 byte file,DISP=SHR
//INB      DD DSN=Your Input FB 691 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  OPTION COPY                                               
  JOINKEYS F1=INA,FIELDS=(001,20,A),OMIT=(511,1,CH,EQ,C'E')
  JOINKEYS F2=INB,FIELDS=(280,20,A)                         
  JOIN UNPAIRED,F1                                         
  REFORMAT FIELDS=(F1:1,2000,?)                             
                                                           
  OUTFIL IFOUTLEN=2000,                                     
  IFTHEN=(WHEN=(2001,1,CH,EQ,C'1'),OVERLAY=(145:9X)),       
  IFTRAIL=(TRLID=(1,20,CH,EQ,C'99999999999999999999'),     
  TRLUPD=(21:COUNT+1=(M11,LENGTH=8)))                       
//*
Back to top
View user's profile Send private message
Mahan Mh

New User


Joined: 28 Mar 2012
Posts: 2
Location: USA

PostPosted: Fri Mar 30, 2012 1:50 am    Post subject:
Reply with quote

Thank you lot Kolusu for all your help and time. I got the desired output.

Thanks,
Mahan.
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 getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


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