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
 

 

sorting records inside an outfil

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

New User


Joined: 25 Mar 2008
Posts: 10
Location: india

PostPosted: Tue Apr 01, 2008 11:07 am    Post subject: sorting records inside an outfil
Reply with quote

hi,

i have a input file as shown below

B25569946
A53895899
C56658858
D84666688
B89986566
C65849565
A98895885
C56659568
D66535856
A89566656
B15848689
D23894955

the records with first byte 'A' must be sorted based on bytes 2 and 3
the records with first byte 'B' must be sorted based on bytes 4 and 5
the records with first byte 'C' must be sorted based on bytes 6 and 7
the records with first byte 'D' must be sorted based on bytes 8 and 9

the jcl and the parameter used is as shown below


//STEP01 EXEC PGM=SORT,PARM='DYNALLOC=(SYSDA,16)'
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SORTIN DD DSN=*****************************
//* RECORD 1
//SORTOF01 DD DSN=&&SORT1,DISP=(NEW,PASS),
// UNIT=SYSALLDA,
// SPACE=(CYL,(5,5),RLSE),
// DCB=(LRECL=2600,BLKSIZE=0,RECFM=FB)
//* RECORD 2
//SORTOF02 DD DSN=&&SORT2,DISP=(NEW,PASS),
// UNIT=SYSALLDA,
// SPACE=(CYL,(5,5),RLSE),
// DCB=(LRECL=2600,BLKSIZE=0,RECFM=FB)
//* RECORD 3
//SORTOF03 DD DSN=&&SORT3,DISP=(NEW,PASS),
// UNIT=SYSALLDA,
// SPACE=(CYL,(5,5),RLSE),
// DCB=(LRECL=2600,BLKSIZE=0,RECFM=FB)
//* RECORD 4
//SORTOF04 DD DSN=&&SORT4,DISP=(NEW,PASS),
// UNIT=SYSALLDA,
// SPACE=(CYL,(5,5),RLSE),
// DCB=(LRECL=2600,BLKSIZE=0,RECFM=FB)
//SYSIN DD DSN=***************(SORT1),DISP=SHR
//*

//STEP02 EXEC PGM=SORT,PARM='DYNALLOC=(SYSDA,16)'

//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SORTIN DD DSN=&&SORT1,DISP=(SHR,DELETE)
// DD DSN=&&SORT2,DISP=(SHR,DELETE)
// DD DSN=&&SORT3,DISP=(SHR,DELETE)
// DD DSN=&&SORT4,DISP=(SHR,DELETE)
//*
//SORTOUT DD DSN=********************,
// DISP=(,CATLG),UNIT=SYSALLDA,
// SPACE=(CYL,(5,5),RLSE),
// DCB=(LRECL=2600,BLKSIZE=0,RECFM=FB)
//*
//SYSIN DD DSN=****************(SORT2),DISP=SHR


SORT1

SORT FIELDS=COPY
OUTFIL FILES=01,
INCLUDE=(1,1,CH,EQ,C'A')
SORT FIELDS=(2,2,CH,A)
OUTFIL FILES=02,
INCLUDE=(1,1,CH,EQ,C'B')
SORT FIELDS=(4,2,CH,A)
OUTFIL FILES=03,
INCLUDE=(1,1,CH,EQ,C'C')
SORT FIELDS=(6,2,CH,A)
OUTFIL FILES=04,
INCLUDE=(1,1,CH,EQ,C'D')
SORT FIELDS=(8,2,CH,A)

SORT2

SORT FIELDS=COPY

But while trying this its abending.
kindly provide me a solution to this.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Apr 01, 2008 11:32 am    Post subject:
Reply with quote

Vinod,

Use multiple passes in the same step. Try ICETOOL/SYNCTOOL (applicable).
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Apr 01, 2008 11:40 am    Post subject:
Reply with quote

Also posting the error messages from the run would be helpful
Back to top
View user's profile Send private message
vinodkrs

New User


Joined: 25 Mar 2008
Posts: 10
Location: india

PostPosted: Tue Apr 01, 2008 12:22 pm    Post subject:
Reply with quote

is it possible to do this using syncsort?

the error messages are
WER269A SORT STATEMENT : DUPLICATE STATEMENT FOUND
WER269A SORT STATEMENT : DUPLICATE STATEMENT FOUND
WER269A SORT STATEMENT : DUPLICATE STATEMENT FOUND
WER269A SORT STATEMENT : DUPLICATE STATEMENT FOUND
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Tue Apr 01, 2008 1:29 pm    Post subject:
Reply with quote

Hi,
Here is a syncsort ICETOOL job that will do what you had asked.

Code:

//S1      EXEC PGM=ICETOOL           
//TOOLMSG DD SYSOUT=*               
//DFSMSG  DD SYSOUT=*               
//IN1     DD *                       
B25569946                           
A53895899                           
C56658858                           
D84666688                           
B89986566                           
C65849565                           
A98895885                           
C56659568                           
D66535856                           
A89566656
B15848689
D23894955
/*                                               
//OUTA    DD DSN=OUTPUT-FILE-FOR-A,             
//      DSORG=PS,RECFM=FB,DISP=(NEW,CATLG,DELETE)
//OUTB    DD DSN=OUTPUT-FILE-FOR-B,             
//      DSORG=PS,RECFM=FB,DISP=(NEW,CATLG,DELETE)
//OUTC    DD DSN=OUTPUT-FILE-FOR-C,             
//      DSORG=PS,RECFM=FB,DISP=(NEW,CATLG,DELETE)
//OUTD    DD DSN=OUTPUT-FILE-FOR-D,             
//      DSORG=PS,RECFM=FB,DISP=(NEW,CATLG,DELETE)
//TOOLIN  DD *                                   
    SORT FROM(IN1) TO(OUTA) USING(SRT1)         
/*                                               
//SRT1CNTL DD *                                               
    SORT FIELDS=(1,2,CH,A)                                   
     INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'A'),                     
           BUILD=(2,2,1,9)),                                 
           IFTHEN=(WHEN=(1,1,CH,EQ,C'B'),                     
           BUILD=(4,2,1,9)),                                 
           IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),                     
           BUILD=(6,2,1,9)),                                 
           IFTHEN=(WHEN=(1,1,CH,EQ,C'D'),                     
           BUILD=(8,2,1,9))                                   
    OUTFIL FNAMES=(OUTA),INCLUDE=(3,1,CH,EQ,C'A'),OUTREC=(3,9)
    OUTFIL FNAMES=(OUTB),INCLUDE=(3,1,CH,EQ,C'B'),OUTREC=(3,9)
    OUTFIL FNAMES=(OUTC),INCLUDE=(3,1,CH,EQ,C'C'),OUTREC=(3,9)
    OUTFIL FNAMES=(OUTD),INCLUDE=(3,1,CH,EQ,C'D'),OUTREC=(3,9)
/*                                                           


File for A:
Code:

A53895899
A89566656
A98895885

File for b:
Code:

B25569946
B15848689
B89986566


File for C:
Code:

C56658858
C65849565
C56659568


File for D:
Code:

D23894955
D66535856
D84666688


--Parag
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 Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us