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
 

 

Include condition value in dataset

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

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Tue Mar 30, 2010 5:37 pm    Post subject: Include condition value in dataset
Reply with quote

I have a dataset:

TEST.GROUPS (FB,LRECL=8)
AAAAAAAA
BBBBBBBB
CCCCCCC
HHHHHHHH


IN.DATASET (FB.LRECL=80) contains :

AAAAAAAA DATA1A........
AAAAAAAA DATA1B........
AAAAAAAA DATA1C........
BBBBBBBB DATA2A........
BBBBBBBB DATA2A........
CCCCCCC DATA3A........
DDDDDDD DATA4A........
EEEEEEEEE DATA5A........
EEEEEEEEE DATA5B........
EEEEEEEEE DATA5C........
FFFFFFFFFF DATA6A........
GGGGGGG DATA7A........
HHHHHHHH DATA8A........
HHHHHHHH DATA8B........
HHHHHHHH DATA8C........


The output should compare the two datasets for the 1st 8 bytes and give a third datset with all the matching records from the IN.DATASET

In this case, the OUT.DATSET(FB,LRECL=80) should contain

AAAAAAAA DATA1A........
AAAAAAAA DATA1B........
AAAAAAAA DATA1C........
BBBBBBBB DATA2A........
BBBBBBBB DATA2A........
CCCCCCC DATA3A........
HHHHHHHH DATA8A........
HHHHHHHH DATA8B........
HHHHHHHH DATA8C........

Because 8 As , 8Bs, 8 Cs and 8 Hs are existing in TEST.GROUPS.

Can we achieve it through SORT INCLUDE COND?

Can the INCLUDE COND be extended to other datasets ?

Thanking in advance,
Rakesh.
Back to top
View user's profile Send private message

Bala1

New User


Joined: 18 Mar 2010
Posts: 6
Location: london

PostPosted: Tue Mar 30, 2010 5:42 pm    Post subject:
Reply with quote

Rakesh,
Please have a look in the below link..

section Cartesian join

ftp://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Tue Mar 30, 2010 6:07 pm    Post subject:
Reply with quote

Thanks Bala!

The Cartesian Join will merge records from both the files.

But in my requirement, the output file should contain records from IN.DATSET (File2) with a match in TEST.GROUPS(File1).

The output should not contain records from TEST.GROUPS (File1).

Will the Cartesian Join Help ?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Mar 30, 2010 8:34 pm    Post subject:
Reply with quote

Hello,

Quote:
Will the Cartesian Join Help ?
No. I don't know why this was suggested. . .

Unless i completely misunderstand what you are looking for, you want a 2-file match on a key (not a Cartesian product). . .

There are many examples of matching 2 files in the forum. . . Suggest you use one of these as a guide.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Mar 30, 2010 10:11 pm    Post subject:
Reply with quote

rakesh1155,

The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=your 8 byte input file,DISP=SHR
//SORTOUT  DD DSN=&&TM80,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)           
//HDR      DD DSN=&&HDR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)             
//OUT      DD SYSOUT=*                                                 
//SYSIN    DD    *                                                     
  SORT FIELDS=COPY                                                     
  OUTREC OVERLAY=(80:X)                                                 
  OUTFIL FNAMES=HDR,ENDREC=1,BUILD=(C'$$$',80:X)                       
//*                                                                     
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.HDR                 
//         DD DSN=&&TM80,DISP=SHR                                       
//         DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.HDR                 
//         DD DSN=your input 80 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(81:ID=1))     
  SORT FIELDS=(1,8,CH,A),EQUALS                                         
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(83:SEQNUM,8,ZD,RESTART=(1,8))),     
  IFTHEN=(WHEN=GROUP,BEGIN=(83,8,ZD,EQ,1),PUSH=(82:81,1))               
                                                                       
  OUTFIL INCLUDE=(81,2,ZD,EQ,21,AND,1,3,CH,NE,C'$$$'),BUILD=(1,80)     
//*
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Mar 30, 2010 11:41 pm    Post subject:
Reply with quote

Hello,

I probably made a bad assumption that both files were already in key sequence.

If the files are in sequence, would this not be a candidate for JOINing. . .?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Mar 30, 2010 11:55 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hello,

I probably made a bad assumption that both files were already in key sequence.

If the files are in sequence, would this not be a candidate for JOINing. . .?



Dick scherrer,

Sorted or unsorted it is an ideal candidate for joinkeys function. However I wasn't sure if OP had the latest PTF. If has the Latest PTF then he can use this job


Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTJNF1 DD DSN=your input FB 80 byte file,DISP=SHR
//SORTJNF2 DD DSN=your input FB 8 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  JOINKEYS FILES=F1,FIELDS=(1,8,A),SORTED,NOSEQCK
  JOINKEYS FILES=F2,FIELDS=(1,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,80)                       
  SORT FIELDS=COPY                               
//*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Wed Mar 31, 2010 12:04 am    Post subject:
Reply with quote

Note: Make sure you only use NOSEQCK if you KNOW that your records are already in sorted order. With SORTED and without NOSEQCK, DFSORT will check for out of order records and issue a message if it finds one. With SORTED and NOSEQCK, DFSORT does NOT check for out of order records (which can improve performance), so you must be sure that the records are already in order.
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Wed Mar 31, 2010 1:26 pm    Post subject:
Reply with quote

Thanks all you guys for your help.

I was able to achieve the desired results using the JOINKEYS. Yes, the files will be in sorted order.

I was a bit uncomfortable to understand the IFTHEN solution mentioned above. Skolusu, If you dont mind, please elaborate that solution.

-Thanks again,
Rakesh.
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 FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts Allocate dataset withour BLKSIZE Susanta CLIST & REXX 2 Thu Sep 22, 2016 11:51 am
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm


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