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
 

 

club two files using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Mon Sep 07, 2009 8:16 pm    Post subject: club two files using sort
Reply with quote

i have 2 files , on file has 200 bytes and the other file has 300 bytes

i want the out put tobe of first 200 bytes from file a and last 100 bytes from file b . Can we do it in sort ?

eg :

File 1
AAAAA
BBBBB
CCCCC

File 2
sssssdddddd
sssssffffffffff
gggggffffffff

out put :

AAAAAdddddd
BBBBBffffffffff
CCCCCffffffffff
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Sep 08, 2009 3:09 am    Post subject:
Reply with quote

What is the RECFM and LRECL of input file1?

What is the RECFM and LRECL of input file2?

Do you want to go record by record (e.g. file1 record1 with file2 record1, file1 record2 with file2 record2, etc)?
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Tue Sep 08, 2009 8:28 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
What is the RECFM and LRECL of input file1?

What is the RECFM and LRECL of input file2?

Do you want to go record by record (e.g. file1 record1 with file2 record1, file1 record2 with file2 record2, etc)?


record size lets say both are 500

yes iwant to go record by record... its a one tone mapping in the same order as they appear.. 1st vs 1st, 2nd vs 2nd so on
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Sep 08, 2009 9:51 pm    Post subject:
Reply with quote

cvishu,

The following JCL will give you the desired results. Since both files are of the same lrecl and recfm, we concatenate them together along with a single line file which has "HDR" in the first 3 bytes.

Step0100 creates a 1 line file with hdr which will be used to differentiate as to which record the file came from

Step0200 merges the record by record and creates a single record


Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
//SORTOUT  DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)           
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                   
  INREC OVERLAY=(500:X)                                             
  OUTFIL REMOVECC,TRAILER1=(1:'HDR')                                 
/*                                                                   
//STEP0200 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT           
//         DD DSN=Your inp2 file picking last 100bytes,disp=shr
//         DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT           
//         DD DSN=Your inp1 file picking first 200bytes,disp=shr
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(501:SEQ=8))
  SORT FIELDS=(501,8,CH,A),EQUALS                                   
  OUTREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(401:401,100))           
  OUTFIL NODETAIL,REMOVECC,OMIT=(501,8,ZD,EQ,1),BUILD=(300X),                     
  SECTIONS=(501,8,TRAILER3=(1,200,401,100))                         
/*
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Sep 09, 2009 2:44 pm    Post subject: Reply to: club two files using sort
Reply with quote

hi thanks for the code.. is there any alternate command for "PUSH".. my compiler doesnt seem to support it
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Sep 09, 2009 2:46 pm    Post subject:
Reply with quote

cvishu wrote:
my compiler doesnt seem to support it

Why compiler comes here? icon_eek.gif

Actually you are using older release of DFSORT.
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Sep 09, 2009 9:15 pm    Post subject:
Reply with quote

Sambhaji wrote:
cvishu wrote:
my compiler doesnt seem to support it

Why compiler comes here? icon_eek.gif

Actually you are using older release of DFSORT.


okie am sorry am no techie genious icon_smile.gif.. yes may be its a plder version not sure..could u suggest an alternative
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Sep 09, 2009 9:48 pm    Post subject:
Reply with quote

PUSH requires z/OS DFSORT V1R5 PTF UK90013 (July, 2008). Ask your System Programmer to install it (it's free).
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Fri Sep 11, 2009 5:54 pm    Post subject:
Reply with quote

Bhargav,

I removed your non-DFSORT solution. This is the DFSORT Forum - please only post DFSORT solutions here.


Frank - The Moderator
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Sep 11, 2009 9:38 pm    Post subject: Reply to: club two files using sort
Reply with quote

cvishu,

The following DFSORT/ICETOOL JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
//SORTOUT  DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)           
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                   
  INREC OVERLAY=(500:X)                                             
  OUTFIL REMOVECC,TRAILER1=(1:'HDR')                                 
//*                                     
//STEP0200 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN       DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT           
//         DD DSN=Your inp2 file picking last 100bytes,disp=shr
//         DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT           
//         DD DSN=Your inp1 file picking first 200bytes,disp=shr
//OUT      DD SYSOUT=*
//TOOLIN   DD *                                                   
  SPLICE FROM(IN) TO(OUT) ON(517,8,CH) WITH(1,400) USING(CTL1)     
//CTL1CNTL DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(501:SEQNUM,8,ZD)),             
  IFTHEN=(WHEN=(1,3,CH,EQ,C'HDR'),OVERLAY=(501:SEQNUM,8,ZD)),     
  IFTHEN=(WHEN=NONE,OVERLAY=(509:SEQNUM,8,ZD,                     
          501:501,8,ZD,SUB,509,8,ZD,M11,LENGTH=8,                 
          517:SEQNUM,8,ZD,RESTART=(501,8)))                       
  OUTFIL FNAMES=OUT,OMIT=(517,8,CH,EQ,C' '),BUILD=(1,200,401,100) 
//*
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Sat Sep 12, 2009 12:40 pm    Post subject:
Reply with quote

Oops I am sorry frank!
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm


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