Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copy, Count & Write using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Copy, Count & Write using Syncsort
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    Post subject:
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    Post subject: Reply to: Copy, Count & Write using Syncsort
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    Post subject: Reply to: Copy, Count & Write using Syncsort
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

Site Director


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

PostPosted: Thu Apr 09, 2009 10:15 pm    Post subject:
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    Post subject: Reply to: Copy, Count & Write using Syncsort
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

Site Director


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

PostPosted: Thu Apr 09, 2009 10:39 pm    Post subject:
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    Post subject: Reply to: Copy, Count & Write using Syncsort
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    Post subject: Reply to: Copy, Count & Write using Syncsort
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us