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

Need to write 3 output files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Sun Dec 31, 2006 2:59 pm
Reply with quote

Hi All,

Iam having 2 sequential Files. Both files are having common Records and uncommon Records.

My Requirement is I wanted to write common Records into one file and Uncommon records which is having in the first file needs to write into one file and in the same way i need to write uncommon records which is having in the second file, i need to write into a seperate file.

So finally 3 output files will come.

1. Common Records in 2 files.

2. Uncommon Records in First file

3. Uncommon Records in 3rd file.

Could you please help me out how to write a JCL for this requirement.

It will be a great help to me.

Thanks in advance to all of you.

Thanks and Regards,
Samba.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Sun Dec 31, 2006 4:58 pm
Reply with quote

Hi Samba,

What sort do you have?

Did you scan some of the posts in the DFSORT/ICETOOL forun? Your solution is probably already there.
Quote:
1. Common Records in 2 files.

2. Uncommon Records in First file

3. Uncommon Records in 3rd file.
Did you mean the 2nd file?

Could you provide sample input for both files and what you want the input to look like in your 3 output files? Use the "CODE" button for your sample data and "preview" to see how it looks.

Include recform and lrecl and anything special, like the "commen" key and the presense of duplicates on one or the other inputs.

Information leads to knowledge and knoledge is power.

Looking forward to your next post,

Bill
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Sun Dec 31, 2006 5:18 pm
Reply with quote

Hi Bill,

Thanks for your quick response.

Yes i mean that 2nd File only.

The two files are already sorted by DFSORT.

Files are having Client Numbers(PIC 9(9) COMP) and Policy Numbers(PIC S9(9) COMP).

In these two files some of the Policy Numbers are common and some of the policiy numbers are not common in both the files.

My requirement is which ic common in both files i need to keep in first output file

Which is not common(Policies) in both files i need to put in seperate files.


Suppose if policy numbers are there in first file and not in second file i need to keep in one file and viceversa.


Cheers,
Samba.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Sun Dec 31, 2006 5:59 pm
Reply with quote

Samba,

Go look at this thread http://ibmmainframes.com/viewtopic.php?t=16747, the dark boxes are created with the "CODE" button. make examples of your input. Show example of what you want.

Bill
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun Dec 31, 2006 9:22 pm
Reply with quote

Samba,

You can do what you want using the technique discussed in the "Create files with matching and non-matching records" Smart DFSORT Trick at:

http://.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Sun Dec 31, 2006 10:16 pm
Reply with quote

Hi Frank and Bill,

Thanks for your prompt answers.

Hi Frank,

Here i don't understand onething. I opened the link whichever you have given and read the topic Create files with matching and non-matching records.

Using the SPLICE parameter 11, 12 and 22 adding as identifiers.

Why we are doing this one. Iam not clear about this.

Could you please clarify me regarding th

Thanks for your help and patience.

Cheers,
Samba.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Sun Dec 31, 2006 10:29 pm
Reply with quote

sambasivarao wrote:
Using the SPLICE parameter 11, 12 and 22 adding as identifiers.
Why we are doing this one. Iam not clear about this.

The two digits show which file the record was in to start while splicing the second digit on a match leaves the output of the matches altered. 11 or 22 were no match and 12 was a match making it easy for the outfil include to split the combined data to the three required outputs.
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Sun Dec 31, 2006 10:39 pm
Reply with quote

Hi Bill,

Thanks for quik response and your valuable clarifications.

Thanks a lot.

Cheers,
Samba.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 01, 2007 9:44 pm
Reply with quote

Quote:
Using the SPLICE parameter 11, 12 and 22 adding as identifiers.

Why we are doing this one.


Samba,

I actually explained that in the discussion of that Topic:

Quote:
The trick here is to add an identifier of '11' to the File1 records, add an identifier of '22' to the File2 records, and splice the second id byte for matching records so we get '12' for names in both files, '11' for names only in File1 and '22' for names only in File2.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Jan 02, 2007 10:45 am
Reply with quote

Hi There,

