|
|
| Author |
Message |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi,
I need a SORT job for the below requirement.
I have two different types of records in a file.
formats of records as below.
record description of 1st type:
Object x(15) ex: "part "
ID x(6)
A 9(3)
B 9(3)
C 9(3)
Part-No 9(6)
FILLER x(20)
record description of 2nd type:
Object x(15) ex: "part name "
Part-No 9(6)
Part-Name x(20)
My required output should be as below:
Object x(15) ex: "part "
ID x(6)
A 9(3)
B 9(3)
C 9(3)
Part-No 9(6)
Part-Name x(20)
FILLER x(20)
The file can contain other types of record also..
Object field will decide the value in it. in my output the other types of records should be eliminated and only the "Part" objects must be present.
Thanks & Regards,
Hari |
|
| Back to top |
|
 |
References
|
Posted: Tue Mar 18, 2008 5:41 pm Post subject: Re: Need a SORT job |
 |
|
|
 |
Moved: Tue Mar 18, 2008 5:42 pm by superk From Other Mainframe Topics to DFSORT/ICETOOL |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4133 Location: San Jose, CA
|
|
|
|
It's not clear what you want to do. What field or fields are you matching on?
Please show an example of your input records with actual values and what you expect for the output records. Explain the "rules" for getting from input to output based on the example. Give the RECFM and LRECL of the input file. |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi Yeager,
There can be different types of records in a file.
ex:
Part type record:
Object A B C Part-No FILLER
--------------------------------------------------------------------
PART 100 022 012 123456
Part name type record:
Object Part-No Part-Name
-------------------------------------------------------
Part name 123456 SCREW
and my output should look like below
Object A B C Part-No Part-Name FILLER
--------------------------------------------------------------------
PART 100 022 012 123456 SCREW
so, the matching should be done on Part-no of "part" and "part-name" type records.
My output should only have the "Part" records and all other records(other records have some other value for the object field) must be eliminated.
Thanks,
Hari |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
I hope, this time it would be readable.
Object A B C Part-No FILLER
--------------------------------------------------------------------
PART 100 022 012 123456
Object Part-No Part-Name
-------------------------------------------------------
Part Name 123456 screw
Output is like this:
Object A B C Part-No PART-NAME FILLER
--------------------------------------------------------------------
PART 100 22 12 123456 screw |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4133 Location: San Jose, CA
|
|
|
|
Again, what is the RECFM and LRECL of the input file?
Can you have more than one record with the same part no in either or both types of records? If so, what would you want to do about that?
Please show a more extensive example of input records and expected output records with all variations (match, no match, dups if possible).
You can use code tags to make it readable. |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi,
Record format is fixed. and the LRECL is 800.
PART 100 012 011 123456
PART 100 230 410 111111
PART 099 210 102 222222
AAA 123 123 ABCDE
AAA 099 123 BDECF
BBB 029 AB DEF 123
Part Name 123456 Screw
Part Name 111111 Bolt
Part Name 222222 Mirror
PART 100 012 011 123456 screw
PART 100 230 410 111111 Bolt
PART 099 210 102 222222 Mirror
Part records can have duplicates, in that case part name will be the same for the duplicate part records.
Part name records will not have duplicates.
All the parts appearing in Part records will definitely have the Part name records.
Input file can also have AAA, BBB records. But they must not appear in the output file.
Thanks & Regards,
Hari. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4133 Location: San Jose, CA
|
|
|
|
| Quote: |
| Part records can have duplicates, in that case part name will be the same for the duplicate part records. |
Sigh. Does that mean you want only one record with the same Part-No for output or all of the records with the same Part-No? Was it too much trouble to include this case in your example as I requested?
For example, if your input file had:
| Code: |
PART 100 230 410 111111
PART 100 230 410 111111
Part Name 111111 Bolt
|
would you want one record or two records for output? |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
No.
Sorry for the confusion.
PART 100 114 011 123456
PART 001 002 005 123456
PART 999 888 777 123456
In the above case, the output should be like this..
PART 100 114 011 123456 Screw
PART 001 002 005 123456 Screw
PART 999 888 777 123456 Screw
And Part name record will not appear in the output and only the part name from that records is refered to write in to the ouput file. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4133 Location: San Jose, CA
|
|
|
|
Now I'm even more confused. You said you had two types of records in the input file, PART records and Part name records. I showed those two types in my input file example:
| Code: |
PART 100 230 410 111111
PART 100 230 410 111111
Part Name 111111 Bolt
|
and asked if the output would have one record (only one PART record) or two records (both PART records). Your answer was No (?). Then you showed an input file example with ONLY PART records with a different Part-no then I showed and kept all of the duplicate records for the output with the Part-Name from the input record you didn't show.
At this point, I can only guess at what you want. I'm guessing that you might have an input file like this:
| Code: |
PART 100 012 011 123456
PART 100 230 410 111111
PART 100 230 410 111111
PART 099 210 102 222222
AAA 123 123 ABCDE
AAA 099 123 BDECF
BBB 029 AB DEF 123
PART 100 114 011 123456
PART 001 002 005 123456
PART 999 888 777 123456
Part Name 123456 Screw
Part Name 111111 Bolt
Part Name 222222 Mirror
|
and you would want the output file to be this:
| Code: |
PART 100 230 410 111111 Bolt
PART 100 230 410 111111 Bolt
PART 100 012 011 123456 Screw
PART 100 114 011 123456 Screw
PART 001 002 005 123456 Screw
PART 999 888 777 123456 Screw
PART 099 210 102 222222 Mirror
|
If so, then you can use a DFSORT/ICETOOL job like the following:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/800)
//OUT DD DSN=... output file (FB/800)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(31,6,ZD) -
WITHALL WITH(1,30) USING(CTL1)
/*
//CTL1CNTL DD *
INCLUDE COND=(1,15,CH,EQ,C'PART',OR,1,15,CH,EQ,C'Part Name')
INREC IFTHEN=(WHEN=(1,15,CH,EQ,C'Part Name'),
BUILD=(31:16,6,37:22,20,801:C'0')),
IFTHEN=(WHEN=NONE,OVERLAY=(801:C'1'))
SORT FIELDS=(31,6,ZD,A,801,1,CH,A)
OUTFIL FNAMES=OUT,BUILD=(1,800)
/*
|
|
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Thanks yeager.
I wanted this exactly.
Thanks,
Hari |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4133 Location: San Jose, CA
|
|
|
|
Good.  |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi Yeager,
The requirement is changed now and the files are VB.
Please give the sort JCL for the same requirement.
And also please explain the below statements if possible as I did not understand.
ON(31,6,ZD)
WITH(1,30)
BUILD=(31:16,6,37:22,20,801:C'0') |
|
| Back to top |
|
 |
sclater
New User
Joined: 22 Jun 2007 Posts: 14 Location: South Africa
|
|
|
|
Hi hariibm,
To quote Frank
"All of the DFSORT/ICETOOL documentation is available online from:
www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. " |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4133 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job for VB files:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB)
//OUT DD DSN=... output file (VB)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(36,6,ZD) -
WITHALL WITH(6,30) USING(CTL1)
/*
//CTL1CNTL DD *
OPTION VLSCMP
INCLUDE COND=(5,15,CH,EQ,C'PART',OR,5,15,CH,EQ,C'Part Name')
INREC IFTHEN=(WHEN=(5,15,CH,EQ,C'Part Name'),
BUILD=(1,4,5:C'0',36:20,6,42:26,20)),
IFTHEN=(WHEN=NONE,BUILD=(1,4,5:C'1',6:5))
SORT FIELDS=(36,6,ZD,A,5,1,CH,A)
OUTFIL FNAMES=OUT,BUILD=(1,4,5:6)
/*
|
For completed details on DFSORT's SPLICE operator, see:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.13?DT=20060615185603 |
|
| Back to top |
|
 |
hariibm
New User
Joined: 05 Feb 2007 Posts: 44 Location: Chennai
|
|
|
|
Hi Frank,
I am confused with the lengths in my example given. Below is the actual requirement.
Please provide JCL for this requirement. The input records are as below.
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+
-------- PART 01232K01121{03051AZZZZ-------------
-------- PART 01232B01421A09011AXXXX-------------
-------- PART 01122{08015{01021AMMMM-------------
++++++++ NAME ZZZZHARI 4
++++++++ NAME XXXXRAMU 2 |
The LRECL is 800 and RECFM is VB.
And the output should be like this..
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+---
-------- PART 01232K01121{03051AZZZZ-------------HARI
-------- PART 01232B01421A09011AXXXX-------------RAMU
-------- PART 01122{08015{01021AMMMM------------- |
The record types can be either 'PART' or 'NAME'
So, the matching should be done between the records for the part number.
Part number for PART records starts at position 44 and at position 19 for the NAME records.
The part number length is 4.
Whenever there is a matching found for the Part number exists in PART records and NAME records, then the name of the part should appear at the end of the PART records. And if the no match found, the part name will be space.
PART records length is 60 and NAME records length is 40(not LRECLs).
My output should only contain the PART records.
And at the end, the result file should be sorted on the field starting from position 26 to 31(the picture clause for it is: S9(4)V9(2).
Thanks in Advance.
Hari. |
|
| Back to top |
|
 |
|
|
|