|
View previous topic :: View next topic
|
| Author |
Message |
suzeet
New User

Joined: 16 May 2005 Posts: 54
|
|
|
|
I have a fixed block dataset whose LRECL is 8.
I want to extract the record, and its subsequent records, if the record start with 'D' and a 'A' is present in the fifth column till another 'D' is found in the first position. For an example, if the data is present as below
the output would contain all the records with fonts RED
Input
D2222222
11111111
55555555
77777777
D111A000
00000000
AAAAAAAA
AAA BBBB
D222A000
AA177676
KKKKKKKK
012LLLLL
D2622222
11111111
55555555
77777777
D111A000
KKKKKK00
AAAAAAAA
AAA BBBB
Output
D111A000
00000000
AAAAAAAA
AAA BBBB
D222A000
AA177676
KKKKKKKK
012LLLLL
D111A000
KKKKKK00
AAAAAAAA
AAA BBBB |
|
| Back to top |
|
 |
Guest
|
|
|
|
Hi Suzeet,
You can use the following JCL for your requirement:
| Code: |
//STEP010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
D2222222
11111111
55555555
77777777
D111A000
00000000
AAAAAAAA
AAA BBBB
D222A000
AA177676
KKKKKKKK
012LLLLL
D2622222
11111111
55555555
77777777
D111A000
KKKKKK00
AAAAAAAA
AAA BBBB
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'D'),PUSH=(10:1,8))
OUTFIL FNAMES=OUT,INCLUDE(10,1,CH,EQ,C'D',AND,14,1,CH,EQ,C'A')
/*
|
Kindly get back to me in case of any concern.
devil13
There is always a better solution. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| devil13 wrote: |
| Kindly get back to me in case of any concern |
Devil13,
You just forgot to trim the pushed value from output. Assuming OP needs only the first 9 bytes. He needs to use the BUILD statement on the outfil as follows.
| Code: |
OUTFIL FNAMES=OUT,BUILD=(1,9),
INCLUDE(10,1,CH,EQ,C'D',AND,14,1,CH,EQ,C'A')
|
|
|
| Back to top |
|
 |
Guest
|
|
|
|
Hi,
Thanks Skolusu.
Actualy I thought it would show him the procedure and that would be helpful
But definitely I missed to mention the build=(1,9)
devil13
I am learning cos you guys are helping a lot. |
|
| Back to top |
|
 |
suzeet
New User

Joined: 16 May 2005 Posts: 54
|
|
|
|
| Thanks. It works like a charm |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|