Help regarding the Sort card



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Help regarding the Sort card

Postby rahuil » Mon Dec 19, 2011 6:00 pm

Hello,
I have a requirement as follows:

Input: File with three fields

Empid. Empname Mgrid.

Output:

Empid. Empname Mgrname

Explanation: Input file consists of three fileds, in which mgrid is the field which contains the Mgr info.
Same id is present in the empid too, so we have to retreive the name of that emp and have to be given as
Mgr name in the output field which has those particular values in the input.

Eg. I/p: 1 a 3 O/p: 1 a c
2 b 3 2 b c
3 c 3 3 c c
rahuil
 
Posts: 4
Joined: Tue Oct 25, 2011 8:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help regarding the Sort card

Postby BillyBoyo » Mon Dec 19, 2011 9:38 pm

Input

1 A 3
2 B 3
3 C 3


Output

1 A C
2 A C
3 A C


Can you have MGRIDs which are not EMPIDs, ie which are not on file? Do you have duplicate EMPIDs?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Help regarding the Sort card

Postby Frank Yaeger » Mon Dec 19, 2011 11:22 pm

rahuil,

You need to do a better job of explaining what you want to do. Please show an example of the records in your input file (relevant fields only) and what you expect for output. Use ubb code tags! Show the actual values. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file. If the file can have duplicates within it, show that in your example.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Help regarding the Sort card

Postby BillyBoyo » Tue Dec 20, 2011 4:27 am

Sorry, I made a total mess of your data. Is it like this:


empid  empname    mgrid
000010 JOHNSON   900003
000021 ROBERTS   900003
000038 SMITH     900018
000101 JONES     900003
900003 MR BOSS   900003
900018 MS CHIEF  900018


Managers being identified by empid = mgrid

And you want:
empid
000010 JOHNSON   MR BOSS
000021 ROBERTS   MR BOSS
000038 SMITH     MS CHIEF
000101 JONES     MR BOSS
900003 MR BOSS   MR BOSS
900018 MS CHIEF  MS CHIEF


Can there be duplicate records on the file (as far as a key value is concerned)?

Can there be references to MGRID which are not on the file?

Can there be Managers who do not have employees?

Do you want the managers on the output file?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Help regarding the Sort card

Postby rahuil » Tue Dec 20, 2011 1:21 pm

Hello billy,

Your second post matches with my requirement.

All ids shuld be in file, no duplicates for empid.

Can you post code for such requirement?
rahuil
 
Posts: 4
Joined: Tue Oct 25, 2011 8:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Help regarding the Sort card

Postby BillyBoyo » Tue Dec 20, 2011 2:07 pm

Get yourself familiar with the location of the DFSORT manuals, which are available on the web, and can be searched on the web or downloaded as PDFs.

It would be a JOINKEYS application that you need. This allows for the processing of file matching.

In your case, you want to match your input dataset "to itself". This at first seems odd, but hopefully you'll see what happens.

A very good source of sample code is the DFSORT forum here, there are also other such places on the web.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Help regarding the Sort card

Postby Frank Yaeger » Thu Dec 22, 2011 2:48 am

You can use a DFSORT job like the following to do what you asked for:

//S1  EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//INA      DD DSN=...  input file
//INB      DD DSN=...  input file
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  JOINKEYS F1=INA,FIELDS=(19,6,A)
  JOINKEYS F2=INB,FIELDS=(1,6,A)
  REFORMAT FIELDS=(F1:1,18,F2:8,10)
  SORT FIELDS=(1,6,ZD,A)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post