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

Need to change report with DOS/VSE Syncsort


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

New User


Joined: 16 Aug 2007
Posts: 34
Location: Bangalore

PostPosted: Thu Apr 29, 2010 10:57 pm
Reply with quote

Hi,
I have a report which looks like this and is sorted based on EMPID with header and total.

Code:
EMPID|AGENTNAME|SAL   
1111 |BALU     |100
2222 |SANDY    |200 
3333 |CINDY    |300
4444 |DAS      |150
TOTAL|         |750

I want a new report, and it should be sorted on AGENTNAME with header at top and total at bottom. When i use SYNC SORT with SORT FIELDS=(7,9,CH,A) to sort on AGENTNAME it displays like this :

Code:
TOTAL|         |750
EMPID|AGENTNAME|SAL
3333 |CINDY    |300
1111 |BALU     |100
4444 |DAS      |150   
2222 |SANDY    |200 
Please help me on how to do this using sort?

Regards,
Balraj
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

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

Please provide lrecl and recfm .
Please post your original JCL.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Apr 29, 2010 11:51 pm
Reply with quote

William, Even this needs to be moved to JCL part.

Balraj, Can you confirm you are getting WER* messages and not ICE* messages? Because you have posted to DFSORT part of the forum and you are pretty old to forum.
Back to top
View user's profile Send private message
Balraj

New User


Joined: 16 Aug 2007
Posts: 34
Location: Bangalore

PostPosted: Thu Apr 29, 2010 11:59 pm
Reply with quote

Thompson,

Recfm is Fixed and Lrecl=100


SORT FIELDS=(7,9,CH,A)
RECORD TYPE=F,LENGTH=100
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 30, 2010 12:15 am
Reply with quote

Balraj wrote:
SORT FIELDS=(7,9,CH,A)
RECORD TYPE=F,LENGTH=100
I think by "Please post your original JCL." he meant all of it.....
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: Fri Apr 30, 2010 2:19 am
Reply with quote

Hello,

Quote:
I think by "Please post your original JCL." he meant all of it.....
Yup, and for whatever reason None of the jcl was posted. . . Only some of the sort control statements. . .
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri Apr 30, 2010 1:31 pm
Reply with quote

You can use ICETOOL's DATASORT operator to sort the data records |in a data set without sorting the header or trailer records. You |use the following operands to tell DATASORT the number of header records, |trailer records, or header and trailer records in your data set:

||HEADER or FIRST - |the first record is a header record |HEADER(x) or FIRST(x) - |the first x records are header records |TRAILER or LAST - |the last record is a trailer record |TRAILER(y) or LAST(y) - |the last y records are trailer records
|DATASORT does not require an "identifier" in the header or trailer |records; it can treat the first x records as header records and the |last y records as trailer records.

|You must specify a USING data set to specify a DFSORT SORT statement |that tells DATASORT the fields you want to use to sort your data records. | You can use various other DFSORT statements as well; see z/OS DFSORT Application Programming Guide for |details.

|DATASORT sorts the data records between your header records (first |x records of the data set) and trailer records (last y records of |the data set) while keeping the header and trailer records in place.

So for this example I am assuming the EMPID as the key.

