View previous topic :: View next topic
|
Author |
Message |
adarsh.bhalke
New User
Joined: 06 May 2007 Posts: 16 Location: pune
|
|
|
|
Hi all,
I have one file which contains lets say 100 records. the structure of the record is
F1E1asfhsdh123456789012dkkddkkdkdksskddks
F1E1dhsdkds456789012322dssdhksdskdsdsdskd
F1E1jsllsdldll123456789012skjkdkdhsdkkhskhdk
F2E2uhgjgjgj123456789012ssashkjsasaskskjasa
Here 123456789012 is one fileld lets say CBAID now i want to select all the records having this Key as a part and the Record type as F1E1.
After selecting these records i want to delete these records.
in above records i want to delete the records which are in bold because theay are of same type and having same CBAID
Can anyone send me the solution for this as soon as possible. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
If your "key" is in the same location in all the records that you want to select, that is simple.
Omitting records might be a little more work, I don't understand how the selected records from your sample differ form the deleted records, do they?
Would more records in the example show that some selected records do not get deleted?
Would more records in the example show that some un-selected records do also get deleted? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
adarsh,
Based on your example, it appears that you want to delete records which have 'F1E1' in positions 1-4 and '123456789012' anywhere from position 5 to the end of the record. Here's a DFSORT job that will do that. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
F1E1asfhsdh123456789012dkkddkkdkdksskddks
F1E1dhsdkds456789012322dssdhksdskdsdsdskd
F1E1jsllsdldll123456789012skjkdkdhsdkkhskhdk
F2E2uhgjgjgj123456789012ssashkjsasaskskjasa
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OMIT COND=(1,4,CH,EQ,C'F1E1',AND,
5,76,SS,EQ,C'123456789012')
/*
|
If that's not what you want to do, then please explain in more detail what you want to do with a better example. |
|
Back to top |
|
|
adarsh.bhalke
New User
Joined: 06 May 2007 Posts: 16 Location: pune
|
|
|
|
Hello,
As my file is consist of thousands of records,in this case i want to search all F1E1 type of record which has duplicate CBA id (which is mentioned above)
which is a key to search. But here i cant Hard code CBA Id value as i may have thousands of duplicate records in a file.
That means first I have to search the entire file based on CBA id. If this CBA id found in 2 F1E1 type of records then delete those records or move them to different file.
I am waiting for your reply. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If the duplicates might appear anywhere in the file and there multiple, unpredictable CBA Ids, you need to get the records into sequence for processing.
After you sort the file by CBA Id, you can remove the duplicates. |
|
Back to top |
|
|
|