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

Append data from two files into a single row


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

New User


Joined: 09 Mar 2017
Posts: 2
Location: india

PostPosted: Thu Mar 16, 2017 7:29 pm
Reply with quote

Hi,
I have a File 1 and File 2 with one record as count 05 04 respectively and I would like append it into single row.Please find the example below

File 1:
05

File 2:
04

Output:
0504.

Kindly let me know how can I do it.

Thanks
Praveen
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Mar 16, 2017 8:01 pm
Reply with quote

There are various ways to achieve your need

JOINKEYS

or WHEN=GROUP with PUSH and RECORDS=2
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Mar 16, 2017 10:39 pm
Reply with quote

This way to concatenate two strings into single one using two intermediate files - it would work, of course.

But the whole task resembles me the process of hammering nails when using a microscope as a hammer...
Back to top
View user's profile Send private message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 88
Location: India

PostPosted: Fri Mar 17, 2017 1:10 pm
Reply with quote

Hello,

Adding my two cents worth, this task is really not as simple as it appears, the complexity also depends on what the TS meant by 'File*', for instance:
a. Are the datasets (or 'File*') in question, of fixed length or variable?
b. What is the length in question?
c. Is the data only AND ONLY a '2 byte number'?
d. Is the mapping of data between the two datasets always going to be one-to-one, i.e. 1st record from DS-1 needs to be appended to 1st record of DS-2, and so on?
e. Then there is also the part about the number of records in both the datasets, will it always be same (i.e. 1 record each) or there is a possibility of different count?

If I have to go purely by what the TS has posted, i.e. "File 1 and File 2 with one record as count 05 04 respectively and I would like append it into single row", then assuming that the data is stored in a QSAM dataset, a simple method would be to DD concatenate the two QSAM DS and use ICETOOL RESIZE operator.

Something on the lines of (untested code):

Code:

//IN       DD *                             
05                                           
04                                           
/*                                           
//OUT      DD SYSOUT=*                       
//TOOLIN   DD *                             
 RESIZE FROM(IN) TO(OUT) TOLEN(4) USING(CTL1)
/*                                           
//CTL1CNTL DD *                             
 INREC BUILD=(1,2)                           
/*                                           
Back to top
View user's profile Send private message
Praveen04

New User


Joined: 09 Mar 2017
Posts: 2
Location: india

PostPosted: Fri Mar 17, 2017 1:23 pm
Reply with quote

Hi All,
Thank you for all the inputs.Appreciated!!

Howe ever I have achieved the above requirement using Join Keys

JOINKEYS F1=FILE1,FIELDS=(3,2,A).SORTED
JOINKEYS F2=FILE2,FIELDS=(3,2,A).SORTED
REFORMAT FILEDS=(F1:1,2,F2:1,2)
OPTION COPY
OUTFIL FNAMES=FILE3,BUILD=(1,2,C','3,2,75X)


Thanks
Praveen
Back to top
View user's profile Send private message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 88
Location: India

PostPosted: Fri Mar 17, 2017 1:39 pm
Reply with quote

Hello,

Imo, bit of an overkill!
Aside, the posted SORT card will not work straight off the shelf; there are syntactical errors at multiple places.

So, is it safe to assume that the input datasets have LRECL >2, <81?
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top