Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Append data from two files into a single row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Append data from two files into a single row
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

Moderator


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

PostPosted: Thu Mar 16, 2017 8:01 pm    Post subject:
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

Active User


Joined: 29 Apr 2008
Posts: 233
Location: Maryland

PostPosted: Thu Mar 16, 2017 10:39 pm    Post subject:
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: 86
Location: India

PostPosted: Fri Mar 17, 2017 1:10 pm    Post subject:
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    Post subject:
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: 86
Location: India

PostPosted: Fri Mar 17, 2017 1:39 pm    Post subject:
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    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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us