SORT the INFILE by hierarchy



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

SORT the INFILE by hierarchy

Postby ram23bal » Thu Sep 11, 2008 7:52 pm

hi ,

I have an infile of record length 332. in which byte 330 will have L,T, M, D, A, Z,N,P

I need a output file which will be sorted in the order of N,L,P,T,M,D,A,Z.
ram23bal
 
Posts: 32
Joined: Sat May 24, 2008 3:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT the INFILE by hierarchy

Postby Frank Yaeger » Tue Sep 16, 2008 11:23 pm

You can use a DFSORT job like the following to do what you asked for:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  ALTSEQ CODE=(D500,D301,D702,E303,D404,C405,C106,E907)
  SORT FIELDS=(330,1,AQ,A)
/*
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: SORT the INFILE by hierarchy

Postby ram23bal » Wed Sep 17, 2008 3:03 pm

MR Frank Yaeger

Can you please explain what you have posted.

Iam unable to get the JCL.
ram23bal
 
Posts: 32
Joined: Sat May 24, 2008 3:57 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT the INFILE by hierarchy

Postby Frank Yaeger » Wed Sep 17, 2008 9:20 pm

SORT FIELDS=(330,1,AQ,A)

Sorts the byte at position 330 according to the alternate collating sequence indicated by the ALTSEQ statement.

ALTSEQ CODE=(D500,D301,D702,E303,D404,C405,C106,E907)

Sets the alternate collating sequence as follows:

X'D5' (C'N') is collated as X'00'.
X'D3' (C'L') is collated as X'01'.
X'D7' (C'P') is collated as X'02'.
X'E3' (C'T') is collated as X'03'.
X'D4' (C'M') is collated as X'04'.
X'C4' (C'D') is collated as X'05'.
X'C1' (C'A') is collated as X'06'.
X'E9' (C'Z') is collated as X''07'.

So 'N' in position 330 is sorted first, then 'L', and so on.

Thus, the order of the records sorted by position 330 is N,L,P,T,M,D,A,Z.
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: SORT the INFILE by hierarchy

Postby ram23bal » Fri Sep 19, 2008 8:18 am

Hey Frank...

Thanks a lot yaar.... It works like a charm.... :D
ram23bal
 
Posts: 32
Joined: Sat May 24, 2008 3:57 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post