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

SELCOPY/JCL SORT example


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Fri May 19, 2006 8:28 pm
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
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 Developer


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

PostPosted: Fri May 19, 2006 9:32 pm
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: 41
Location: pune

PostPosted: Fri May 19, 2006 9:35 pm
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 Developer


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

PostPosted: Fri May 19, 2006 9:41 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top