Creating Dynamic sort card using sort



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

Creating Dynamic sort card using sort

Postby Ranjana » Thu Jan 21, 2010 7:17 pm

Hi,

I have a below requirement,

Need to create a sort card dynamically which should have value from the input file which is created in the previous step.
Sort card should be in the below format,
SORT FIELDS=COPY
'INCLUDE COND=(68,9,CH,EQ,C,'XXXXXXXXX',or,
68,9,CH,EQ,C,'XXXXXXXXX',or,
.
.
.)

Where 'XXXXXXXXX' value should populate from the input file as said earlier. Value is in position 3 of input file.
one important thing is there may be any number of records in the input file.

Eg:

Input file data:
ABC456345645
DER456345875
ANJ926195280
AJU567234768

there can be more than four records or less than four recorrds also there may empty file.

Please let me know how to create dynamic sort card.

Thx in advance:-)
Ranjana
 
Posts: 9
Joined: Thu Jan 21, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Creating Dynamic sort card using sort

Postby Frank Yaeger » Fri Jan 22, 2010 12:06 am

Here's a DFSORT job that will do what you asked for. It appears that your 9-byte fields starts in position 4, not position 3 so I used 4. If it's actually position 3, use 3 instead of 4 in the BUILD line.

//S1   EXEC  PGM=SORT
//SYSOUT   DD  SYSOUT=*
//SORTIN DD *
ABC456345645
DER456345875
ANJ926195280
AJU567234768
//SORTOUT DD DSN=&&C1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,
    HEADER1=('  SORT FIELDS=COPY ',/,
      '  INCLUDE COND=(1,1,BI,NE,1,1,BI,OR,'),
    BUILD=(C'  68,9,CH,EQ,C''',4,9,C''',OR,',80:X),
    TRAILER1=('  1,1,BI,NE,1,1,BI)')
/*
//S2  EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN  DD DSN=&&C1,DISP=(OLD,PASS)


The DFSORT controls statements in &&C1 will be as follows:

  SORT FIELDS=COPY
  INCLUDE COND=(1,1,BI,NE,1,1,BI,OR,
  68,9,CH,EQ,C'456345645',OR,
  68,9,CH,EQ,C'456345875',OR,
  68,9,CH,EQ,C'926195280',OR,
  68,9,CH,EQ,C'567234768',OR,
  1,1,BI,NE,1,1,BI)
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: Creating Dynamic sort card using sort

Postby Ranjana » Fri Jan 22, 2010 9:53 am

Thanks a lot :) ..Ill check and let u know
Ranjana
 
Posts: 9
Joined: Thu Jan 21, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Creating Dynamic sort card using sort

Postby Ranjana » Fri Jan 22, 2010 9:56 am

Franks,

There is a condition that we should not use program ICETOOL, only SORT.
Is it possible??

Thx,
Ranjana
Ranjana
 
Posts: 9
Joined: Thu Jan 21, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Creating Dynamic sort card using sort

Postby dick scherrer » Fri Jan 22, 2010 10:02 am

Hello,

Why is ICETOOL mentioned?

Frank's solution uses PGM=SORT which is the sort which meets the "only SORT condition".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Creating Dynamic sort card using sort

Postby Ranjana » Fri Jan 22, 2010 10:18 am

Dick,
Thx and u are correct!!

Frank,
It is working perfect.. thanks a lot :)

Ranjana
Ranjana
 
Posts: 9
Joined: Thu Jan 21, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Creating Dynamic sort card using sort

Postby dick scherrer » Fri Jan 22, 2010 10:45 am

You're welcome :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post