Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copy Specific Groups

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 212
Location: USA

PostPosted: Thu Jan 11, 2018 1:16 am    Post subject: Copy Specific Groups
Reply with quote

Hi,

The input file is FB, LRECL is 80 and the input file layout is as below. The output file is also FB/80.

Code:

HD123
DB111
DT222
DT333
DT444
HDXXX
DBABC
HDYHZ
DBJJJ
DT101


Expected Output:
Code:

HD123
DB111
DT222
DT333
DT444
HDYHZ
DBJJJ
DT101


Requirement: The input file has 1 HD record, 1 DB record and multiple DT records. The output should only contain the group of records that has atleast one DT record. As we can see in the output, the second group did not have a DT record, so it shouldn't be in the output.

Can this be done using SYNCSORT?
Back to top
View user's profile Send private message

sergeyken

Active User


Joined: 29 Apr 2008
Posts: 305
Location: Maryland

PostPosted: Thu Jan 11, 2018 2:28 am    Post subject: Re: Copy Specific Groups
Reply with quote

V S Amarendra Reddy wrote:
Can this be done using SYNCSORT?

As usually, the question is not in SYNCSORT or whatever else, but: in the ability of developer to evaluate the logical algorithm - what is the sequence of operations for the task to be done, at all?
After the problem above is resolved, then the appropriate tool could be chosen.
Doesn't make any sense to do it vice versa.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 417
Location: USA

PostPosted: Thu Jan 11, 2018 4:40 am    Post subject: Reply to: Copy Specific Groups
Reply with quote

If the data set is Not too big then, as a simple solution, you can read the data set in reverse using SEQ and use WHEN=GROUP where the Group BEGIN with 'DT' record and END with 'HD' record. At the end, reverse the order again to get your expected output.

.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 305
Location: Maryland

PostPosted: Fri Jan 12, 2018 3:00 am    Post subject:
Reply with quote

With SYNCSORT, it requires two separate job steps
Code:
//*==================================
//GROUPS   EXEC PGM=SYNCSORT         
//*                                 
//SYSOUT   DD  SYSOUT=*             
//*                                 
//SORTIN   DD  *                     
HD123                               
DB111                               
DT222                               
DT333                               
DT444                               
HDXXX                               
DBABC                               
HDYHZ                               
DBJJJ                               
DT101                               
//*                                 
//NUMBERED DD  DISP=(NEW,PASS),               
//             SPACE=(TRK,(10,10)),           
//             DSN=&&NUMBERED                 
//GROUPS   DD  DISP=(NEW,PASS),               
//             SPACE=(TRK,(10,10)),           
//             DSN=&&GROUPS                   
//SYSIN    DD  *                             
 INREC IFTHEN=(WHEN=GROUP,                   
               BEGIN=(1,2,CH,EQ,C'HD'),       
               PUSH=(10:ID=3,SEQ=3))         
 SORT  FIELDS=COPY                           
 OUTFIL FNAMES=NUMBERED                       
 OUTFIL FNAMES=GROUPS,                       
        NODETAIL,REMOVECC,                   
        INCLUDE=(1,2,CH,EQ,C'DT'),           
        SECTIONS=(10,3,                       
                  TRAILER3=(1,15))           
 END                                         
//*                                           
//*===========================================
//SELECT   EXEC PGM=SYNCSORT                       
//*                                                 
//SYSOUT   DD  SYSOUT=*                             
//*                                                 
//NUMBERED DD  DISP=(OLD,DELETE),DSN=&&NUMBERED     
//GROUPS   DD  DISP=(OLD,DELETE),DSN=&&GROUPS       
//*                                                 
//SORTOUT  DD  SYSOUT=*                             
//*                                                 
//SYSIN    DD  *                                   
 JOINKEYS F1=NUMBERED,                             
          FIELDS=(10,3,A),                         
          SORTED                                   
 JOINKEYS F2=GROUPS,                               
          FIELDS=(10,3,A),                         
          SORTED                                   
 REFORMAT FIELDS=(F1:1,15)                         
 SORT  FIELDS=(10,3,CH,A,                           
               13,3,CH,A)                           
 OUTREC BUILD=(1,5)                       
 END                                       
//*                                       
//*========================================
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 212
Location: USA

PostPosted: Fri Jan 12, 2018 3:06 am    Post subject:
Reply with quote

Thank you sergeyken, it worked nicely.


Thank you Rahul for the idea as well.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2357
Location: @my desk

PostPosted: Fri Jan 12, 2018 3:22 am    Post subject:
Reply with quote

Amar,

I don't have SYNCTOOL, but you could try something like this which does not involve SORTing. Assign group ID for each group and select groups having more than 2 records.
Code:
//STEP01   EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//OUT      DD SYSOUT=*                                       
//IN       DD DISP=SHR,DSN = input data set (FB/LRECL=80)   
//TOOLIN   DD *                                             
  SELECT FROM(IN) TO(OUT) ON(81,8,CH) HIGHER(2) USING(CTL1) 
//CTL1CNTL DD *                                             
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'HD'),         
                            PUSH=(81:ID=8))                 
  OUTFIL BUILD=(1,80)                                       
//*                                                         
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 212
Location: USA

PostPosted: Fri Jan 12, 2018 4:47 am    Post subject:
Reply with quote

Wow... You really provide slick solutions Arun...

Thank you very much... I will try and let you know.
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 212
Location: USA

PostPosted: Fri Jan 12, 2018 8:23 pm    Post subject:
Reply with quote

Arun,

I just tested this card, and it worked beautifully.

Thank you very much

icon_smile.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2357
Location: @my desk

PostPosted: Fri Jan 12, 2018 8:51 pm    Post subject:
Reply with quote

Amar - You're welcome. Thanks for letting know!
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 305
Location: Maryland

PostPosted: Fri Jan 12, 2018 10:05 pm    Post subject:
Reply with quote

Posts about ICETOOL under SYNCSORT, and vice versa, are prohibited by moderators (for unknown reason), isn't it?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2357
Location: @my desk

PostPosted: Fri Jan 12, 2018 10:40 pm    Post subject:
Reply with quote

sergeyken wrote:
Posts about ICETOOL under SYNCSORT, and vice versa, are prohibited by moderators (for unknown reason), isn't it?
That is not true. But posting solutions that are not compatible with the other product is not recommended and such posts could be edited/removed.
Syncsort has made 'ICETOOL' an alias to their product - 'SYNCTOOL'. So PGM=SYNCTOOL and PGM=ICETOOL can be used interchangeably at a typical Syncsort site unless there are any site specific restrictions.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts Group changes and numbering the groups Auryn DB2 2 Tue Mar 20, 2018 7:12 pm
No new posts Copy set of records based on condition krish.deepu SYNCSORT 2 Thu Mar 08, 2018 11:39 am
No new posts Image copy after Online reorganization. lind sh IMS DB/DC 0 Tue Jan 30, 2018 9:58 pm
No new posts RACF - Sub groups - how they work? vasanthz JCL & VSAM 1 Wed Jan 10, 2018 6:44 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us