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 

Including Records Based on first,second and third records.

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


Joined: 28 Sep 2005
Posts: 98
Topics: 33

PostPosted: Sat Feb 10, 2007 11:12 pm    Post subject: Including Records Based on first,second and third records. Reply with quote

1)I want to include the records in output file based on the contents of first record ,contents of second and third record.The same applies for the next three consecutive records.

Sort usually process record by record.Is there is any way that the sort treates the consecutive three records as a single file?There is no common key for these records in order to make any relationship.I want to make some relationship with the 3 consecutive records.

for the below condition
1)if record 1 matches the condition
2)if record 2 matches the condition
3)if record 3 matches the condition

I want to write all the three records in an ouput file.

For the below condition
1)if record 1 does not matches the condition
2)if record 2 matches the condition
3)if record 3 matches the condition

I don't want to write all the three records to an output file

For the below condition

1)if record 1 matches the condition
2)if record 2 matches the condition
3)if record 3 does not match the condition

I want to write only record 1 and record 2

For the below condition

1)if record 1 matches the condition
2)if record 2 Does not matches the condition
3)if record 3 matches the condition

I want to write only record 1 and record 3.






input file:

LT100A123D287
LT101A204D100
LT101A202D101

LT100A124D287
LT101A125D101
LT101A126D100

Cheers,
VJ
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Feb 11, 2007 12:06 am    Post subject: Reply with quote

vjkumk,

1. What are the conditions to be matched ?
2. Do you always have 3 records? i.e the total no: of records in the input are always a multiple of 3?
3. what is the recfm and lrecl of the file
4. post sample input and desired output

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


Joined: 28 Sep 2005
Posts: 98
Topics: 33

PostPosted: Sun Feb 11, 2007 8:05 am    Post subject: Reply with quote

Kolusu,

I am in a process of preparing test data for the test cases and i have to extract test data according to the test case.

The input file is an unload file of an IMS database and the RECFM is VB.

2)There will be more records,Yes, the input will be multiple of 3.

3)the RECFM =VB(I am using OPTION VLSHRT NOVLSCMP since it is VB file)



4)Sample input file:

sample Input:(I have inserted the blank lines for clarity,there is no blank line in real).


LT100P100050D287
LT101Z100021DD1
LT101Z100031GG1

LT100P1000670D285
LT101Z100081DD1
LT101Z100021GG1


LT100P100060D287
LT101Z100013GG1
LT101Z100011DD1

LT100P100058D287
LT101Z100021DD1
LT101Z100012DD1



Output:
LT100P100050D287
LT101Z100021DD1

LT100P100060D287
LT101Z100011DD1

LT100P100058D287
LT101Z100021DD1
LT101Z100012DD1

I have mentioned the include conditions below.

1)My input file contains records which starts with LT100 and followed by two LT101 records,the same frequency is repeated.


2)First i have to check the record which starts with LT100 for value 'D287'.

3)If 'D287' matches then i have to check the Next two consecutive records which starts with LT101 for value "DD1".If both the LT101 record matches then i have to write the LT100 and both the LT101 records to the output file.


4)If the VALUE "D287" is not in LT100 record,then I have to skip the LT100 record and next two consecutive records which starts with LT101 and proceed to the 4TH record which is LT100 and check for the same logic mentioned in step 2 and 3.

5)If the value "D287" is in LT100 record and either of the two LT101 record matches the value "DD1",then the LT100 record and the LT101 which is matched has to be written to the output file.


Cheers,
VJ
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Feb 11, 2007 10:05 am    Post subject: Reply with quote

Try this DFSORT/ICETOOL JCL. Since you did not mention the LRECL of the input file I assumed it to be 84 byes(vb file extra 4 bytes). Brief explanation of the job is that we treat LT100 record as a header record and tag it to all the detail(LT101) records. Once we tag that then it is just an include statement to pick the desired records.


Code:

//STEP0100 EXEC PGM=ICETOOL                     
//DFSMSG   DD SYSOUT=*                           
//TOOLMSG  DD SYSOUT=*                           
//IN       DD DSN=your vb input file,                   
//            DISP=SHR                           
//OUT      DD SYSOUT=*                           
//TOOLIN   DD *                                 
  SPLICE FROM(IN) TO(OUT) ON(85,8,CH) KEEPBASE -
         WITH(01,80) WITHALL USING(CTL1)         
//CTL1CNTL DD *                                               
  INREC IFTHEN=(WHEN=INIT,                                     
       OVERLAY=(85:SEQNUM,8,ZD)),                             
        IFTHEN=(WHEN=(05,5,CH,NE,C'LT100'),                   
                OVERLAY=(93:SEQNUM,8,ZD,                       
                         85:85,8,ZD,SUB,93,8,ZD,M11,LENGTH=8)),
        IFTHEN=(WHEN=NONE,                                     
                OVERLAY=(85:SEQNUM,8,ZD,                       
                         93:05,5,17,4))                       
                                                               
  OUTFIL INCLUDE=((93,9,CH,EQ,C'LT100D287',AND,               
                   05,5,CH,EQ,C'LT100'),OR,                   
                  (93,9,CH,EQ,C'LT100D287',AND,               
                   05,5,CH,EQ,C'LT101',AND,                   
                   17,3,CH,EQ,C'DD1')),                       
  OUTREC=(01,4,                                               
          5,80)                                               
/*


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
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