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
 

 

SELCOPY/JCL SORT example

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
srikm

New User


Joined: 19 May 2006
Posts: 4

PostPosted: Fri May 19, 2006 8:11 pm    Post subject: SELCOPY/JCL SORT example
Reply with quote

Hi

Iam struck in a production issue
Following is my requirement..
I have data as follows(no,of I/P records.12)
-------------------
99999XXXX0000
99999XXXX0000
99999XXXX0001
99999XXXX0001
99999XXXX0002
99999XXXX0002
99999XXXX0003
99999XXXX0003
99999XXXX0003
99999XXXX0004
99999XXXX0004
99999XXXX0004
-------------------
after JCL Sort it should look like.(no,of O/P records.9)
-------------------
99999XXXX0000
99999XXXX0001
99999XXXX0002
99999XXXX0003
99999XXXX0003
99999XXXX0003
99999XXXX0004
99999XXXX0004
99999XXXX0004
-------------------
I will be very much thankfull if any one can provide a
SELCOPY/JCL SORT example to solve the above issue.......


Thanks
KMSrinivas
09880191795
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: Fri May 19, 2006 8:28 pm    Post subject:
Reply with quote

You haven't given enough information for anyone to provide a solution.

The only pattern I see is that you're removing duplicates for the 0000, 0001 and 0002 records, but keeping duplicates for the 0003 and 0004 records. Is that the "rule" you want to use to get from input to output or is it something else? If it's something else, what is it?

Is the "key" all of the bytes or just some of the bytes?

What is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
srikm

New User


Joined: 19 May 2006
Posts: 4

PostPosted: Fri May 19, 2006 8:55 pm    Post subject:
Reply with quote

Thanks for reply

i will explain you clearly

i want to remove duplicates of 0000, 0001 and 0002 records, but keeping duplicates for the 0003 and 0004 .



KEY is
------
99999 0000 =====actual record
0123456789XYZ =====field num
____
^ ^
can be anything

key : 012349XYZ ===field number

RECFM and LRECL : VB and 1067


waiting for your reply.....



Thanks
KMSrinivas
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: Fri May 19, 2006 9:32 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for. It wasn't clear to me what your key was (it would have helped if you'd just given the starting position and length of the key or keys), so I assumed i was just the 4-byte number in positions 14-17. You can change the job appropriately for other keys.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN    DD    *
* Reformat 0003 and 0004 records to:
* |RDW|seqnum..|data|nnnn|
  INREC IFTHEN=(WHEN=(14,4,ZD,GT,+2),
          BUILD=(1,4,5:SEQNUM,8,ZD,13:5)),
* Reformat 0001, 0002 and 0003 records to:
* |RDW|00000000|data|nnnn|
        IFTHEN=(WHEN=NONE,
          BUILD=(1,4,5:C'00000000',13:5))
  OPTION EQUALS
* Sort on seqnum and nnnn.
  SORT FIELDS=(5,8,ZD,A,22,4,ZD,A)
* Remove duplicates:
* For 0003 and 0004 records, each record has a different
* seqnum so dups are not removed.  For 0001, 0002 and 0003
* records, each record has a seqnum of 00000000, so dups
* are removed.
  SUM FIELDS=NONE
* Remove seqnum.
  OUTREC BUILD=(1,4,5:13)
/*
Back to top
View user's profile Send private message
bshkris

New User


Joined: 21 Mar 2005
Posts: 22
Location: pune

PostPosted: Fri May 19, 2006 9:35 pm    Post subject:
Reply with quote

Hi,
I think we can use SORT FIELDS= NONE, to elimanate the duplicate records, then after we should use SKIP REC. i.e where we need to ignore the NONE condition.
I guess it will works.

let me know if iam wrong.
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: Fri May 19, 2006 9:41 pm    Post subject:
Reply with quote

bshkris,

You mean SUM FIELDS=NONE, not SORT FIELDS=NONE.

See my post above for the solution which does use SUM FIELDS=NONE, but doesn't use SKIPREC.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

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