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

Extract from a block of records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maradha

New User


Joined: 22 Aug 2008
Posts: 6
Location: bangalore

PostPosted: Wed Feb 23, 2011 6:01 pm
Reply with quote

I have a input file with 4 record layouts (same length and FB file)

Input file
-----------
10 xxxxxxx
20 yyyOK
30 zzzzzzzz
40 aaaaaaa
10 xxxxxxx
20 yyyMO
30 zzzzzzzz
40 aaaaaaa

As 1 block contains 4 records (10,20,30 & 40) and the requirement is to look for the string 'OK' in record 20 and if it is satisfied and get the corresponding 10,20,30 & 40 records
For the above example, output file will be -

10 xxxxxxx
20 yyyOK
30 zzzzzzzz
40 aaaaaaa

Is it possible to do this thru DFSORT/ICETOOL?

Record length of the file - 80, position of the string - 4.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 23, 2011 8:31 pm
Reply with quote

Hello,

Is the "record-type" the first positions in the record? If not where is it?

If it is in the first 2 bytes, the position to look for 'OK' would not be 4. . . icon_confused.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Feb 24, 2011 12:13 am
Reply with quote

maradha,

To clarify further, do you want to look for 'OK' anywhere in the 20 record, or in specific positions in the 20 record. If in specific positions, what positions are they?

Also, you only show one block of records with OK - can there be more than one block with OK and if so, do you want all of them in the output?
Back to top
View user's profile Send private message
maradha

New User


Joined: 22 Aug 2008
Posts: 6
Location: bangalore

PostPosted: Thu Feb 24, 2011 11:34 am
Reply with quote

Record type (like 10,20,30,40) is in the first 2 bytes always. String 'OK' is present in the position 6 in record type 20 and it is fixed.

I have just provided the example and there can be many occurences of 'OK' in the record type 20 and whenever it satisfies the condition, we need to extract the complete block (10, 20,30,40) and input file will always have the records in the sequence 10 - 20-30-40 - 10-20-30-40.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Feb 24, 2011 11:45 pm
Reply with quote

maradha,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
10XXXXXXX                                                   
----+----1----+----2----+----3----+----4----+----5----+----6-
20YYYOK                                                     
30ZZZZZZZZ                                                   
40AAAAAAA                                                   
10XXXXXXX                                                   
20YYYMO                                                     
30ZZZZZZZZ                                                   
40AAAAAAA                                                   
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,ZD,EQ,10),             
  PUSH=(83:1,80),RECORDS=2),                                 
  IFTHEN=(WHEN=GROUP,BEGIN=(1,2,ZD,EQ,20),PUSH=(81:6,2))     
                                                             
  OUTFIL REMOVECC,BUILD=(1,80),                             
  INCLUDE=(81,2,CH,EQ,C'OK',AND,1,2,ZD,NE,10),HEADER1=(83,80)
//*
Back to top
View user's profile Send private message
maradha

New User


Joined: 22 Aug 2008
Posts: 6
Location: bangalore

PostPosted: Tue Mar 01, 2011 4:34 pm
Reply with quote

Thanks a lot for providing the solution
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
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
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top