|
View previous topic :: View next topic
|
| Author |
Message |
rajinfy123
New User
Joined: 09 Jul 2004 Posts: 12
|
|
|
|
In the below first 3 byte determine the record-type and remaining all are different field values.A report is to be generated reading HDR record until next HDR record encountered. Read each of GRP record for first 3 field values followed by next associated SUB records until next GRP record encountered. In the SUB record consider last 2 field value for the report.In the report, Page number to be incremented only within HDR to TRL, as soon as another HDR encountered,Page number to be restarted from 1 again.
Pls let me know if anything unclear.
Thanks in advance for your help,
Raj.
| Code: |
INPUT:
~~~~~~
HDR TZ100PQRTK200
GRP YAHOO 1000 CAR XXXXX
SUB MARY SMITH HONDA ACCORD
SUB JOHN SMITH TOYOTA CAMRY
SUB ALEX SMITH NISSAN MAXIMA
GRP INFY 3114 MINIVAN YYYYY
SUB ANNY LEADS TOYOTA INNOVA
TRL00006
HDR TZ400PQRTQ300
GRP MICTEK 3111 CAR ZZZZZ
SUB RAJ PATEL HONDA CIVIC
SUB MOHAN JOHN FORD MUSTANG
TRL 00003
Output expected:
~~~~~~~~~~~~~~~~
TZ100PQRTK200 PAGE : 1
ROWHDR1 ROWHDR2 ROWHDR3 ROWHDR4 ROWHDR5
~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~
YAHOO 1000 CAR HONDA ACCORD
YAHOO 1000 CAR TOYOTA CAMRY
YAHOO 1000 CAR NISSAN MAXIMA
INFY 3114 MINIVAN TOYOTA INNOVA
TZ400PQRTQ300 PAGE : 1
ROWHDR1 ROWHDR2 ROWHDR3 ROWHDR4 ROWHDR5
~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~
MICTEK 3111 CAR HONDA CIVIC
MICTEK 3111 CAR FORD MUSTANG
|
[/code] |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
rajinfy123,
You can very easily push the hdr and grp hdr using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
I assumed your input to be FB and LRECL 80 .
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+---
HDR TZ100PQRTK200
GRP YAHOO 1000 CAR XXXXX
SUB MARY SMITH HONDA ACCORD
SUB JOHN SMITH TOYOTA CAMRY
SUB ALEX SMITH NISSAN MAXIMA
GRP INFY 3114 MINIVAN YYYYY
SUB ANNY LEADS TOYOTA INNOVA
TRL00006
HDR TZ400PQRTQ300
GRP MICTEK 3111 CAR ZZZZZ
SUB RAJ PATEL HONDA CIVIC
SUB MOHAN JOHN FORD MUSTANG
TRL 00003
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),
END=(1,3,CH,EQ,C'TRL'),PUSH=(81:5,13)),
IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'GRP'),
END=(1,3,CH,EQ,C'TRL'),PUSH=(94:5,20))
OUTFIL OMIT=(1,3,SS,EQ,C'HDR,GRP,TRL'),REMOVECC,
BUILD=(01:94,7,11:101,4,21:105,9,31:17,7,41:25,7,80:X),
SECTIONS=(81,13,
HEADER3=(15:81,13,35:'PAGE : ',&PAGE,/,/,
01:'ROWHDR1',11:'ROWHDR2',21:'ROWHDR3',
31:'ROWHDR4',41:'ROWHDR5',/,
01:'~~~~~~~',11:'~~~~~~~',21:'~~~~~~~',
31:'~~~~~~~',41:'~~~~~~~'),
TRAILER3=(//))
/* |
The output from this job is
| Code: |
TZ100PQRTK200 PAGE : 1
ROWHDR1 ROWHDR2 ROWHDR3 ROWHDR4 ROWHDR5
~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~
YAHOO 1000 CAR HONDA ACCORD
YAHOO 1000 CAR TOYOTA CAMRY
YAHOO 1000 CAR NISSAN MAXIMA
INFY 3114 MINIVAN TOYOTA INNOVA
TZ400PQRTQ300 PAGE : 1
ROWHDR1 ROWHDR2 ROWHDR3 ROWHDR4 ROWHDR5
~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~ ~~~~~~~
MICTEK 3111 CAR HONDA CIVIC
MICTEK 3111 CAR FORD MUSTANG
|
If you don't have the July, 2008 PTF installed, ask your System Programmer to install it (it's free).
For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links |
|
| Back to top |
|
 |
rajinfy123
New User
Joined: 09 Jul 2004 Posts: 12
|
|
|
|
When I tried the above shared code, I am getting below error. Does this imply "July, 2008 PTF" is not installed.
Thanks,
Raj
| Code: |
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),
*
END=(1,3,CH,EQ,C'TRL'),PUSH=(81:5,13)),
IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'GRP'),
END=(1,3,CH,EQ,C'TRL'),PUSH=(94:5,20))
OUTFIL OMIT=(1,3,SS,EQ,C'HDR,GRP,TRL'),REMOVECC,
BUILD=(01:94,7,11:101,4,21:105,9,31:17,7,41:25,7,80:X),
SECTIONS=(81,13,
HEADER3=(15:81,13,35:'PAGE : ',&PAGE,/,/,
01:'ROWHDR1',11:'ROWHDR2',21:'ROWHDR3',
31:'ROWHDR4',41:'ROWHDR5',/,
01:'~~~~~~~',11:'~~~~~~~',21:'~~~~~~~',
31:'~~~~~~~',41:'~~~~~~~'),
TRAILER3=(//))
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
|
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
No, it shows you are using Syncsort rather than DFSORT.
You need to have the current version of Syncsort to use WHEN=GROUP. |
|
| Back to top |
|
 |
rajinfy123
New User
Joined: 09 Jul 2004 Posts: 12
|
|
|
|
Seems like new version of DFSORT is not installed at my end. Is there any other way to get the desired output ?
Thanks for your help,
Raj. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you re-read and understand what was posted previously. . .
You do not use DFSORT, so the DFSORT version/ptf level is not a concern.
You ARE using Syncsort and to use WHEN=GROUP, you need the current version of Syncsort installed. . .
Suggest you talk with your system support about installing the current release. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Your duplicate topic has been removed.
Review this topic and notice that it was relocated from DFSORT to JCL hours ago. . .
I'll delete these non-technical replies when things are "caught up".
I'll also change the title to include Syncsort. |
|
| Back to top |
|
 |
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
| Raj, regardless of the program named in your EXEC statement, ICE... prefixed messages indicate DFSORT, WER... prefixed ones mean Syncsort. |
|
| Back to top |
|
 |
rajinfy123
New User
Joined: 09 Jul 2004 Posts: 12
|
|
|
|
Thank Q Dick Scherrer, I would have to followup on that with the Systems Support which is time consuming. Can I be suggested any other alternate way of creating the report using SYNCSORT ??
Thanks,
Raj. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| would have to followup on that with the Systems Support which is time consuming |
Suggest time would be better consumed getting the current release of the software installed rather than spending time on some work-around because the software was not current.
You could always do this the way we did before sort products had this functionality - write your "own code" to read the file and create the required output. |
|
| Back to top |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
| rajinfy123 wrote: |
| Thank Q Dick Scherrer, I would have to followup on that with the Systems Support which is time consuming. Can I be suggested any other alternate way of creating the report using SYNCSORT ?? |
| rajinfy123 wrote: |
| Code: |
SYSIN :
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),
*
END=(1,3,CH,EQ,C'TRL'),PUSH=(81:5,13)),
IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'GRP'),
END=(1,3,CH,EQ,C'TRL'),PUSH=(94:5,20))
OUTFIL OMIT=(1,3,SS,EQ,C'HDR,GRP,TRL'),REMOVECC,
BUILD=(01:94,7,11:101,4,21:105,9,31:17,7,41:25,7,80:X),
SECTIONS=(81,13,
HEADER3=(15:81,13,35:'PAGE : ',&PAGE,/,/,
01:'ROWHDR1',11:'ROWHDR2',21:'ROWHDR3',
31:'ROWHDR4',41:'ROWHDR5',/,
01:'~~~~~~~',11:'~~~~~~~',21:'~~~~~~~',
31:'~~~~~~~',41:'~~~~~~~'),
TRAILER3=(//))
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
|
|
The top line of the above sysout should include the version of Syncsort, please post it. |
|
| Back to top |
|
 |
rajinfy123
New User
Joined: 09 Jul 2004 Posts: 12
|
|
|
|
| SYNCSORT FOR Z/OS 1.3.0.2N |
|
| Back to top |
|
 |
rajinfy123
New User
Joined: 09 Jul 2004 Posts: 12
|
|
|
|
| Quote: |
You ARE using Syncsort and to use WHEN=GROUP, you need the current version of Syncsort installed. . .
|
Can anyone share which latest version of SYNCSORT has the capability of WHEN=GROUP functionality
Thanks,
Raj |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Please look at this similar topic:
ibmmainframes.com/viewtopic.php?t=38889
From that topic:
| Quote: |
| This can also be accomplished in a single step using SyncSort for z/OS 1.3.2: |
You might also want to open an issue with Syncsort Support or Alissa Margulies. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|