Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need a SORT job
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Mar 18, 2008 5:41 pm    Post subject: Need a SORT job
Reply with quote

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
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 18, 2008 10:07 pm    Post subject:
Reply with quote

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
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Mar 18, 2008 10:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Mar 18, 2008 10:35 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 18, 2008 10:56 pm    Post subject:
Reply with quote

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
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Mar 18, 2008 11:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 18, 2008 11:34 pm    Post subject:
Reply with quote

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
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Tue Mar 18, 2008 11:41 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Mar 19, 2008 12:55 am    Post subject:
Reply with quote

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
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Wed Mar 19, 2008 1:05 am    Post subject:
Reply with quote

Thanks yeager.
I wanted this exactly.


Thanks,
Hari
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Mar 19, 2008 2:30 am    Post subject:
Reply with quote

Good. icon_biggrin.gif
Back to top
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Wed Mar 19, 2008 6:00 pm    Post subject:
Reply with quote

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
View user's profile Send private message
sclater

New User


Joined: 22 Jun 2007
Posts: 14
Location: South Africa

PostPosted: Wed Mar 19, 2008 6:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Mar 19, 2008 9:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Thu Mar 20, 2008 12:50 am    Post subject:
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 20, 2008 1:19 am    Post subject:
Reply with quote

Have you even tried to work this out for yourself based on the previous example?

You've changed the requirement 3 times already. How many more changes will there be? Come back tomorrow morning and assure me there will be no more changes in the requirement and I'll give you one final solution.
Back to top
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Thu Mar 20, 2008 1:42 am    Post subject:
Reply with quote

Hi Frank,

There is no change in the requirement. I assure you that this is the final one.
Please give me the JCL.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 20, 2008 2:37 am    Post subject:
Reply with quote

Here's the DFSORT/ICETOOL job:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
SPLICE FROM(IN) TO(T1) ON(49,4,CH) KEEPNODUPS KEEPBASE -
 WITHALL WITH(6,60) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OPTION VLSCMP
  INCLUDE COND=(15,4,SS,EQ,C'PART,NAME')
  INREC IFTHEN=(WHEN=(15,4,CH,EQ,C'NAME'),
    BUILD=(1,4,5:C'0',49:23,4,66:27,16)),
   IFTHEN=(WHEN=NONE,BUILD=(1,4,5:C'1',6:5))
  SORT FIELDS=(49,4,ZD,A,5,1,CH,A)
  OUTFIL FNAMES=T1,OMIT=(16,4,CH,NE,C'PART'),
     BUILD=(1,4,5:6)
/*
//CTL2CNTL DD *
  SORT FIELDS=(30,6,ZD,A)
/*
Back to top
View user's profile Send private message
hariibm

New User


Joined: 05 Feb 2007
Posts: 61
Location: Chennai

PostPosted: Wed Mar 26, 2008 8:58 pm    Post subject:
Reply with quote

Hi Frank,

Thanks for the JCL above.

Please tell me which option of the SPLICE allows the duplicates from the OVERLAY record?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Mar 26, 2008 9:10 pm    Post subject:
Reply with quote

Quote:
Please tell me which option of the SPLICE allows the duplicates from the OVERLAY record?


WITHALL tells ICETOOL to splice the base record with each overlay record if that's what you mean.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us