Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract from a block of records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Extract from a block of records
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

Site Director


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

PostPosted: Wed Feb 23, 2011 8:31 pm    Post subject:
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 Moderator


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

PostPosted: Thu Feb 24, 2011 12:13 am    Post subject:
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    Post subject: Reply to: Extract from a block of records
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    Post subject:
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    Post subject: Reply to: Extract from a block of records
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us