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
 

 

Need to create a report using Sort
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Thu Apr 25, 2013 4:12 pm    Post subject: Need to create a report using Sort
Reply with quote

Hi ,
Need an help in sort.


My i/p file is having below structure

I/P:

Code:
0000010005750120140700000006350{1303[b]22[/b]NNATLANTA
000001000575                           Y00000000000[b]123[/b]0000[b]01[/b] 
0000010005750120136800000014050{1303[b]07[/b]NNCORPORATION     
000001000575                           Y00000000[b]1405[/b]000000[b]01 [/b] 
 

need to create a report in below format where the date is present in the detail record and the other informations such as total number of records and amount are in triler record.
O/P:
Code:
                      CURRENT MONTH
 
DAY                          TOTAL AMOUNT                    NO OF RECORDS
-------------------------------------------------------------------------------------
22                              123                                                    1
 
07                              1405                                                  1
 
 
TOTAL                       1525                                                  2


Thanks,
Karthik

Code'd
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Thu Apr 25, 2013 4:54 pm    Post subject: Reply to: Sort needed
Reply with quote

Please use the Code tags and Preview to show your input and expected output.
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 25, 2013 6:46 pm    Post subject:
Reply with quote

Hello,

Suggest you search within the forum as there are several topics that show report generation.
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Fri Apr 26, 2013 2:25 pm    Post subject: Reply to: Sort needed
Reply with quote

Sorry for not posting the query properly.

Is there anyway to display the month using sort
EX:
if job runs on march it should display as 'MARCH' in the report.

Thanks,
Karthik
Back to top
View user's profile Send private message
senthilnathanj

New User


Joined: 31 Jul 2007
Posts: 47
Location: chennai

PostPosted: Fri Apr 26, 2013 2:58 pm    Post subject: Reply to: Sort needed
Reply with quote

Hi karthik,

The following JCL will give you the desired results. we use the DATE1 parm to get the current date in the format(YYYYMMDD). Since you want the month name of the last month , we use a change command to spell out the name of the last month. We also split the file into 2 files, when the month is 01 , we write it out to HDR1 file, else we write it out to HDR2 file.

When the month is 01, then we need to subtract 1 from the year to get the previous year. so at any point we will only create one header.Either HDR1 or HDR2 file.
Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SORTIN   DD *                   
DUMMY RECORD                       
//HDR1     DD SYSOUT=*             
//HDR2     DD SYSOUT=*             
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  INREC FIELDS=(DATE1,80:X)                             
  OUTREC FIELDS=(01,10,                                 
                 X,                                     
                 12:5,2,CHANGE=(10,C'01',C'DECEMBER, ',
                                   C'02',C'JANUARY,  ',
                                   C'03',C'FEBRUARY, ',
                                   C'04',C'MARCH,    ',
                                   C'05',C'APRIL,    ',
                                   C'06',C'MAY,      ',
                                   C'07',C'JUNE,     ',
                                   C'08',C'JULY,     ',
                                   C'09',C'AUGUST,   ',
                                   C'10',C'SEPTEMBER,',
                                   C'11',C'OCTOBER,  ',
                                   C'12',C'NOVEMBER, '),
                 80:X)                                   
  OUTFIL FNAMES=HDR1,INCLUDE=(5,2,CH,EQ,C'01'),
   OUTREC=(12,10,                               
          +1,SUB,1,4,ZD,EDIT=(TTTT),80:X)       
  OUTFIL FNAMES=HDR2,SAVE,                     
   OUTREC=(12,10,X,1,4,80:X)                     
/*


Hope this helps...
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Fri Apr 26, 2013 5:10 pm    Post subject: Reply to: Sort needed
Reply with quote

This is my o/p
Quote:
DATE:04/26/13 PAGE: 01

BANK REPORT

PAYMENT AND CHECK WRITER SYSTEMS

CHECK DAY TOTAL AMOUNT NO OF CHECKS


Sort card :
Quote:
YSIN DD *
SORT FIELDS=(38,2,CH,A)
OUTFIL REMOVECC,NODETAIL,
HEADER2=(3:'DATE:',8:&DATE,70:'PAGE: ',PAGE=(EDIT=(TT)),2/,
20:'BANK REPORT',2/,
18:'PAYMENT AND CHECK WRITER SYSTEMS',2/,
18:'CHECK DAY',33:'TOTAL AMOUNT',53:'NO OF CHECKS',/),
SECTIONS=(38,2,
TRAILER3=(19X,38,2,11X,COUNT=(M10,LENGTH=10),8X,
TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIII.TTS'),
LENGTH=19,SIGNS=(,,,-)))),
TRAILER1=(16:'SUM',32:COUNT=(M10,LENGTH=9),
46:TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIIIIIT.TTS'),
LENGTH=22,SIGNS=(,,,-)))

I want the month to be displayed after
PAYMENT AND CHECK WRITER SYSTEMS

ie
Quote:
MARCH
PAYMENT AND CHECK WRITER SYSTEMS
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Apr 26, 2013 11:36 pm    Post subject:
Reply with quote

mf_karthik,

Do you need the current month or last month name? You show conflicting outputs.

senthilnathanj,

You don't have to split the file and perform manual subtraction of the year to get the last month. You can use DATE2-n to get the previous year-month date. Date2 is of the format CCYYMM so if you want last month you can have DATE2-1 which would produce 201303

Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
                                     
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  OPTION COPY                         
  INREC BUILD=(DATE2-1,10X)           
                                     
  OUTREC FINDREP=(STARTPOS=5,         
  INOUT=(C'01',C' JANUARY,  ',       
         C'02',C' FEBRUARY, ',       
         C'03',C' MARCH,    ',       
         C'04',C' APRIL,    ',       
         C'05',C' MAY,      ',       
         C'06',C' JUNE,     ',       
         C'07',C' JULY,     ',       
         C'08',C' AUGUST,   ',       
         C'09',C' SEPTEMBER,',       
         C'10',C' OCTOBER,  ',       
         C'11',C' NOVEMBER, ',       
         C'12',C' DECEMBER, '))       
//*


will produce
Code:

2013 MARCH,
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Sun Apr 28, 2013 9:03 am    Post subject: Reply to: Sort needed
Reply with quote

hi,

i need the current month to be displayed.

karthik
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Sun Apr 28, 2013 1:14 pm    Post subject: Reply to: Sort needed
Reply with quote

So drop the "-1". Is there still a problem?
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Mon Apr 29, 2013 11:04 am    Post subject: Reply to: Sort needed
Reply with quote

I have tried using the code provided by kolusu,and it is throwing error at the time of scanning

PARAMETER 'FINDREP' IS UNIDENTIFIED.

below is the code :
Quote:
OPTION COPY
INREC BUILD=(DATE2,10X)
OUTREC FINDREP=(STARTPOS=5,
INOUT=(C'01',C' JANUARY, ',
C'02',C' FEBRUARY, ',
C'03',C' MARCH, ',
C'04',C' APRIL, ',
C'05',C' MAY, ',
C'06',C' JUNE, ',
C'07',C' JULY, ',
C'08',C' AUGUST, ',
C'09',C' SEPTEMBER,',
C'10',C' OCTOBER, ',
C'11',C' NOVEMBER, ',
C'12',C' DECEMBER, '))
SORT FIELDS=(38,2,CH,A)
OUTFIL REMOVECC,NODETAIL,
HEADER2=(3:'DATE:',8:&DATE,70:'PAGE: ',PAGE=(EDIT=(TT)),2/
20:'BANK REPORT',2/,
18:'PAYMENT AND CHECK WRITER SYSTEMS',2/,
18:'CHECK DAY',33:'TOTAL AMOUNT',53:'NO OF CHECKS',/),
SECTIONS=(38,2,
TRAILER3=(19X,38,2,11X,COUNT=(M10,LENGTH=10),8X,
TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIII.TTS'),
LENGTH=19,SIGNS=(,,,-)))),
TRAILER1=(16:'SUM',32:COUNT=(M10,LENGTH=9),
46:TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIIIIIT.TTS'),
LENGTH=22,SIGNS=(,,,-)))
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Apr 29, 2013 11:40 am    Post subject: Reply to: Sort needed
Reply with quote

Please run this, and post the full sysout from the step.

Code:
//S1 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*


Are you going with what a JCL Checker says, rather than trying to run it?
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Mon Apr 29, 2013 12:28 pm    Post subject: Reply to: Sort needed
Reply with quote

Bill,

I tried submitting the job with FINDREP it failed with
WER268A OUTREC STATEMENT : SYNTAX ERROR

we are using
SYNCSORT FOR Z/OS 1.4.0.1R

Thanks,
Karthik
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Apr 29, 2013 1:27 pm    Post subject: Reply to: Sort needed
Reply with quote

SyncSort questions belong in the JCL forum. Topic moved.

You have a fairly current SyncSort, so it has FINDREP. Consult your documentation to find out syntax for FINDREP in SyncSort and amend.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Apr 29, 2013 3:11 pm    Post subject:
Reply with quote

Quote:
I tried submitting the job with FINDREP it failed with
WER268A OUTREC STATEMENT : SYNTAX ERROR
Support for FINDREP is available with SyncSort since Syncosrt for z/OS 1.3.2.1. So there should be some other error, as Bill has also indicated to.

Also, in other post of yours you post
Quote:
PARAMETER 'FINDREP' IS UNIDENTIFIED.
- that's not a standard SyncSort error message. It should be from your "JCL syntax Check tool" -- such tools are usually misleading when it comes (to deal with the) new feactures of Sort-products.

Suggest you post the Sort-JCL you've used and the SYSOUT from the failed Job with BBcode Tags.
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Mon Apr 29, 2013 3:43 pm    Post subject: Reply to: Need to create a report using Sort
Reply with quote

Below is the jc and the error msg:


Code:
//CWCRN029 EXEC PGM=SORT                       
//SORTWK01 DD  UNIT=SYSDA,                     
//             SPACE=(TRK,(50,9),RLSE)         
//SORTWK02 DD  UNIT=SYSDA,                     
//             SPACE=(TRK,(50,9),RLSE)         
//SYSOUT   DD  SYSOUT=*                         
//SORTMSG  DD  SYSOUT=*                         
//SORTIN   DD  DSN=ABCD.VNI.REC.CURRENT(0),     
//             DISP=SHR                         
//SORTOUT  DD  DSN=&&TEMP,                     
//             DISP=(NEW,PASS,DELETE),         
//             DCB=(RECFM=FB,LRECL=244),       
//             SPACE=(TRK,(90,90),RLSE)         
//SYSIN    DD *                                 
   SORT FIELDS=COPY                             
   OMIT COND=(41,01,CH,EQ,C'Y')                 
//*                                             
//CWRCN030 EXEC  PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTMSG  DD SYSOUT=*                         
//SORTIN   DD DSN=&&TEMP,
//            DISP=SHR   
//SORTOUT  DD SYSOUT=*   
//SYSIN DD *             
OPTION COPY                                               
INREC BUILD=(DATE2,10X)                                   
OUTREC FINDREP=(STARTPOS=5,                               
INOUT=(C'01',C' JANUARY, ',                               
C'02',C' FEBRUARY, ',                                     
C'03',C' MARCH, ',                                         
C'04',C' APRIL, ',                                         
C'05',C' MAY, ',                                           
C'06',C' JUNE, ',                                         
C'07',C' JULY, ',                                         
C'08',C' AUGUST, ',                                       
C'09',C' SEPTEMBER,',                                     
C'10',C' OCTOBER, ',                                       
C'11',C' NOVEMBER, ',                                     
C'12',C' DECEMBER, '))                                     
SORT FIELDS=(38,2,CH,A)                                   
OUTFIL REMOVECC,NODETAIL,                                 
HEADER2=(3:'DATE:',8:&DATE,70:'PAGE: ',PAGE=(EDIT=(TT)),2/,
20:'BANK REPORT',2/,                                       
18:'PAYMENT AND CHECK WRITER SYSTEMS',2/,                 
18:'CHECK DAY',33:'TOTAL AMOUNT',53:'NO OF CHECKS',/),
SECTIONS=(38,2,                                       
TRAILER3=(19X,38,2,11X,COUNT=(M10,LENGTH=10),8X,     
TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIII.TTS'),           
LENGTH=19,SIGNS=(,,,-)))),                           
TRAILER1=(16:'SUM',32:COUNT=(M10,LENGTH=9),           
46:TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIIIIIT.TTS'),     
LENGTH=22,SIGNS=(,,,-)))   

SORTMSG:

Code:
WER276B  SYSDIAG= 2533343, 4594029, 4594029, 2050200                 
WER164B  6,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,   
WER164B     0 BYTES RESERVE REQUESTED, 992K BYTES USED               
WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                     
WER108I  SORTIN   : RECFM=FB   ; LRECL=   244; BLKSIZE= 27816       
WER073I  SORTIN   : DSNAME=SYS13119.T055719.RA000.FDMPSZ1V.TEMP.H06 
WER257I  INREC RECORD LENGTH =    16                                 
WER237I  OUTREC RECORD LENGTH =    16                               
WER027A  CONTROL FIELD BEYOND RECORD                                 
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                       
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Apr 29, 2013 3:53 pm    Post subject: Reply to: Need to create a report using Sort
Reply with quote

You need the full sysout from the step, in the Code tags so we can see where location identified for the "syntax error".
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Mon Apr 29, 2013 4:10 pm    Post subject: Reply to: Need to create a report using Sort
Reply with quote

Code:
SYNCSORT FOR Z/OS  1.4.0.1R    U.S. PATENTS: 4210961, 5117495   (C)
                                                      z/OS   1.12.0
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 110F7, MODEL 2827 612     
SYSIN :                                                           
        OPTION COPY                                               
        INREC BUILD=(DATE2,10X)                                   
        OUTREC FINDREP=(STARTPOS=5,                               
        INOUT=(C'01',C' JANUARY, ',                               
        C'02',C' FEBRUARY, ',                                     
        C'03',C' MARCH, ',                                         
        C'04',C' APRIL, ',                                         
        C'05',C' MAY, ',                                           
        C'06',C' JUNE, ',                                         
        C'07',C' JULY, ',                                         
        C'08',C' AUGUST, ',                                       
        C'09',C' SEPTEMBER,',                                     
        C'10',C' OCTOBER, ',   
       C'11',C' NOVEMBER, ',   
       C'12',C' DECEMBER, '))                                     
  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
        SORT FIELDS=(38,2,CH,A)                                     
        OUTFIL REMOVECC,NODETAIL,                                   
        HEADER2=(3:'DATE:',8:&DATE,70:'PAGE: ',PAGE=(EDIT=(TT)),2/,
        20:'BANK REPORT',2/,                                       
        18:'PAYMENT AND CHECK WRITER SYSTEMS',2/,                   
        18:'CHECK DAY',33:'TOTAL AMOUNT',53:'NO OF CHECKS',/),     
        SECTIONS=(38,2,                                             
        TRAILER3=(19X,38,2,11X,COUNT=(M10,LENGTH=10),8X,           
        TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIII.TTS'),                 
        LENGTH=19,SIGNS=(,,,-)))),                                 
        TRAILER1=(16:'SUM',32:COUNT=(M10,LENGTH=9),                 
        46:TOT=(22,12,ZD,EDIT('IIIIIIIIIIIIIIIIIT.TTS'),           
        LENGTH=22,SIGNS=(,,,-)))                                   
WER276B  SYSDIAG= 2533343, 4594029, 4594029, 2050200     
WER164B  6,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,   
WER164B     0 BYTES RESERVE REQUESTED, 992K BYTES USED               
WER146B  32K BYTES OF EMERGENCY SPACE ALLOCATED                       
WER108I  SORTIN   : RECFM=FB   ; LRECL=   244; BLKSIZE= 27816         
WER073I  SORTIN   : DSNAME=SYS13119.T055719.RA000.FDMPSZ1V.TEMP.H06   
WER257I  INREC RECORD LENGTH =    16                                 
WER237I  OUTREC RECORD LENGTH =    16                                 
WER027A  CONTROL FIELD BEYOND RECORD                                 
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                         
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Code'd
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Apr 29, 2013 4:14 pm    Post subject: Reply to: Need to create a report using Sort
Reply with quote

You have taken Kolusu's example of just producing a date, with a 16-byte record which only exists from the Control Cards, having nothing to do with your input data.

Then you have given it your input file and some more Control Cards, and expected it to work.

Code:
WER027A  CONTROL FIELD BEYOND RECORD   


When you SORT on your data-position, it is beyond the "end" of the completely fictitious data which has overwritten your input file.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Apr 29, 2013 4:29 pm    Post subject:
Reply with quote

I've edited your code to add BBcode Tags, please learn to use them.

Did you check on
Code:
WER027A  CONTROL FIELD BEYOND RECORD             
Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Mon Apr 29, 2013 5:28 pm    Post subject: Reply to: Need to create a report using Sort
Reply with quote

Yes ,I'm getting the month if i ran that sort alone.

Can you suggest me how to achieve that in a report..
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 -> SYNCSORT All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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