View previous topic :: View next topic
Author
Message
adoerner New User Joined: 25 Apr 2007Posts: 11 Location: Germany
Hello !
Sorry, I don't know to describe the problem in the subject.
The input-File is:
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB
I want to get this sort-result:
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
Is this possible ?
Greetings
Axel
Back to top
CICS Guy Senior Member Joined: 18 Jul 2007Posts: 2146 Location: At my coffee table
If you could tag the 1s with a seqnum starting at 1 and incrementing by 2 and tag the 2s with a seqnum starting at 2 and incrementing by 2, then sorting on the seqnum would put them in the seq you want....
I wonder if the IFTHEN will allow that?
Back to top
ParagChouguley Active User Joined: 03 Feb 2007Posts: 175 Location: PUNE(INDIA)
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB
/*
//*
//OUT1 DD SYSOUT=*
//*
//TEMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),
// DSORG=PS,RECFM=FB
//TOOLIN DD *
COPY FROM(IN1) TO(TEMP1) USING(SRT1)
SORT FROM(TEMP1) TO(OUT1) USING(SRT2)
/*
//*
//SRT1CNTL DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(7,1,CH,EQ,C'1'),
BUILD=(SEQNUM,10,ZD,1,13)),
IFTHEN=(WHEN=(7,1,CH,EQ,C'2'),
BUILD=(SEQNUM,10,ZD,1,13))
/*
//SRT2CNTL DD *
SORT FIELDS=(1,10,ZD,A,17,1,CH,A)
OUTREC FIELDS=(11,13)
/*
Output :
Code:
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
--Parag
Back to top
krisprems Active Member Joined: 27 Nov 2006Posts: 649 Location: India
adoerner
Here is a DFSORT JCL that does what's needed in a single pass!
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 1 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB
AAAAA 2 BBBBB
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(7,1)))
SORT FIELDS=(1,5,CH,A,81,8,ZD,A),EQUALS
OUTREC BUILD=(1,80)
/*
Back to top
adoerner New User Joined: 25 Apr 2007Posts: 11 Location: Germany
It works great !
Thank you very much!
Greetings
Axel
Back to top
Please enable JavaScript!