|
View previous topic :: View next topic
|
| Author |
Message |
Balraj
New User
Joined: 16 Aug 2007 Posts: 34 Location: Bangalore
|
|
|
|
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 |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Please provide lrecl and recfm .
Please post your original JCL. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
 |
Balraj
New User
Joined: 16 Aug 2007 Posts: 34 Location: Bangalore
|
|
|
|
Thompson,
Recfm is Fixed and Lrecl=100
SORT FIELDS=(7,9,CH,A)
RECORD TYPE=F,LENGTH=100 |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| 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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
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 |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
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 |
|
 |
Balraj
New User
Joined: 16 Aug 2007 Posts: 34 Location: Bangalore
|
|
|
|
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| 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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
| 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 |
|
 |
Balraj
New User
Joined: 16 Aug 2007 Posts: 34 Location: Bangalore
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Now post the requested info from the problem run. . . |
|
| Back to top |
|
 |
Balraj
New User
Joined: 16 Aug 2007 Posts: 34 Location: Bangalore
|
|
|
|
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| Sorry, but I just don't have the VSE Syncsort manual, maybe Alissa can help.... |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|