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
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))
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:
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 ??
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.
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 ??