View previous topic :: View next topic
|
Author |
Message |
Praveen04
New User
Joined: 09 Mar 2017 Posts: 2 Location: india
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
There are various ways to achieve your need
JOINKEYS
or WHEN=GROUP with PUSH and RECORDS=2 |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2012 Location: USA
|
|
|
|
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 |
|
|
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
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 |
|
|
Praveen04
New User
Joined: 09 Mar 2017 Posts: 2 Location: india
|
|
|
|
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 |
|
|
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
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 |
|
|
|