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

Merge datasets of different lengths


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Tue Mar 23, 2010 11:40 pm
Reply with quote

Seems simple enough, but not able to do this....

1. Dataset 1. Input dataset of LRECL=133 and FB.
2. Dataset 2. Input dataset of LRECL=203 and FB.

Requirement is to simply append second dataset to the the first one. No sort is required.

1. Records from Dataset 2 can be appended to Dataset 1.
2. If Dataset 3 and dataset 4 exist, can these two datasets also be appended to Dataset 1?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Mar 23, 2010 11:45 pm
Reply with quote

Hello,

What do you mean by "append"?

Showing a bit of sample data may help (both inputs and output).

What do you want as output? You cannot have a FB output file with different lrecls.
Back to top
View user's profile Send private message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Wed Mar 24, 2010 12:01 am
Reply with quote

Append as in, simply copy records at the end or merge the files.
Have listed below examples of input and output.
True, that was my mistake. O/P dataset cannot have the same lrecl as input dataset1.

1. Sample records in Dataset 1 are listed below. lrecl = 133 and FB.

Message from Program A-
1111 aaaa
5555 sssss
3333 www


2. Sample records in Dataset 2 are listed below. lrecl = 203 and FB.

Error records displayed.
11111111111111 ppppppppppppppppppppppppp
22222222222222 yyyyyyyyyyyyyyyyyyyyyyyyy
55555555555555 hhhhhhhhhhhhhhhhhhhhhhhhh


3. Output dataset will be NEW Dataset3. lrecl = 203 and FB.
No sorting required.
O/P records should appear as listed below.



Message from Program A-
1111 aaaa
5555 sssss
3333 www
Error records displayed.
11111111111111 ppppppppppppppppppppppppp
22222222222222 yyyyyyyyyyyyyyyyyyyyyyyyy
55555555555555 hhhhhhhhhhhhhhhhhhhhhhhhh
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Mar 24, 2010 12:05 am
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. Just be sure to use a MOD data set for //OUT.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/133)
//IN2 DD DSN=...  input file2 (FB/203)
//OUT DD DISP=(MOD,...),DSN=...  output file (FB/203)
//TOOLIN DD *
  COPY FROM(IN1) TO(OUT) USING(CTL1)
  COPY FROM(IN2) TO(OUT)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(203:X)
/*


Quote:
2. If Dataset 3 and dataset 4 exist, can these two datasets also be appended to Dataset 1?


Yes, just add additional COPY operators with INREC statements as needed to pad or truncate to the output length.
Back to top
View user's profile Send private message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Wed Mar 24, 2010 12:56 am
Reply with quote

Thanks Frank.

Maybe I am missing something, the output dataset is not created.
Condition code is zero, and DFSMSG shows the correct number of records in and out for both input datasets.

The JCL is listed below-

Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=PHRD.DATA.EMAIL2.PHR431B0,DISP=SHR
//IN2 DD DSN=PHRD.INMAIN.NOTUNIT.PHR431B0,DISP=SHR
//OUT DD DISP=(MOD),DSN=PHRD.DATA.SS10,
//            UNIT=DISK,
//            DCB=(LRECL=203,BLKSIZE=27811,RECFM=FB),
//            SPACE=(TRK,(50,50),RLSE)
//TOOLIN DD *
  COPY FROM(IN1) TO(OUT) USING(CTL1)
  COPY FROM(IN2) TO(OUT)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(203:X)
/*
Code'd
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Mar 24, 2010 1:24 am
Reply with quote

Hello,

I suspect that the dataset was created and then discarded because no retention was specified and the dataset was PASSed (to the "bit bucket"). . .
Back to top
View user's profile Send private message
Suresh Shankarakrishnan

New User


Joined: 11 Jul 2008
Posts: 42
Location: USA

PostPosted: Wed Mar 24, 2010 1:39 am
Reply with quote

Thanks Dick.
My mistake, it works now.

I should have changed the disp parameter to (MOD,CATLG,DELETE).

Frank , thanks, it works now.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Mar 24, 2010 2:44 am
Reply with quote

You're welcome.

I'll try to remember to show it as DISP=(MOD,...) instead of DISP=MOD in the future. I usually use temporary data sets with DISP=(MOD,PASS) in my testing and I don't like to assume the type of data set somebody is using so I tend to show generic DD info.

I changed my post above to show DISP=(MOD,...).
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts Merge 2 input files after sort SYNCSORT 14
No new posts Merging 2 datasets into one DFSORT/ICETOOL 1
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
Search our Forums:

Back to Top