View previous topic :: View next topic
Author
Message
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hi all,
I have a FB file with record length 80 like
Code:
011 0000000000000000000
012 1111111111111111111
013 2222222222222222222
014 3333333333333333333
015 4444444444444444444
016 5555555555555555555
017 6666666666666666666
018 7777777777777777777
019 8888888888888888888
Here first three field contain some key value & it's unique per record
Now i want the output
Code:
020 1111111111111111111
021 2222222222222222222
022 3333333333333333333
023 4444444444444444444
024 5555555555555555555
025 6666666666666666666
026 7777777777777777777
027 8888888888888888888
Means we are taking the higest key value which is 019 in this case adding
1 for first row 2 for second row...
Please provide the sort card for this.
Back to top
krisprems Active Member Joined: 27 Nov 2006Posts: 649 Location: India
guptae
Here is the SORT solution for your problem
Code:
//*******************************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
011 0000000000000000000
012 1111111111111111111
013 2222222222222222222
014 3333333333333333333
015 4444444444444444444
016 5555555555555555555
017 6666666666666666666
018 7777777777777777777
019 8888888888888888888
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,3,ZD,D)
OUTFIL REMOVECC,ENDREC=1,
BUILD=(1,3,ZD,ADD,+1,M11,LENGTH=3,5:19C'1',80:X,/,
1,3,ZD,ADD,+2,M11,LENGTH=3,5:19C'2',80:X,/,
1,3,ZD,ADD,+3,M11,LENGTH=3,5:19C'3',80:X,/,
1,3,ZD,ADD,+4,M11,LENGTH=3,5:19C'4',80:X,/,
1,3,ZD,ADD,+5,M11,LENGTH=3,5:19C'5',80:X,/,
1,3,ZD,ADD,+6,M11,LENGTH=3,5:19C'6',80:X,/,
1,3,ZD,ADD,+7,M11,LENGTH=3,5:19C'7',80:X,/,
1,3,ZD,ADD,+8,M11,LENGTH=3,5:19C'8',80:X)
/*
SORTOUT
Code:
020 1111111111111111111
021 2222222222222222222
022 3333333333333333333
023 4444444444444444444
024 5555555555555555555
025 6666666666666666666
026 7777777777777777777
027 8888888888888888888
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hi krisprems,
Thanks for your reply...But my dataset contain 3.5 million records so i cant follow ur approach..
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
I think Ekta did not describe what was needed very well. I'm guessing that the records do NOT necessarily contain repeating numbers and that the 020 ... should be overlaid on the existing records whatever they contain (Ekta does not show the 0s record for output but should have).
To illustrate what I think is wanted, the input could be something like this:
Code:
011 A000000001AAAAAAAAA
012 B000000005BBBBBBBBB
013 B000000006CCCCCCCCC
014 B000000003DDDDDDDDD
015 CCCCCCCCCCCCCC00002
016 D000000002555555555
017 EEEEEEEEFFFFFFFFFFF
018 F000000000000000000
019 GGGGGGGGGGGGHHHHHHH
Krisprems solution would give this output for that input and every other similar set of input:
Code:
020 1111111111111111111
021 2222222222222222222
022 3333333333333333333
023 4444444444444444444
024 5555555555555555555
025 6666666666666666666
026 7777777777777777777
027 8888888888888888888
But I'm guessing that the output for this input should actually be:
Code:
020 A000000001AAAAAAAAA
021 B000000005BBBBBBBBB
022 B000000006CCCCCCCCC
023 B000000003DDDDDDDDD
024 CCCCCCCCCCCCCC00002
025 D000000002555555555
026 EEEEEEEEFFFFFFFFFFF
027 F000000000000000000
028 GGGGGGGGGGGGHHHHHHH
Here's a DFSORT/ICETOOL job to give that output:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
011 A000000001AAAAAAAAA
012 B000000005BBBBBBBBB
013 B000000006CCCCCCCCC
014 B000000003DDDDDDDDD
015 CCCCCCCCCCCCCC00002
016 D000000002555555555
017 EEEEEEEEFFFFFFFFFFF
018 F000000000000000000
019 GGGGGGGGGGGGHHHHHHH
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(IN) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC BUILD=(1,3,ZD,ADD,+1,EDIT=(TTT))
OUTFIL FNAMES=CTL2CNTL,REMOVECC,NODETAIL,
BUILD=(80X),
TRAILER1=(' INREC OVERLAY=(SEQNUM,3,ZD,START=',
MAX=(1,3,ZD,EDIT=(TTT)),C')')
/*
//CTL2CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
Note that this approach will work for any number of records.
Ekta - please clarify what it is you do want.
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hi Frank,
Thanks a ton...
Back to top
Please enable JavaScript!