View previous topic :: View next topic
Author
Message
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Hi,
I have an input file like this:
Input File:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
01001XXXX1Q AMM28 9 GRT 911790109723 90809090C 175 101
01001XXXX1Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
01001XXXX1Q RJE1902I 59202
01001XXXX2Q AMM28 9 GRT 911790109723 90809090C 185 101
01001XXXX2Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
01001XXXX3Q AMM28 9 GRT 911790109723 90809090C 195 101
01001XXXX3Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
I want my output file as shown below:
Quote:
1). 99999XXXXXCOUNT99999 - Constant for 1st 20 bytes
2). column 21st to 25th - total of '1' @ 78th position from input file
3). column 26th to 30th - total of '2' @ 78th position from input file
4). 11 zeroes
5). column 42nd to 46th - total of '5' @ 76th position from input file
6). column 47th to 51st - total of '1' @ 78th position from input file
7). column 72nd - current month
8). column 74th - current date
9). 99899 - Constant - column 76th to 80th
Output File:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
99999XXXXXCOUNT99999000030000400000000000000070000300000000000000000000040799899
Please let me know how to achieve it using SORT.
TIA.
Back to top
shankar.v Active User Joined: 25 Jun 2007Posts: 196 Location: Bangalore
ramsri,
Please check with the following code.
Code:
// EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
01001XXXX1Q AMM28 9 GRT 911790109723 90809090C 175 101
01001XXXX1Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
01001XXXX1Q RJE1902I 59202
01001XXXX2Q AMM28 9 GRT 911790109723 90809090C 185 101
01001XXXX2Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
01001XXXX3Q AMM28 9 GRT 911790109723 90809090C 195 101
01001XXXX3Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
/*
//DATE DD *
C7C8,C'MMDD'
/*
//C2C6 DD DSN=&&C2C6,DISP=(,PASS),SPACE=(CYL,1)
//C3 DD DSN=&&C3,DISP=(,PASS),SPACE=(CYL,1)
//C5 DD DSN=&&C5,DISP=(,PASS),SPACE=(CYL,1)
//C7C8 DD DSN=&&C7C8,DISP=(,PASS),SPACE=(CYL,1)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(DATE) TO(C7C8) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=C2C6,INCLUDE=(78,1,CH,EQ,C'1'),
TRAILER1=(C'C2C6,C''',COUNT=(M11,LENGTH=5),C'''',80:X),
REMOVECC,NODETAIL
OUTFIL FNAMES=C3,INCLUDE=(78,1,CH,EQ,C'2'),
TRAILER1=(C'C3,C''',COUNT=(M11,LENGTH=5),C'''',80:X),
REMOVECC,NODETAIL
OUTFIL FNAMES=C5,INCLUDE=(76,1,CH,EQ,C'5'),
TRAILER1=(C'C5,C''',COUNT=(M11,LENGTH=5),C'''',80:X),
REMOVECC,NODETAIL
/*
//CTL2CNTL DD *
INREC BUILD=(DATENS=(MDY))
OUTREC BUILD=(C'C7C8,C''',1,4,C'''',80:X)
/*
// EXEC PGM=SORT
//SORTIN DD *
OUTPUT
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
C1,C'99999XXXXXCOUNT99999'
C4,11C'0'
C9,C'99899'
/*
// DD DSN=&&C2C6,DISP=(OLD,PASS)
// DD DSN=&&C3,DISP=(OLD,PASS)
// DD DSN=&&C5,DISP=(OLD,PASS)
// DD DSN=&&C7C8,DISP=(OLD,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C1,C2C6,C3,C4,C5,C2C6,20C'0',C7C8,C9)
/*
Thanks,
Shankar
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Shankar, Thanks. I will try this out.
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Sankar, with sample data I had put here the job works fine. But, when I gave the PROD dataset it is giving below error message :
Code:
UNSUCCESSFUL SORT 013 S REASON=00000020
Thanks.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
You have a dcb mis-match.
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Dick, I got hold of the explanation from the SYSUDUMP but unable to resolve it......
Quote:
20 An OPEN macro instruction was issued for a sequential data set
using queued access. BLKSIZE is not a multiple of LRECL, or
LRECL is 0 with RECFM=FB or RECFM=FBS, or BLKSIZE is not at
least four bytes greater than LRECL with RECFM=V.
How to solve this problem as it is showing up on temporary datasets.
Thanks.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Temporary datasets can be defined incorrectly as easily as "real" datasets can. . .
Is there some reason you did not post the actual jcl that causes the problem?
You also need to post the dcb info for the file that is used when the abend occurs.
By limiting the info you provide, you greatly increase the time it takes to find a solution. . .
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Dick, You are correct. I was not specifying the DCB on temp datasets...
I have added below line to all temp datasets and resolved the problem.
Code:
DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
Thanks.
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Shankar, What modification will be needed to copy input file & last record to output as shown below:
Output:
Code:
01001XXXX1Q AMM28 9 GRT 911790109723 90809090C 175 101
01001XXXX1Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
01001XXXX1Q RJE1902I 59202
01001XXXX2Q AMM28 9 GRT 911790109723 90809090C 185 101
01001XXXX2Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
01001XXXX3Q AMM28 9 GRT 911790109723 90809090C 195 101
01001XXXX3Q AMM28B79CV3C60E11GANLA2MFGN27N40PZHQI2QVHUPRW4U1SE82I 5 201
99999XXXXXCOUNT99999000030000400000000000000070000300000000000000000000040799899
Thanks.
Back to top
Please enable JavaScript!