MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Data issues - remove records based on condition

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Fri Aug 08, 2008 5:55 am    Post subject: Data issues - remove records based on condition Reply with quote

I tried searching the postings but did not get what I am looking for:

My senario: There are 2 files DefaultersFile and MasterFile

DefaultersFile
2
4
5
6

MasterFile
Header
1
2
3
4
7
Trailer

NondefaultersFile
Header
1
3
7
Trailer

I have a master File with accounts and I need to exclude all the accounts who are defaulters which I get from the DefaultersFile. I need to exclude such accounts from the MasterFile and create a NondefaultersFile.

I know how to exclude the defaulted accounts from the Masterfile using DefaultersFile as a Lookup.

However, due to some OLD data issues, The DefaultersFile does contain some accounts which are not present in the MasterFile (Ex:5,6) which is coming over to the NondefaultersFile. I do NOT want to bring it to the NondefaultersFile. How can this be done?

Also, by default, the ICETOOL is sorting the Header and Trailer records of the MasterFile and putting it over to the NondefaultersFile as if it is some record. I want to avoid this as well. How can this be done?

Assume all the files are FB and has LRECL as 80

Please Help.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Aug 08, 2008 1:00 pm    Post subject: Reply with quote

Can the Header record be identified by something in the record (e.g. 'HDR' in positions 1-3). If so, how can it be identified?

Can the Trailer record be identified by something in the record (e.g. 'TRL' in positions 1-3). If so, how can it be identified?

Is the account number really a 1-character field in position 1? If not, what is the starting position, length and format of the account number field in each input file?

You do not show any duplicate account numbers in DefaultersFile - can it actually have duplicate account numbers (e.g. two 4 accounts)?

You do not show any duplicate account numbers in Master File - can it actually have duplicate account numbers (e.g. two 4 accounts)?

If either input file can have duplicate account numbers within it, please show this in a better example of your input records and expected output records.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Mon Aug 11, 2008 12:40 am    Post subject: Reply with quote

For Simplicity, assume the Header record can be identified by first 3 characters i.e. 'HDR' and similarly the Trailer record can be identified by first 3 characters i.e. 'TRL' .

The Account number is 15 Bytes Text field. In the MasterFile it starts from 20th position whereas in the DefaultersFile it starts from the first position.

Both the MasterFile and DefaultersFile does NOT contain any duplicates.

To confirm again: The NonDefaultersFile should contain all the account numbers that are present in the MasterFile but NOT in the DefaultersFile. Also, due to some data issues in the DefaultersFile, it contains some account numbers which are not present in the MasterFile. (Ideally this should never happen!) So I do not want such records to come over to the NonDefaultersFile.

Kindly let me know if you require any more details.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Aug 11, 2008 12:44 pm    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/510) - master file
//IN2 DD DSN=...  input file2 (FB/15) - defaults file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/510)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(511,15,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(511:20,15,526:C'1')),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'HDR'),OVERLAY=(511:15X'00')),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'TRL'),OVERLAY=(511:15X'FF'))
/*
//CTL2CNTL DD *
  INREC OVERLAY=(511:1,15,526:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(526,1,CH,EQ,C'1'),
    BUILD=(1,510)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Thu Aug 21, 2008 11:14 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Wed Aug 13, 2008 6:31 am    Post subject: Reply with quote

Thanks a Lot Frank!
Back to top
View user's profile Send private message
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Wed Aug 20, 2008 2:33 am    Post subject: Reply with quote

How can change the above if the account numbers in MasterFile contains duplicates?

The Account number is 15 Bytes Text field. In the MasterFile it starts from 20th position

Please advice.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Aug 20, 2008 11:15 am    Post subject: Reply with quote

Please show a new example of your input records and expected output records with duplicates so I can see what you want to do.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pai_sunil_bs
Beginner


Joined: 19 Sep 2005
Posts: 21
Topics: 11

PostPosted: Thu Aug 21, 2008 4:51 am    Post subject: Reply with quote

The Account number is 15 Bytes Text field. In the MasterFile it starts from 20th position whereas in the DefaultersFile it starts from the first position.

Please find the sample:

DefaultersFile
2
4
5
6

MasterFile
Header
1
1
2
3
3
4
7
Trailer

NondefaultersFile
Header
1
1
3
3
7
Trailer
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Aug 21, 2008 11:28 am    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job for your new requirement:

Code:

//S2   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/510) - master file
//IN2 DD DSN=...  input file2 (FB/15) - defaults file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/510)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(511,15,CH) KEEPBASE KEEPNODUPS -
  WITHALL WITH(1,526) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(511:1,15,526:C'BB')
/*
//CTL2CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(511:20,15,526:C'VV')),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'HDR'),OVERLAY=(511:15X'00')),
        IFTHEN=(WHEN=(1,3,CH,EQ,C'TRL'),OVERLAY=(511:15X'FF'))
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(526,2,CH,EQ,C'VV'),
    BUILD=(1,510)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group