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
 

 

Syncsort - Report from reading different rows and grouping

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
rajinfy123

New User


Joined: 09 Jul 2004
Posts: 12

PostPosted: Mon Apr 27, 2009 9:18 pm    Post subject: Syncsort - Report from reading different rows and grouping
Reply with quote

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
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Mon Apr 27, 2009 10:41 pm    Post subject: Reply to: Report from reading different rows by grouping
Reply with quote

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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
rajinfy123

New User


Joined: 09 Jul 2004
Posts: 12

PostPosted: Mon Apr 27, 2009 11:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 28, 2009 12:12 am    Post subject:
Reply with quote

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
View user's profile Send private message
rajinfy123

New User


Joined: 09 Jul 2004
Posts: 12

PostPosted: Tue Apr 28, 2009 12:49 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 28, 2009 2:47 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 28, 2009 2:54 am    Post subject:
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Tue Apr 28, 2009 2:55 am    Post subject:
Reply with quote

Raj, regardless of the program named in your EXEC statement, ICE... prefixed messages indicate DFSORT, WER... prefixed ones mean Syncsort.
Back to top
View user's profile Send private message
rajinfy123

New User


Joined: 09 Jul 2004
Posts: 12

PostPosted: Tue Apr 28, 2009 2:55 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 28, 2009 3:01 am    Post subject:
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Tue Apr 28, 2009 3:06 am    Post subject:
Reply with quote

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
View user's profile Send private message
rajinfy123

New User


Joined: 09 Jul 2004
Posts: 12

PostPosted: Tue Apr 28, 2009 3:15 am    Post subject:
Reply with quote

SYNCSORT FOR Z/OS 1.3.0.2N
Back to top
View user's profile Send private message
rajinfy123

New User


Joined: 09 Jul 2004
Posts: 12

PostPosted: Wed Apr 29, 2009 1:44 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 29, 2009 1:55 am    Post subject:
Reply with quote

Hello,

Please look at this similar topic:
http://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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 1 Fri Dec 02, 2016 9:47 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Detailed Transaction History report f... Kyle Carroll CICS 5 Tue Oct 18, 2016 12:42 am


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