I have a address dataset from which i have to extract records of one particular state. But the state name does not fall under a specific column. Following is the format of records -
In the above data - PR and CT are the state name. Please help me to get this done.
deleted the attachment and inlined the sample data
Code:
0000000000001.....SBENJAMIN MUNIZ ROLDOS 1795 CALLE ALCALA SAN JUAN, PR
0000001002358.....EJIM GULALO 41 HATTERTOWN RD Newtown, CT
0000001010001.....EPHYSICIANS REGIONAL MEDICAL 6101 PINE RIDGE ROAD NAPLES, FL
0000001011352.....EHELEN M KOCH LAS PALMAS UNIT 478 215 NORTH POWER RD. MESA, AZ
0000001033580.....EHEALTH INSURANCE ASSOC LLP 565 WASHINGTON AVE NORTH HAVEN, CT
do not post attachments, not everybody can see/download them
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
Please do not use attachments as not everybody can use them, thus reducing the number of people able to help you.
Search the forum, and if you use DFSORT, search for SS. Not sure if this is supported using SYNCSORT. There are examples on the forum to determine both the sort product and its release level. PLease check this out and post the results.
Joined: 16 May 2005 Posts: 32 Location: Millenium Business Park, Mumbai
Hi Kumaresan,
Welcome to the group.
Try this
Code:
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,80,SS,EQ,C', PR',OR,
1,80,SS,EQ,C', CT',OR,
1,80,SS,EQ,C', FL',OR,
1,80,SS,EQ,C', AZ')
END
//*
This will give you the list of recrods containing the specific state however if you do not want to have dupilcates, you can use OUTREC and remove the duplicate recrods.
I have a concern. My dataset in which this address data are present is of length 650. This state field might occur at ay point in the dataset. But it occurs only after a comma. My question is since the comma position is variable, will it be possible to extract records in the way that you've mentioned ? And the 80 you've given in the SORT CARD specifies the length, right ?
I tried the above code, but there seems to be some hiccup while arriving at the output. Below are my findings -
Output:
0000001002358.....EJIM GULALO 41 HATTERTOWN RD Newtown, MA
0000001011352.....EHELEN M KOCH LAS PALMAS UNIT 478 215 NORTH POWER RD. MESA, PR
0000001041404.....ETALLPINES REHAB & LIVING TALLPINES REHAB & LIVING 34 MARTIN LANE BELFAST, ME
0000001042974.....EAHERN DONALD PO BOX 838 11 MECHANIC ST BUCKSPORT, MA
Input:
000000000001.....SBENJAMIN MUNIZ ROLDOS 1795 CALLE ALCALA SAN JUAN, PR
000001002358.....EJIM GULALO 41 HATTERTOWN RD Newtown, MA
000001010001.....EPHYSICIANS REGIONAL MEDICAL 6101 PINE RIDGE ROAD NAPLES, FL
000001011352.....EHELEN M KOCH LAS PALMAS UNIT 478 215 NORTH POWER RD. MESA, PR
000001033580.....EHEALTH INSURANCE ASSOC LLP 565 WASHINGTON AVE NORTH HAVEN, CT
000001041404.....ETALLPINES REHAB & LIVING TALLPINES REHAB & LIVING 34 MARTIN LANE BELFAST, ME
000001042974.....EAHERN DONALD PO BOX 838 11 MECHANIC ST BUCKSPORT, MA
000001044352.....ELESLIE E HALL PO BOX 58 GRANTHAM, NH
000001044853.....ENARRAGUAGUS BAY HEALTH 179 LISBON ST 2 LEWISTON, ME
000001050541.....ENORTHEAST FINANCIAL GROUP LLC PO BOX 567 EAST LYME, CT
SORT CARD
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(1,650,SS,EQ,C'MA')
END
//*
Eventhough i just sepcified 'MA' in my filter criteria, it is pulling up other records too. Am not sure what's going wrong. Can you help me plz.
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
Kumaresan.nk wrote:
But instead of fetching only MA records, the output file has CA records too !
Do "CA-record"s also fall in this range INCLUDE COND=(1,650,SS,EQ,C', MA'), if yes, they might show up.
On the other hand, the input you show in one of your previous replies - they don't have any data in which "CA" is present the way you siad it.. Please show the data for which you say the sort-card is not working. And also show us the expected output.
PS. Keeping in mind that users from different part of the globe log-in to this forum, please avoid using local slang words...
I fixed it up. The reason why CA records were also showing up was because, the string (', MA') was present in one more field too. So, when i changed the SORT CARD to check for the string like INCLUDE COND=(50,600,SS,EQ,C', MA'), the output came good.