So the control statement for ICETOOL will become like this.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=INPUT DSN....
//OUT DD DSN=OUTPUT DSN...
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
/*

//CTL1CNTL DD *
SORT FIELDS=(1,4,CH,A)

/*


Just in case if you have 2 trailers then it changes like this.
Code:

DATASORT FROM(IN) TO(OUT) HEADER TRAILER(2) USING(CTL1)


Hope this helps.....
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Fri Apr 30, 2010 7:17 pm
Reply with quote

If you want to do with only syncsort then try this below code.
I have given only the control statements
Code:

INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'EMP'),OVERLAY=(81:C'0'),
              WHEN=(1,3,CH,EQ,C'TOT'),OVERLAY=(81:C'2'),
              WHEN=NONE,OVERLAY=(81:C'1'))
SORT FIELDS=(81,1,ZD,A,1,4,CH,A)
OUTREC BUILD=(1,80)



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

New User


Joined: 16 Aug 2007
Posts: 34
Location: Bangalore

PostPosted: Fri Apr 30, 2010 9:02 pm
Reply with quote

Hi,

Let me tell you guys that I work on z/VSE and my JCL is below
Code:
* $$ JOB JNM=T99SRT,DISP=D,CLASS=T,PRI=5,USER='       ',SYSID=4           
* $$ LST CLASS=Q,DISP=D,LST=SYS095,SYSID=3                               
// JOB T99SRT                                                             
// DLBL SORTOUT,'TEST.SORTFILE2'                                       
// DLBL SORTIN1,'TEST.SORTFILE1'                                       
// EXEC PGM=SORT,SIZE=400K                                               
   INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'EMP'),OVERLAY=(101:C'0'),             
                 WHEN=(1,3,CH,EQ,C'TOT'),OVERLAY=(101:C'2'),             
                 WHEN=NONE,OVERLAY=(101:C'1'))                           
   SORT FIELDS=(101,1,ZD,A,11,4,CH,A)                                     
   OUTREC BUILD=(1,100)                                                   
   RECORD TYPE=F,LENGTH=100                                               
   END                                                                   
/*       

Iam getting a syntax error with the code
WER047A INREC STATEMENT HAS SYNTAX ERROR

Assist me on this.

Thankyou.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Apr 30, 2010 9:13 pm
Reply with quote

Quote:
Iam getting a syntax error with the code
WER047A INREC STATEMENT HAS SYNTAX ERROR

Assist me on this.
Then post the entire error messages.....
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: Fri Apr 30, 2010 9:14 pm
Reply with quote

Quote:
Iam getting a syntax error with the code
You need to post all of the output messages (including message ids) that were generated by the problem run.
Back to top
View user's profile Send private message
Balraj

New User


Joined: 16 Aug 2007
Posts: 34
Location: Bangalore

PostPosted: Fri Apr 30, 2010 9:16 pm
Reply with quote

hi,

Let me correct myself .. All the job streams in my system as I mentioned earlier. So the instrem is starting from 4th pos
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: Fri Apr 30, 2010 9:17 pm
Reply with quote

Hello,

Now post the requested info from the problem run. . .
Back to top
View user's profile Send private message
Balraj

New User


Joined: 16 Aug 2007
Posts: 34
Location: Bangalore

PostPosted: Fri Apr 30, 2010 11:45 pm
Reply with quote

hi,

Following is the JCL used......

Code:
* $$ JOB JNM=T99SRT,DISP=D,CLASS=T,PRI=5,USER='',SYSID=4                 
* $$ LST CLASS=Q,DISP=D,LST=SYS095,SYSID=3                               
// JOB T99SRT                                                             
// DLBL SORTOUT,'TEST.SORTFILE2'                                         
// DLBL SORTIN1,'TEST.SORTFILE1'                                         
// EXEC PGM=SORT,SIZE=400K                                               
   INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'CLI'),OVERLAY=(101:C'0'),             
                 WHEN=(1,3,CH,EQ,C' TO'),OVERLAY=(101:C'2'),             
                 WHEN=NONE,OVERLAY=(101:C'1'))                           
   SORT FIELDS=(101,1,ZD,A,11,4,CH,A)                                     
   OUTREC BUILD=(1,100)                                                   
   RECORD TYPE=F,LENGTH=100                                               
   END                                                                   
/*                                                                       
/&                                                                       

Here is the error message on the console....

Code:
0002 // JOB T99SRT                                                 
     DATE 04/30/2010, CLOCK 11/12/36                               
0002    WER047A  INREC STATEMENT HAS SYNTAX ERROR                   
0002    WER234A  DIAG= 00000000 00000000 00000000 00000400 00370000
00000                                                               
0002    WER400A  CRITICAL ERROR, SORT TERMINATED                   
0002    WER117A  PHASE 0 HAS CRITICAL ERROR                         
0002 0S02I A CANCEL OR CANCEL ALL MACRO WAS ISSUED                 
0002 0S00I JOB T99SRT   CANCELED                                   
0002 0S07I PROBLEM PROGRAM  PSW = 07BD0000 0061329A                 
0002 1S78I  JOB TERMINATED DUE TO  PROGRAM ABEND                   
0002 EOJ T99SRT
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat May 01, 2010 12:14 am
Reply with quote

Sorry, but I just don't have the VSE Syncsort manual, maybe Alissa can help....
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: Sat May 01, 2010 1:47 am
Reply with quote

Hello,

Is there not some output that has Syncsort information at the top of the page? There should be some "printout" that was generated by Syncsort and not the DOS system. . .

Look at the output from another sort that is working. It will produce information about the process that was run (record counts, dsorg, etc). We need that same info from the problem run.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat May 01, 2010 7:06 am
Reply with quote

Hi,

from what I can see the INREC statement is incorrect,
you need an IFTHEN before each WHEN statement.

Try this although it has not been tested on any DOS/VSE system.
I can't imagine that the parameters would vary if any.
Code:
   INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'EMP'),OVERLAY=(101:C'0')),   
         IFTHEN=(WHEN=(1,3,CH,EQ,C'TOT'),OVERLAY=(101:C'2')),   
         IFTHEN=(WHEN=NONE,OVERLAY=(101:C'1'))                   
   SORT FIELDS=(101,1,ZD,A,7,9,CH,A)                             
   OUTREC BUILD=(1,80)                                           
   END                                                           


Gerry
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon May 03, 2010 10:28 pm
Reply with quote

Balraj,

Gerry's modified INREC statement is correct. That should work fine. Please let us know if you continue to encounter a problem after making this change.

Regards,
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 only first records of the fil... SYNCSORT 7
No new posts Need help on formatting a report DFSORT/ICETOOL 14
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
No new posts Creating Report using SORT DFSORT/ICETOOL 7
No new posts SELECT from data change table DB2 5
Search our Forums:

Back to Top