View previous topic :: View next topic
|
Author |
Message |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hello,
I have below input REPORT file[LRECL=40] -->
Code: |
----+----1----+----2----+----3----+----4
GROUP INFORMATION 1
JOHN
ID 123456
DEPT ENG
123456
GROUP INFORMATION 2
JAMES
ID 456789
DEPT ENG
456789
GROUP INFORMATION 3
DAVID
ID 987456
DEPT SCI
987456
GROUP INFORMATION 5
WILLIAMS
ID 963258
DEPT ENG
963258
GROUP INFORMATION 6
RICHARD
ID 745896
DEPT PHY
745896
GROUP INFORMATION 7
DONALD
ID 852456
DEPT PHY
852456
|
The requirement is to pull out those set of records which belongs to department = ENGLISH.
That is, the Group begins with (1,17,CH,EQ,'GROUP INFORMATION')
Third line of the Group has Department information. We need only those groups whose department information is (6,3,CH,EQ,'ENG')
So the expected output file[LRECL=40] will be as below -->
Code: |
----+----1----+----2----+----3----+----4
GROUP INFORMATION 1
JOHN
ID 123456
DEPT ENG
123456
GROUP INFORMATION 2
JAMES
ID 456789
DEPT ENG
456789
GROUP INFORMATION 5
WILLIAMS
ID 963258
DEPT ENG
963258
|
The actual problem lies in the fact that the DEPARTMENT is present in
the third line . Had it been in the first line of the group , the task would have been much simpler by coding (WHEN=GROUP, PUSH ) statement .
Help would be highly appreciated. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have a think about JOINKEYS with the same file for both inputs.
In one JNFnCNTL file, do a GROUP to push the ID=, and then only include the records which are your IDs.
On the other JNFnCNTL, do the same GROUP to push the ID=.
Use JOINKEYS on the ID=.
Bit of Deja Vu with another recent topic... |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Techslam,
Do your groups always start with GROUP? If not, remember that you can use RECORDS in the WHEN=GROUP.
Do all your departments records start DEPT? |
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
@Bill Woodger
Yes my groups always start with 'GROUP INFORMATION'
&
All department records start with 'DEPT' |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK, good. Let us know how it gets on with Kolusu's solution. |
|
Back to top |
|
|
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
@Skolusu
Thanks. I follwoed your link and it worked perfectly for me. Thanks a ton for this help. Appreciate it. |
|
Back to top |
|
|
|