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
 

 

Compare 2 files and write into another file as given below

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

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Tue Aug 21, 2007 5:12 pm    Post subject: Compare 2 files and write into another file as given below
Reply with quote

Hi,

I have one file File1 for example as below:-

Column1

AAAA
BBBB
CCCC
RRRR
TTTT
ZZZZ
XXXX
YYYY
I have another master file File2 with 2 columns as below :-

Fileld1 Description
AAAA Make a diff
BBBB Do this
CCCC let do
EEEE aout this
FFFF hang
GGGG bang
HHHH tong
TTTTT thang
KKKK dang
OOOO bonggs

Now my requirement is i have to match the column1 in File1 with field1 in file2, if there is a match i have to right field1 & description Columns to another output file, if there is no match i have to write column1 data in file1 to output file with both the columns with the same column1 data for example the output should look like this.

Output file
Field2 Description

AAAA Make a diff
BBBB Do this
CCCC let do
RRRR RRRR
XXXX XXXX
YYYY YYYY
Please let me know the solution, if you did not understand the requirement
Please let me know.

Thanks
Back to top
View user's profile Send private message

shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Aug 21, 2007 6:54 pm    Post subject:
Reply with quote

Code:
// EXEC PGM=ICETOOL   
//DFSMSG DD SYSOUT=* 
//TOOLMSG DD SYSOUT=*
//FILE1 DD *         
AAAA                 
BBBB                 
CCCC                 
RRRR                 
TTTT                 
ZZZZ                 
XXXX                 
YYYY                 
/*                   
//FILE2 DD *         
AAAA MAKE A DIFF     
BBBB DO THIS         
CCCC LET DO           
EEEE AOUT THIS                                                       
FFFF HANG                                                           
GGGG BANG                                                           
HHHH TONG                                                           
TTTT THANG                                                           
KKKK DANG                                                           
OOOO BONGGS                                                         
/*                                                                   
//T1 DD DSN=&&T1,DISP=(MOD,PASS)                                     
//OUT DD SYSOUT=*                                                   
//TOOLIN DD *                                                       
 COPY FROM(FILE2) TO(T1) USING(CTL1)                                 
 COPY FROM(FILE1) TO(T1) USING(CTL2)                                 
 SPLICE FROM(T1) TO(OUT) ON(1,4,CH) WITH(82,1) KEEPNODUPS USING(CTL3)
/*                                                                   
//CTL1CNTL DD *                                                     
 INREC OVERLAY=(81:C'22')                                           
/*                                                                   
//CTL2CNTL DD *                                                     
 INREC OVERLAY=(81:C'11')                                 
/*                                                       
//CTL3CNTL DD *                                           
 OUTFIL OMIT=(81,2,CH,EQ,C'22'),                         
 IFTHEN=(WHEN=(81,2,CH,EQ,C'11'),BUILD=(1,4,X,1,4,71X)), 
 IFTHEN=(WHEN=NONE,BUILD=(1,80))                         
/*                                                       
//
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Wed Aug 22, 2007 2:03 pm    Post subject: Reply to: Compare 2 files and write into another file as gi
Reply with quote

Thanks a lot its working
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Wed Aug 22, 2007 3:06 pm    Post subject: How to insert header
Reply with quote

Hi,

How to insert header code in the above Jcl that needs to be in the output file.

Thanks
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Aug 22, 2007 4:51 pm    Post subject:
Reply with quote

Madhu Reddy
Check the topic Headers in z/OS V1R8.0 DFSORT: Getting Started at http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1cg20/2.6.8.2?ACTION=MATCHES&REQUEST=header1&TYPE=FUZZY&SHELF=ICE1SH20.bks&DT=20060615173822&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

Using the info from above link, you can add a header in your CTL3CNTL control card.
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Wed Aug 22, 2007 7:10 pm    Post subject: Unable to get the header
Reply with quote

In my Output file, there will be 2 fields

one is group id with length 7 and Groupid description that starts at 8 column, can you suggest me the solution in the above jcl for header to be included in the output report.

Thanks
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Aug 22, 2007 7:38 pm    Post subject:
Reply with quote

Code:
// EXEC PGM=ICETOOL       
//DFSMSG DD SYSOUT=*       
//TOOLMSG DD SYSOUT=*     
//FILE1 DD *               
AAAA                       
BBBB                       
CCCC                       
RRRR                       
TTTT                       
ZZZZ                       
XXXX                       
YYYY                       
/*                         
//FILE2 DD *               
AAAA    MAKE A DIFF       
BBBB    DO THIS           
CCCC    LET DO             
EEEE    AOUT THIS                                                   
FFFF    HANG                                                         
GGGG    BANG                                                         
HHHH    TONG                                                         
TTTT    THANG                                                       
KKKK    DANG                                                         
OOOO    BONGGS                                                       
/*                                                                   
//T1 DD DSN=&&T1,DISP=(MOD,PASS)                                     
//OUT DD SYSOUT=*                                                   
//TOOLIN DD *                                                       
 COPY FROM(FILE2) TO(T1) USING(CTL1)                                 
 COPY FROM(FILE1) TO(T1) USING(CTL2)                                 
 SPLICE FROM(T1) TO(OUT) ON(1,7,CH) WITH(82,1) KEEPNODUPS USING(CTL3)
/*                                                                   
//CTL1CNTL DD *                                                     
 INREC OVERLAY=(81:C'22')                                           
/*                                                                   
//CTL2CNTL DD *                                                 
 INREC OVERLAY=(81:C'11')                                       
/*                                                               
//CTL3CNTL DD *                                                 
 OUTFIL OMIT=(81,2,CH,EQ,C'22'),                                 
 IFTHEN=(WHEN=(81,2,CH,EQ,C'11'),BUILD=(1,7,X,1,7,65X)),         
 IFTHEN=(WHEN=NONE,BUILD=(1,80)),                               
 HEADER1=(7C'-',C' ',19C'-',/,                                   
 'GROUPID GROUPID DESCRIPTION',/,7C'-',C' ',19C'-'),REMOVECC     
/*                                                               
//                                                               

Output:
Code:
------- -------------------
GROUPID GROUPID DESCRIPTION
------- -------------------
AAAA    MAKE A DIFF       
BBBB    DO THIS           
CCCC    LET DO             
RRRR    RRRR               
TTTT    THANG             
XXXX    XXXX               
YYYY    YYYY               
ZZZZ    ZZZZ               
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Thu Aug 23, 2007 10:33 am    Post subject:
Reply with quote

Thanks Its working
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Fri Aug 24, 2007 12:27 pm    Post subject: Now my requirement has been changed- Please clarify
Reply with quote

Now my output should contains

ccyymmdd Groupid GROUPID DESCRIPTION
-------- ------- -------------------
Today date AAAA MAKE A DIFF
Today date BBBB DO THIS
Today date CCCC LET DO
Today date RRRR RRRR
Today date TTTT THANG
Today date XXXX XXXX
Today date YYYY YYYY
Today date ZZZZ ZZZZ

In CCYYMMDD current date should be there and

CCYYMMDD position (1-10)
Groupid (11-26)
Groupid-desc (27-42)

At the end there should be Footer Counting the total # of records

NUMBER OF DETAIL RECORDS: 999,999,999

Please clarify ITS URGENT.

Thanks
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Fri Aug 24, 2007 12:38 pm    Post subject: Compare 2 files and write into another file as per the below
Reply with quote

Hi,

I have one file File1 for example as below:-

Column1

AAAA
BBBB
CCCC
RRRR
TTTT
ZZZZ
XXXX
YYYY
I have another master file File2 with 2 columns as below :-

Fileld1 Description
AAAA Make a diff
BBBB Do this
CCCC let do
EEEE aout this
FFFF hang
GGGG bang
HHHH tong
TTTTT thang
KKKK dang
OOOO bonggs

Now my requirement is i have to match the column1 in File1 with field1 in file2, if there is a match i have to right field1 & description Columns to another output file, if there is no match i have to write column1 data in file1 to output file with both the columns with the same column1 data for example the output should look like this.

Output file

CCYYMMDD Field2 Description

Currdate AAAA Make a diff
currdate BBBB Do this
currdate CCCC let do
currdate RRRR RRRR
currdate XXXX XXXX
currdate YYYY YYYY

There should be header CCYYMMDD (1-10), Field2 (11-26), Description (27-42)


Footer should calculate the total rec display as below

NUMBER OF DETAIL RECORDS: 999,999,999

Please let me know the solution, if you did not understand the requirement
Please let me know.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Fri Aug 24, 2007 1:15 pm    Post subject:
Reply with quote

Code:
// EXEC PGM=ICETOOL             
//DFSMSG DD SYSOUT=*             
//TOOLMSG DD SYSOUT=*           
//FILE1 DD *                     
AAAA                             
BBBB                             
CCCC                             
RRRR                             
TTTT                             
ZZZZ                             
XXXX                             
YYYY                             
/*                               
//FILE2 DD *                     
AAAA MAKE A DIFF                 
BBBB DO THIS                     
CCCC LET DO                     
EEEE AOUT THIS                                                         
FFFF HANG                                                             
GGGG BANG                                                             
HHHH TONG                                                             
TTTT THANG                                                             
KKKK DANG                                                             
OOOO BONGGS                                                           
/*                                                                     
//T1 DD DSN=&&T1,DISP=(MOD,PASS)                                       
//OUT DD SYSOUT=*                                                     
//TOOLIN DD *                                                         
 COPY FROM(FILE2) TO(T1) USING(CTL1)                                   
 COPY FROM(FILE1) TO(T1) USING(CTL2)                                   
 SPLICE FROM(T1) TO(OUT) ON(1,4,CH) WITH(82,1) KEEPNODUPS USING(CTL3) 
/*                                                                     
//CTL1CNTL DD *                                                       
 INREC OVERLAY=(81:C'22')                                             
/*                                                                     
//CTL2CNTL DD *                                                       
 INREC OVERLAY=(81:C'11')                                             
/*                                                                     
//CTL3CNTL DD *                                                       
 OUTFIL OMIT=(81,2,CH,EQ,C'22'),                                       
 IFTHEN=(WHEN=(81,2,CH,EQ,C'11'),BUILD=(DATE1,2X,1,4,22X,1,4,40X)),   
 IFTHEN=(WHEN=NONE,BUILD=(DATE1,2X,1,4,22X,6,38)),                     
 HEADER1=(8C'-',2X,8C'-',18X,19C'-',25X,/,                             
 C'CCYYMMDD',2X,C'GROUP ID',18X,C'GROUPID DESCRIPTION',25X,/,         
 8C'-',2X,8C'-',18X,19C'-',25X),                                       
 TRAILER1=(37C'-',43X,/,                                               
 C'NUMBER OF DETAIL RECORDS: ',COUNT=(EDIT=(TTT,TTT,TTT)),/,           
 37C'-',43X),                                                         
 REMOVECC                                                             
/*                                                                     
//                                                                     

Output:
Code:
--------  --------                  ------------------- 
CCYYMMDD  GROUP ID                  GROUPID DESCRIPTION 
--------  --------                  ------------------- 
20070824  AAAA                      MAKE A DIFF         
20070824  BBBB                      DO THIS             
20070824  CCCC                      LET DO               
20070824  RRRR                      RRRR                 
20070824  TTTT                      THANG               
20070824  XXXX                      XXXX                 
20070824  YYYY                      YYYY                 
20070824  ZZZZ                      ZZZZ                 
-------------------------------------                   
NUMBER OF DETAIL RECORDS: 000,000,008                   
-------------------------------------
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Fri Aug 24, 2007 1:56 pm    Post subject: I amextremely Sorry , This is not the layout and it is below
Reply with quote

Hi,

I am sorry the output should be as below
The below is the header
CCYYMMDD(1-10) AIT SHORT NAME (11-26) Group Desc(27-42)

Detail Record should be

Application Group Name(1-32) Application Group Description (33-76)

Finally It should be as below

CCYYMMDD AIT SHORT NAME Group Desc

Application Group Name Application Group Description


NUMBER OF DETAIL RECORDS: 999,999,999

Please clarify as early as possible , its urgent

Thanks
Back to top
View user's profile Send private message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Fri Aug 24, 2007 2:06 pm    Post subject:
Reply with quote

Finally the output should be like this


CCYYMMDD AIT SHORT NAME Group Desc



Application Group Name Application Group Description

AAAA Make a diff
BBBB Do this
CCCC let do
RRRR RRRR
XXXX XXXX
YYYY YYYY

NUMBER OF DETAIL RECORDS: 999,999,999

Please clarify

Thanks
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. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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