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 

Extract Records based on the Count

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
yrcreddy
Beginner


Joined: 28 Dec 2005
Posts: 27
Topics: 12

PostPosted: Sat Jan 20, 2007 9:49 am    Post subject: Extract Records based on the Count Reply with quote

Hi,

I have an input file which is in FB formate.The I/P is:
Code:

AAAAAAAAXU11060689
AAAAAAAAYU11060689
AAAAAAAAXU19959793
AAAAAAAAYU19959793
AAAAAAAAZU19959793
AAAAAAAAXU03594349
AAAAAAAAYU03594349
AAAAAAAAXU03594374
AAAAAAAAYU03594374
AAAAAAAAZU03594374

The layout of the input file is:
Code:

Fields             Length
--------           --------
SYSNAME            Char 8   
STATUS             Char 1   
REL_STAT           Char 1 
CONTRACT_NO        Char 8

The Status field contains the value X/Y/Z.
I want to extract contract no's which are matching for all status values.

Expected O/P is:
Code:

X19959793
Y19959793
Z19959793
X03594374
Y03594374
Z03594374

Please help me is there any way to achieve above result.
_________________
Thanks,
Ramachandra Reddy
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Sat Jan 20, 2007 11:21 am    Post subject: Reply with quote

yrcreddy,


Assuming that you don't dups on status & contract_no combo, the following jcl will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD *         
AAAAAAAAXU11060689       
AAAAAAAAYU11060689       
AAAAAAAAXU19959793       
AAAAAAAAYU19959793       
AAAAAAAAZU19959793       
AAAAAAAAXU03594349       
AAAAAAAAYU03594349       
AAAAAAAAXU03594374       
AAAAAAAAYU03594374       
AAAAAAAAZU03594374       
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                 
  SORT FIELDS=(02,08,CH,A)       
  INCLUDE COND=(9,1,SS,EQ,C'XYZ')
  INREC FIELDS=(09,01,           
                11,08,           
                C'001')         
  SUM FIELDS=(10,03,ZD)         
  OUTFIL INCLUDE=(10,3,ZD,EQ,3),
  OUTREC=(C'X',02,08,/,         
          C'Y',02,08,/,         
          C'Z',02,08)           
/*                             


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Sat Jan 20, 2007 12:00 pm    Post subject: Reply with quote

yrcreddy,

Assuming that you don't have dups on status & contract_no combo, you can also use this DFSORT/ICETOOL job to do what you asked for.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAAAAAAAXU11060689
AAAAAAAAYU11060689
AAAAAAAAXU19959793
AAAAAAAAYU19959793
AAAAAAAAZU19959793
AAAAAAAAXU03594349
AAAAAAAAYU03594349
AAAAAAAAXU03594374
AAAAAAAAYU03594374
AAAAAAAAZU03594374
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
  SELECT FROM(IN) TO(OUT) ON(11,8,CH) EQUAL(3) USING(CTL1)
/*
//CTL1CNTL DD *
  INCLUDE COND=(9,1,SS,EQ,C'XYZ')
  OUTFIL FNAMES=OUT,OUTREC=(9,1,11,8)
/*

_________________
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
yrcreddy
Beginner


Joined: 28 Dec 2005
Posts: 27
Topics: 12

PostPosted: Sun Jan 21, 2007 10:44 pm    Post subject: Reply with quote

Thank you very much kolusu and Frank.

Both JCL's are working for me.
_________________
Thanks,
Ramachandra Reddy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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