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 

Extraction of records with variable data

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


Joined: 24 Mar 2006
Posts: 32
Topics: 16

PostPosted: Tue Oct 12, 2010 1:26 pm    Post subject: Extraction of records with variable data Reply with quote

Have a FB file which contains differnet record types length 80.The struture of the file is Header record which indetifies the begining of group and then follwoed the detial record.
Code:

BEGIN     222222222
80101 ADD
80102     XXXXXXXXXXXXXXXXXXXXXXXXXX
80103     XXXXXXXXXXXXXXXXXXXXXXXXXX
80104     XXXXXXXXXXXXXRSXXXXXXXXXXXXX
BEGIN     333333333
80101 CHG
80102     XXXXXXXXXXXXXXXXXXXXXXXXXX
80103     XXXXXXXXXXXXXXXXXXXXXXXXXX
80104     XXXXXXXXXXXXXRSXXXXXXXXXXXXX
BEGIN     444444444
80101 ADD
80102     XXXXXXXXXXXXXXXXXXXXXXXXXX
80103     XXXXXXXXXXXXXXXXXXXXXXXXXX
BEGIN     555555555
80101 ADD
80102     XXXXXXXXXXXXXRSXXXXXXXXXXXXX

The output would be of same as input FB 80
BEGIN 222222222
BEGIN 555555555

So the basic requirement is to get only those header "BEGIN" records,if the record following it have "80101 ADD' in pos 1 and any of the record following that till we hit the next BEGIN group has "RS" at pos 45 .

Just curious to know if we could achive this type of processing just by writing sort cards? Can you please add the details also how you were able to reach to a solution in your replies.

Thanks in advance
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Oct 12, 2010 2:57 pm    Post subject: Reply with quote

nishantrk,

The following DFSORT JCL will give you the desired results. I assumed that your account number starts at position 11 for a length of 9 bytes.

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
BEGIN     222222222                                                     
80101 ADD                                                               
80102                          XXXXXXXXXXXXXXXXXXXXXXXXXX               
80103                          XXXXXXXXXXXXXXXXXXXXXXXXXX               
80104                          XXXXXXXXXXXXXRSXXXXXXXXXXXXX             
BEGIN     333333333                                                     
80101 CHG                                                               
80102                          XXXXXXXXXXXXXXXXXXXXXXXXXX               
80103                          XXXXXXXXXXXXXXXXXXXXXXXXXX               
80104                          XXXXXXXXXXXXXRSXXXXXXXXXXXXX             
BEGIN     444444444                                                     
80101 ADD                                                               
80102                          XXXXXXXXXXXXXXXXXXXXXXXXXX               
80103                          XXXXXXXXXXXXXXXXXXXXXXXXXX               
BEGIN     555555555                                                     
80101 ADD                                                               
80102                          XXXXXXXXXXXXXRSXXXXXXXXXXXXX             
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'BEGIN'),PUSH=(81:11,9)), 
        IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'80101'),PUSH=(90:7,3),   
                             END=(1,5,CH,EQ,C'BEGIN'))                 
                                                                       
  OUTFIL BUILD=(C'BEGIN',11:81,9,80:X),                                 
  INCLUDE=(45,2,CH,EQ,C'RS',AND,90,3,CH,EQ,C'ADD')                     
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nishantrk
Beginner


Joined: 24 Mar 2006
Posts: 32
Topics: 16

PostPosted: Tue Oct 12, 2010 8:47 pm    Post subject: Reply with quote

Thakn you sir!!!!!!!!!!!
Back to top
View user's profile Send private message Send e-mail
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