Code:
//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN1      DD *                                           
AAA123BBBBBB                                             
AAA222BBBBBB                                             
AAA333CCCCCCC                                             
/*                                                       
//IN2      DD *                                           
AAA111BBBBBB                                             
AAA222BBBBBB                                             
AAA333CCCCCCC                                             
/*                                                       
//T1        DD DSN=&&T1,SPACE=(CYL,(5,5),RLSE),DISP=(MOD,PASS)
//FILEA     DD SYSOUT=*                                   
//FILEB     DD SYSOUT=*   
//FILEC     DD SYSOUT=*                                   
//TOOLIN    DD   *                                         
  COPY FROM(IN1) USING(CTL1)                               
  COPY FROM(IN2) USING(CTL2)                               
  SORT FROM(T1) USING(CTL3)                               
/*                                                         
//CTL1CNTL  DD *                                           
  OUTFIL FNAMES=T1,OUTREC=(1,80,C'1')                     
/*                                                         
//CTL2CNTL  DD   *                                         
  OUTFIL FNAMES=T1,OUTREC=(1,80,C'2')                     
/*                                                         
//CTL3CNTL  DD   *                                           
  OPTION EQUALS                                               
  SORT FIELDS=(1,13,CH,A)                                     
  SUM FIELDS=(81,1,ZD)                                       
  OUTFIL FNAMES=FILEA,INCLUDE=(81,1,ZD,EQ,3),OUTREC=(1,80)     
  OUTFIL FNAMES=FILEB,INCLUDE=(81,1,CH,EQ,C'1'),OUTREC=(1,80)
  OUTFIL FNAMES=FILEC,INCLUDE=(81,1,CH,EQ,C'2'),OUTREC=(1,80)
/*



Hope it will helpful
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 02, 2007 10:03 pm
Reply with quote

Ekta,

I'm not sure why you're showing this "alternative" to the Smart DFSORT Trick for the same thing, but if you're going to continue to show it, would you please, please stop using concatenation as it can cause problems due to the system restriction discussed in the second bullet at:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/1.8.3.1?SHELF=&DT=20060615185603&CASE=

Use one T1 MOD data set instead of T1 and T2 and concatenation.

I've fixed your job above to use a T1 MOD data set. If you feel the need to post this example again, please post the T1 MOD version, not the concatenation version.
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Tue Jan 02, 2007 10:58 pm
Reply with quote

Is it possible to resolve this issue with out DFSORT.

Could you Please let me know if any one is having idea.

Cheers,
Samba.
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: Tue Jan 02, 2007 11:23 pm
Reply with quote

Hello,

A COBOL program should work nicely. . . .
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Wed Jan 03, 2007 8:12 pm
Reply with quote

Hi Frank,

I gone thru the below PDF provided by you.

ibm.com/servers/storage/support/software/sort/mvs/tricks/

Topic is "Create files with matching and non-matching records"

SPLICE FROM(T1) TO(OUT12) ON(1,10,CH) WITH(13,1) -

In the above statement could you please explain what is meant by

WITH(13,1).

Here iam unable to understand the number 13.

Could you please help me regarding the same.

Thanks in advance for your help.

Cheers,
Samba.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jan 03, 2007 10:04 pm
Reply with quote

We put a '11' in positions 12-13 for each file1 record and a '22' in positions 12-13 for each file2 record. When file1 and file2 have a "match", WITH(13,1) splices position 13 from the file2 record (the "overlay" record) into position 13 of the file1 record (the "base" record) giving a '12'. So matching records will have a '12' in positions 12-13, whereas file1 only records will have a '11' in position 12-13 and file2 only records will have a '22' in positions 12-13.

For complete information on the SPLICE operator of DFSORT's ICETOOL, see:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.13?DT=20060615185603
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Fri Jan 05, 2007 5:11 pm
Reply with quote

Hi Frank,

Thanks for the response.

Here iam having one more doubt.... Could you please let me clarify.....

After putting the DFSORT coding in JCL....where i need to mention output files in JCL and how it will recognize that.....matching records will go to the particular Sequential file and unmatched the records will go to particular Sequential file.....


Could you please help me out regarding this.

Thanks in advance for your help.

Cheers,
Samba.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Fri Jan 05, 2007 5:18 pm
Reply with quote

If you followed the example in Frank's Smart DFSORT Tricks,

Code:

* Write matching records to OUT12 file. Remove id.
  OUTFIL FNAMES=OUT12,INCLUDE=(12,2,CH,EQ,C'12'),BUILD=(1,10)
* Write FILE1 only records to OUT1 file. Remove id.
  OUTFIL FNAMES=OUT1,INCLUDE=(12,2,CH,EQ,C'11'),BUILD=(1,10)
* Write FILE2 only records to OUT2 file. Remove id.
  OUTFIL FNAMES=OUT2,INCLUDE=(12,2,CH,EQ,C'22'),BUILD=(1,10)


The FNAMES keyword points to the DD.
Did that help?
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Fri Jan 05, 2007 6:34 pm
Reply with quote

Hi William,

Thanks for the quick response.

I can mention like this for this.
[* Write matching records to OUT12 file. Remove id.
OUTFIL FNAMES=SAMBA.SRTOT.OUT12.DEL365,INCLUDE=(12,2,CH,EQ,C'12'),BUILD=(1,10)
* Write FILE1 only records to OUT1 file. Remove id.
OUTFIL FNAMES=SAMBA.SRTOT.OUT1.DEL365,INCLUDE=(12,2,CH,EQ,C'11'),BUILD=(1,10)
* Write FILE2 only records to OUT2 file. Remove id.
OUTFIL FNAMES=SAMBA.SRTOT.OUT2.DEL365,INCLUDE=(12,2,CH,EQ,C'22'),BUILD=(1,10)]

Could you please clarify me reegarding the same.

Thanks in advance for your help.

Cheers,
Samba.

[/quote][/code]
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Fri Jan 05, 2007 6:40 pm
Reply with quote

I don't think so, the FNAMES are for the DD name, you have listed the dataset name....like:
FNAMES=OUT12
//OUT12 DD DSN=SAMBA.SRTOT.OUT12.DEL365,...
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Fri Jan 05, 2007 6:51 pm
Reply with quote

Hi,

Thanks for the quick response...

I mentioned the First Input file like below.

IN1 DD DSN=SAMBA.RA186.SORTOUT.SQLA6.Y120619,
DISP=(NEW,CATLG,CATLG),
UNIT=DEVPOOL,
SPACE=(CYL,(10,15),RLSE),
DCB=(LRECL=91,BLKSIZE=0,RECFM=FB)

IN2 DD DSN=SAMBA.RA186.SRTOUT.NOVBARC.Y120629,
DISP=(NEW,CATLG,CATLG),
UNIT=DEVPOOL,
SPACE=(CYL,(10,15),RLSE),
DCB=(LRECL=91,BLKSIZE=0,RECFM=FB)

Can i mention in the same way output files like above.

Because i need to store this data in Sequential file...

Could you please help me out.

Thanks a lot...

Cheers,
Samba.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Fri Jan 05, 2007 7:04 pm
Reply with quote

Assuming this:
Code:
OUTFIL FNAMES=OUT12,INCLUDE=....
OUTFIL FNAMES=OUT1,INCLUDE=....
OUTFIL FNAMES=OUT2,INCLUDE=....
And this:
Code:
COPY FROM(IN1)....
COPY FROM(IN1)....
The DDs would something like this:
Code:
IN1     DD DSN=SAMBA.RA186.SORTOUT.SQLA6.Y120619,DISP=OLD
IN2     DD DSN=SAMBA.RA186.SRTOUT.NOVBARC.Y120629,DISP=OLD
OUT12 DD DSN=SAMBA.SRTOT.OUT12.DEL365,
        DISP=(NEW,CATLG,CATLG),
        UNIT=DEVPOOL,
        SPACE=(CYL,(10,15),RLSE),
        DCB=(LRECL=91,BLKSIZE=0,RECFM=FB)
OUT1  DD DSN=SAMBA.SRTOT.OUT12.DEL365,
        DISP=(NEW,CATLG,CATLG),
        UNIT=DEVPOOL,
        SPACE=(CYL,(10,15),RLSE),
        DCB=(LRECL=91,BLKSIZE=0,RECFM=FB)
OUT2  DD DSN=SAMBA.SRTOT.OUT12.DEL365,
        DISP=(NEW,CATLG,CATLG),
        UNIT=DEVPOOL,
        SPACE=(CYL,(10,15),RLSE),
        DCB=(LRECL=91,BLKSIZE=0,RECFM=FB)
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Fri Jan 05, 2007 7:18 pm
Reply with quote

Hi,

Thanks a lot for quicke response..

Could you please let me know what is the use of the below statement.

//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
// DISP=(MOD,PASS)

Thanks in advance for your help.

Cheers,
Samba.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Fri Jan 05, 2007 7:25 pm
Reply with quote

That is a sort of temporary file for holding intermediate data referred to in these:
Code:
COPY FROM(IN2) TO(T1)....
.
.
SPLICE FROM(T1) TO(OUT12)....
Back to top
View user's profile Send private message
sambasivarao

New User


Joined: 10 Jul 2006
Posts: 47
Location: Bangalore

PostPosted: Fri Jan 05, 2007 7:44 pm
Reply with quote

Hi,

Thanks for the quick response.

Could you please let me know what is the significance of below statement.

INREC OVERLAY=(12:C'11')

Thanks for patience and prompt answers.

Thanks in advance for your help.

Cheers,
Samba.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Fri Jan 05, 2007 7:50 pm
Reply with quote

Frank Yaeger wrote:
Quote:
Using the SPLICE parameter 11, 12 and 22 adding as identifiers.

Why we are doing this one.


Samba,

I actually explained that in the discussion of that Topic:

Quote:
The trick here is to add an identifier of '11' to the File1 records, add an identifier of '22' to the File2 records, and splice the second id byte for matching records so we get '12' for names in both files, '11' for names only in File1 and '22' for names only in File2.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top