View previous topic :: View next topic
|
Author |
Message |
Searchman
New User
Joined: 28 Dec 2006 Posts: 80 Location: France
|
|
|
|
I've read it's possible to use SEQNUM followed by START=
But I wonder if the value could be taken from field of the 1st record, so that the procedure is full automatic
Ex. (pos. number=1 to 5 ; FLR = 8) :
00051AAA
00051AAA
00051AAB
00052ABD
00053ABD
must give :
00051AAA
00052AAB
00053ABD
00054ABD
Note : I use a SELECT FIRST... ON(1,8) to eliminate duplicate records on entire record length (8) |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB)
//OUT DD DSN=... output file (FB)
//TOOLIN DD *
COPY FROM(IN) TO(CTL2CNTL) USING(CTL1)
SELECT FROM(IN) TO(OUT) ON(1,8,CH) FIRST USING(CTL2)
/*
//CTL1CNTL DD *
OPTION STOPAFT=1
INREC BUILD=(C' OUTFIL FNAMES=OUT,OVERLAY=(1:SEQNUM,5,ZD,START=',
1,5,C')',80:X)
/*
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
|
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Searchman,
Here is an alternative way of getting the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your 8 byte FB file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,8,CH,A),EQUALS
SUM FIELDS=NONE
OUTREC IFOUTLEN=8,IFTHEN=(WHEN=INIT,OVERLAY=(9:SEQNUM,5,ZD,START=0)),
IFTHEN=(WHEN=GROUP,BEGIN=(9,5,ZD,EQ,0),PUSH=(1:1,5)),
IFTHEN=(WHEN=(9,5,ZD,GT,0),
OVERLAY=(1:1,5,ZD,ADD,9,5,ZD,M11,LENGTH=5))
//* |
|
|
Back to top |
|
|
Searchman
New User
Joined: 28 Dec 2006 Posts: 80 Location: France
|
|
|
|
Thank you for the two solutions...
I find the first one (SELECT FIRST) quite elegant ! |
|
Back to top |
|
|
|
|