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 - Combining two records into one

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

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Mon Mar 07, 2011 4:54 pm    Post subject: Syncsort - Combining two records into one
Reply with quote

Dear Friends,

I have a file with records like this:

Code:
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110303_H
Unix: EDC_AMACAUBHSTAB.dat                                                     
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110302_H
Unix: EDC_AMACAUBHSTAB.dat                                                     
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110301_H
Unix: EDC_AMACAUBHSTAB.dat                                                     

I want the output like this:


Code:
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110303_HEDC_AMACAUBHSTAB.dat 
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110302_HEDC_AMACAUBHSTAB.dat     
Unix: /test/ama/file01/rm_ext/daily/source/AMR_BIU_EU_R03_H20110301_HEDC_AMACAUBHSTAB.dat

Is this possible?
Thanks for your time.

My input file is FB, 200 bytes.

Regards
Tanden
Back to top
View user's profile Send private message

ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Mar 07, 2011 11:53 pm    Post subject: Reply to: Syncsort - Combining two records into one
Reply with quote

Tanden, try this and see..........

SORTCARD:
Code:

//SORT0001 EXEC PGM=SORT                                             
//SORTJNF1 DD *                                                       
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110303_H
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110302_H
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110301_H
//SORTJNF2 DD *                                                       
UNIX: EDC_AMACAUBHSTAB.DAT                                           
UNIX: EDC_AMACAUBHSTAB.DAT                                           
UNIX: EDC_AMACAUBHSTAB.DAT                                           
//SORTOUT  DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  JOINKEYS FILE=F1,FIELDS=(1,4,A)                                     
  JOINKEYS FILE=F2,FIELDS=(1,4,A)                                     
  REFORMAT FIELDS=(F1:1,69,F2:7,20)                                   
  SORT FIELDS=(1,89,CH,A)                                             
  SUM FIELDS=NONE                                                     
  END                                                                 
/*                                                                   


Output:
Code:

UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110301_HEDC_AMACAUBHSTAB.DAT
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110302_HEDC_AMACAUBHSTAB.DAT
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110303_HEDC_AMACAUBHSTAB.DAT


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

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Tue Mar 08, 2011 8:15 am    Post subject:
Reply with quote

Ramsri,

Thanks for your reply.
In this case, first I should split the records into two different files.

I do not want to take the risk as the order should not be changed in case of split since there is a possiblity that the file names inside the file could be different.

Regards
Tanden
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 Mar 08, 2011 8:39 am    Post subject:
Reply with quote

Hello,

If the combined input file has the records in the right order and there is only 1 of each record for each pair, splitting the files will certainly not change the sequence of the records. . .

Why might you believe that spiltting the records would change the order?

If there are hundreds of millions of input records, splitting the records into 2 files might not be acceptable, but if the volume is small, using 2 temporary files should not be a problem.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Mar 08, 2011 6:31 pm    Post subject:
Reply with quote

Tanden,
If the input records ALWAYS come in pairs, as shown in your example, one way to combine them without fancy sort techniques would be to simply override the input LRECL so that the I/O routines are led to believe that each input record is 400 bytes long instead of only 200 bytes long - as follows:
Code:

//STEP1 EXEC PGM=SORT           
//SORTIN   DD DSN=your.input.dsn,DISP=SHR,
//            DCB=(RECFM=FB,LRECL=400)
//SORTOUT  DD DSN=your.output.dsn,UNIT=xxxx,DISP=xxx,
//            DCB=(RECFM=FB,LRECL=200),
//            SPACE=xxxx
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  SORT FIELDS=COPY
  OUTREC FIELDS=(1,69,207,20,111X)                                                   
  END                                                                 
/*
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Wed Mar 09, 2011 12:24 am    Post subject:
Reply with quote

If you are not able to split the input file and utilize the JOIN REFORMAT feature, then here is another alternative:
Code:
//SORT1 EXEC PGM=SORT                                                 
//SORTIN  DD *                                                       
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110303_H
UNIX: EDC_AMACAUBHSTAB.DAT                                           
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110302_H
UNIX: EDC_AMACAUBHSTAB.DAT                                           
UNIX: /TEST/AMA/FILE01/RM_EXT/DAILY/SOURCE/AMR_BIU_EU_R03_H20110301_H
UNIX: EDC_AMACAUBHSTAB.DAT                                           
//SORTOUT DD SYSOUT=*                                                 
//SYSOUT  DD SYSOUT=*                                                 
//SYSIN   DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(91:ID=8,99:SEQ=1)),       
        IFTHEN=(WHEN=(99,1,ZD,EQ,1),BUILD=(1,69,21Z,91,8)),           
        IFTHEN=(WHEN=NONE,BUILD=(69Z,7,21,91,8))                     
  SORT FIELDS=(91,8,ZD,A)                                             
  SUM FIELDS=(1,8,BI,9,8,BI,17,8,BI,25,8,BI,33,8,BI,41,8,BI,49,8,BI, 
    57,8,BI,65,8,BI,73,8,BI,81,8,BI,89,2,BI)                         
  OUTREC BUILD=(1,89)                                                 
/*                                                                   
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Wed Mar 09, 2011 9:42 am    Post subject:
Reply with quote

Hello Alissa,

It works perfect.
Thank you verymuch for your time.

Regards
Tanden
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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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