IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copy Specific Groups


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 216
Location: USA

PostPosted: Thu Jan 11, 2018 1:16 am
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

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Thu Jan 11, 2018 2:28 am
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: 446
Location: USA

PostPosted: Thu Jan 11, 2018 4:40 am
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

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Fri Jan 12, 2018 3:00 am
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: 216
Location: USA

PostPosted: Fri Jan 12, 2018 3:06 am
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: 2481
Location: @my desk

PostPosted: Fri Jan 12, 2018 3:22 am
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: 216
Location: USA

PostPosted: Fri Jan 12, 2018 4:47 am
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: 216
Location: USA

PostPosted: Fri Jan 12, 2018 8:23 pm
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: 2481
Location: @my desk

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

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

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Fri Jan 12, 2018 10:05 pm
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: 2481
Location: @my desk

PostPosted: Fri Jan 12, 2018 10:40 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Need COBOL COPY Help in MVS Environment COBOL Programming 4
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts DB2 Table - Image copy unload IBM Tools 2
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
Search our Forums:

Back to Top