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

Extract Records From Dataset


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Tue Mar 30, 2010 10:53 am
Reply with quote

Hi,

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 -

0000000000001.....SBENJAMIN MUNIZ ROLDOS 1795 CALLE ALCALA SAN JUAN, PR
0000001002358.....EJIM GULALO 41 HATTERTOWN RD Newtown, CT

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
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Mar 30, 2010 12:06 pm
Reply with quote

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.
Back to top
View user's profile Send private message
km_abdullah

New User


Joined: 03 Nov 2008
Posts: 60

PostPosted: Tue Mar 30, 2010 12:14 pm
Reply with quote

Hi,

SYNCSORT also supports 'SS' parameter atleast for release
SYNCSORT FOR Z/OS 1.3.2.1R
Back to top
View user's profile Send private message
SCARCEBOYZ

New User


Joined: 16 May 2005
Posts: 32
Location: Millenium Business Park, Mumbai

PostPosted: Tue Mar 30, 2010 4:24 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Wed Mar 31, 2010 10:13 am
Reply with quote

Thanks, Vivek. I'll try this.
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Wed Mar 31, 2010 10:19 am
Reply with quote

Hey Vivek,

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 ?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Mar 31, 2010 10:30 am
Reply with quote

Hi,

your example shows a comma followed by a space followed by the state name, are you saying this is not always the case ?

If this is the case, then just change the 80 to 650.


Gerry
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Wed Mar 31, 2010 10:44 am
Reply with quote

Hi,

You are right. The state name occurs after a comma and a space. What i meant was that the comma doesn't always occut at a fixed column.
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Wed Mar 31, 2010 12:56 pm
Reply with quote

Hey Vivek / Gerry,

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.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Mar 31, 2010 1:01 pm
Reply with quote

Hi,

not sure why you have not coded it as mentioned by Vivek.

The output is correct based on your code, all records have the value MA

it should be
Code:
1,650,SS,EQ,C', MA')


Gerry
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Wed Mar 31, 2010 3:35 pm
Reply with quote

Hey Gerry,

Thanks for pointing it out. It works fine now. Thanks a lot, guys.
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Mon Apr 05, 2010 3:06 pm
Reply with quote

Hey Vivek / Gerry,

I'm again facing pblm with this SORT Card yaar. I gave the below sort card -

SORT FIELDS=COPY
INCLUDE COND=(1,650,SS,EQ,C', MA')
END.

But instead of fetching only MA records, the output file has CA records too !
Can you please help me, guys.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Apr 05, 2010 6:18 pm
Reply with quote

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...icon_smile.gif
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Tue Apr 06, 2010 9:41 am
Reply with quote

Hey Anuj,

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.

Thanks for checking up, Anuj :-)
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Apr 06, 2010 3:13 pm
Reply with quote

Nice to hear that you got it working icon_smile.gif

Quote:
Hey Anuj,
shhhh...I hope Enrico is not around... icon_wink.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Apr 06, 2010 3:19 pm
Reply with quote

Quote:
shhhh...I hope Enrico is not around...


around an watching icon_biggrin.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Apr 06, 2010 3:22 pm
Reply with quote

he heh - I wish good luck to Kumaresan.nk... icon_lol.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Apr 07, 2010 2:28 am
Reply with quote

Quote:
Quote:
Quote:
Hey Anuj,
shhhh...I hope Enrico is not around...
around an watching icon_biggrin.gif

We're all watching (and quoting) icon_wink.gif

Hi, Anuj, how are you?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Wed Apr 07, 2010 4:03 am
Reply with quote

Marso wrote:
Quote:
Quote:
Quote:
Hey Anuj,
shhhh...I hope Enrico is not around...
around an watching icon_biggrin.gif

We're all watching (and quoting) icon_wink.gif

Hi, Anuj, how are you?
Speak for yourself, marso.....
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 07, 2010 4:05 am
Reply with quote

William Thompson wrote:
Marso wrote:
Quote:
Quote:
Quote:
Hey Anuj,
shhhh...I hope Enrico is not around...
around an watching icon_biggrin.gif

We're all watching (and quoting) icon_wink.gif

Hi, Anuj, how are you?
Speak for yourself, marso.....
Yea, what he said.....
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Apr 07, 2010 8:47 pm
Reply with quote

Marso wrote:
Quote:
Quote:
Quote:
Hey Anuj,
shhhh...I hope Enrico is not around...
around an watching icon_biggrin.gif

We're all watching (and quoting) icon_wink.gif

Hi, Anuj, how are you?
Having you guys around, makes me feel safe ... icon_smile.gif

'am doing good - how about you? icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top