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

Extract group Data with condition


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

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Fri Dec 06, 2013 5:55 pm
Reply with quote

Hi,

I have the following requirement, Please let me know whether this can be achieved by SORT?

File Length - 19 both input and output
TYPE - PS

Field desc.

EMPNO - X(5).
EMPNAME - X(5).
ACTIVE - S9(9) comp.
DEPARTMENTNO - 9(5).


For same EMPNO there could be multiple rows with same data but possibility of having different active status.
For ACTIVE value could be 1 or 0.

Example:
Code:

11111ABCDE   100002
11111ABCDE   000003
11111ABCDE   000004
11111ABCDE   000002
11111ABCDE   000002
21111BBCDE   000002
21111BBCDE   000003
21111BBCDE   100004
21111BBCDE   000002
71111CBCDE   000002
71111CBCDE   000003
71111CBCDE   000004
41111DBCDE   000002
41111DBCDE   100003
41111DBCDE   000004


Output file:
In output file I need all records for the same empno only if at least one record for that employee is having active state as 1 (at position 14).
From file above emp no - 11111,21111,41111 should get written to the output file. For easy understanding I have grouped this file by EMP NO.
But in reality it might not be.

Code:

11111ABCDE   100002
11111ABCDE   000003
11111ABCDE   000004
11111ABCDE   000002
11111ABCDE   000002
21111BBCDE   000002
21111BBCDE   000003
21111BBCDE   100004
21111BBCDE   000002
41111DBCDE   000002
41111DBCDE   100003
41111DBCDE   000004


Will this be achievable by single sort step? icon_exclaim.gif
I search the forum not able to get any relevant discussion.
If anything is there already which I missed to spot, please let me know I will check that link.

Thanks in advance.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Dec 06, 2013 7:39 pm
Reply with quote

Hi thunderstorm,
do you want sequence of records withing key fields to be mentained in output also?
i see you are in output you shown but just want to confirm as solution would differ a bit.
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Fri Dec 06, 2013 10:45 pm
Reply with quote

Hi Escapa,

I need the output sorted by first 5 bytes (Empno).

Please let me know incase you need any other information.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Dec 06, 2013 11:08 pm
Reply with quote

It is a simple job.

1. Use the same file as input for both JNF1 and JNF2
2. Code the join key fields as 1,5,A for both files and code the REFORMAT as (F1:1,19)
3. Code a JNF2CNTL to include only (11,4,BI,EQ,1) and if you think you will have more than 1 record per key with an active status of 1 then code SUM FIELDS=NONE
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Sat Dec 07, 2013 8:10 am
Reply with quote

Hi Skolusu,

I am not in front of the system to test your JCL. But from seeing it, I guess it will extract only the records with with Binary 1 @ position 11-14.

But my requirement is to get all the records for the same empno, if at least one record has 1 @ position 11-14.

And this involves only one file.

Please pardon me if my understanding is wrong.
Anyways I will test this solution once I back @ my desk (Monday).
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: Sun Dec 08, 2013 10:34 am
Reply with quote

Hello,

Quote:
And this involves only one file.
Suggest you completely read (and re-read) suggestions that come from DFSORT development . . .
Quote:
1. Use the same file as input for both JNF1 and JNF2


Wait until you are back on the system, run a test, and then post your challenge if the given code does not do what you want (rather than what you requested).

A big part of your understanding this suggestion is understanding that a file may be JOINed to itself. . .
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Mon Dec 09, 2013 7:04 pm
Reply with quote

Dick - icon_redface.gif You are right, I should have waited till I got back to my system icon_sad.gif

Skolusu - You solution works absolutely fine... Thanks a lot for your valuable time.
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: Mon Dec 09, 2013 7:39 pm
Reply with quote

Quote:
I should have waited till I got back to my system
Not to worry - i suspect it will be remembered in the future icon_wink.gif

Good to hear it is working - thank you for the followup icon_smile.gif

d
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Dec 10, 2013 11:22 am
Reply with quote

thunderstorm,
if possible post the solution you used. It would help many others who hit this page,,
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 Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top