IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copy, Count & Write using Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Apr 07, 2009 12:27 am
Reply with quote

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
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Apr 07, 2009 2:30 pm
Reply with quote

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
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Apr 07, 2009 6:05 pm
Reply with quote

Shankar, Thanks. I will try this out.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Apr 09, 2009 10:05 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Apr 09, 2009 10:15 pm
Reply with quote

Hello,

You have a dcb mis-match.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Apr 09, 2009 10:26 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Apr 09, 2009 10:39 pm
Reply with quote

Hello,

Temporary datasets can be defined incorrectly as easily as "real" datasets can. . . icon_smile.gif

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. . . icon_confused.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Apr 09, 2009 10:43 pm
Reply with quote

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. icon_biggrin.gif
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Apr 09, 2009 11:29 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top