|
View previous topic :: View next topic
|
| Author |
Message |
maradha
New User
Joined: 22 Aug 2008 Posts: 6 Location: bangalore
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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. . .  |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
maradha
New User
Joined: 22 Aug 2008 Posts: 6 Location: bangalore
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
maradha
New User
Joined: 22 Aug 2008 Posts: 6 Location: bangalore
|
|
|
|
| Thanks a lot for providing the solution |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|