JCL SORT



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Re: JCL SORT

Postby prebs87 » Sun Jan 08, 2012 1:39 pm

I have a input file as below;
the input file is sorted based on the first two bytes.
01111111111aaaaaaaaaaaaaaaaaaaaaaaaaa
01222222222aaaaaaaaaaaaaaaaaaaaaaaaaa
01333333333aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb111111111vv
02bbbbbbbbbbbbbbbbbbbbbbbb222222222vv
02bbbbbbbbbbbbbbbbbbbbbbbb333333333vv
400111111111yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400222222222yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400333333333yyyyyyyyyyyyyyyyyyyyyyyyyyyyy

By using sort utility in jcl i want the output file as below: the output files should be sorted based on the 9 digit values i.e
111111111
222222222
333333333

01111111111aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb111111111vv
400111111111yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
01222222222aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb222222222vv
400222222222yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
01333333333aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb333333333vv
400333333333yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
prebs87
 
Posts: 1
Joined: Sun Jan 08, 2012 1:21 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re: JCL SORT

 

Re: JCL SORT

Postby BillyBoyo » Sun Jan 08, 2012 1:52 pm

You mean the the sort key you want to use is in different places or different records?

Assuming so, have a look at this one: dfsort-icetool-icegener/topic6889.html
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: JCL SORT

Postby NicC » Sun Jan 08, 2012 6:53 pm

Sorry, but JCL does not sort data. It WILL tell the operating system which sort program you want to run and your question should be posted in the relevant sort section of the forum.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: JCL SORT

Postby dick scherrer » Mon Jan 09, 2012 2:10 am

Hello and welcome to the forum,

The duplication of your post has been removed (it was a complete repeat and not needed).

In addition to showing the input and output you want you need to explain how to know where the key is in each record. You knew to group the One's, and the Two's and so forth. How is the code to know this - what is the rule for each record type?

Also, mention your recfm and lrecl.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: JCL SORT

Postby Frank Yaeger » Tue Jan 10, 2012 1:16 am

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, and that the key starts in position 27 for the '01' records, in position 4 for the '40' records and in position 3 for any other records. Adjust as needed.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
01111111111aaaaaaaaaaaaaaaaaaaaaaaaaa
01222222222aaaaaaaaaaaaaaaaaaaaaaaaaa
01333333333aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb111111111vv
02bbbbbbbbbbbbbbbbbbbbbbbb222222222vv
02bbbbbbbbbbbbbbbbbbbbbbbb333333333vv
400111111111yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400222222222yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400333333333yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'02'),OVERLAY=(81:27,9)),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'40'),OVERLAY=(81:4,9)),
        IFTHEN=(WHEN=NONE,OVERLAY=(81:3,9))
  SORT FIELDS=(81,9,ZD,A,1,2,CH,A)
  OUTREC BUILD=(1,80)
/*


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. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
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: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post