Posted: Thu May 27, 2010 8:27 am Post subject: join two records of 80 bytes each into one record
I have an input file with records as below with FB 80 bytes , I want to create new file with FB 80 bytes but with data joined in one record only and XYZ shoud
start from 48 th position in the new output file.
You can do this using a SORT step ( Assuming that there are exactly 2 input records for every output record ):
1. In your JCL, specify that SORTIN has an LRECL of 160 ( not 80 ). This will make the SORT think that each input record is 160-bytes long, when in reality each 160-byte record is a concatenation of 2 80-byte records.
2. Specify that SORTOUT has an LRECL of 80, which is what you want
3. Code SYSIN as follows
SORT FIELDS=COPY
OUTREC FIELDS=(1,47,81,33)
That should do it. _________________ A computer once beat me at chess, but it was no match for me at kick boxing.
You really don't have to use the trick of overriding the lrecl with 160 as sort products are now capable of grouping records and we have the ability to modify them as we prefer. _________________ Kolusu
www.linkedin.com/in/kolusu
1. The topic starter did not say that he wanted to use a sort product. I suggested a method that did use a sort product, but one that "could" be adapted to other utilities that can build an 80-byte record by extracting fields from a 160-byte record - e.g. IEBGENER
Code:
GENERATE MAXFLDS=2
RECORD FIELD=(47,1,,1),
FIELD=(33,81,,48)
2. I ( and I'm sure many of those visiting this forum ) do not claim to be an expert in the extensive features of the various sort products nor the ( often complex ) syntax required to utilize those features - hence, I chose to suggest a rather simplistic method that can easily be adapted to other utilities of the user's choice ( ref item 1 - use of sort was not a stated requirement ).
3. With all due respect, you are considered to be a DFSORT expert, so can probably whip up the required DFSORT code easily. Some of us ( I ) would not be able to code the correct syntax for the requested conversion without reference to a manual. _________________ A computer once beat me at chess, but it was no match for me at kick boxing.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu May 27, 2010 12:38 pm Post subject:
Quote:
Some of us ( I ) would not be able to code the correct syntax for the requested conversion without reference to a manual.
I suspect that most people would NOT be able to code up the correct syntax for IEBGENER without reference to a manual either.
We've shown so many examples of using DFSORT for various things on this and other boards, lists, etc, that I suspect more people now know how to use DFSORT for this kind of thing than IEBGENER.
But feel free to post any type of utility solution you like in this Forum. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
That's why I didn't post an IEBGENER solution to begin with. I only mentioned IEBGENER afterwards because it, too, is universally available. DFSORT is not universally available, and I'm not sure that other sort products support IFTHEN...WHEN=GROUP...PUSH logic.
I would wager that more people know how to code an LRECL specification and are familiar with the simple OUTREC FIELDS= statement of sort products than know how to use DFSORT's IFTHEN...WHEN=GROUP...PUSH logic.
------------------------------
I do feel free to post any type of utility solution in this, or any other forum, and the same freedom is offered to you or Kolusu to post DFSORT solutions, but I would greatly appreciate not being reprimanded because a solution that I offer is not a DFSORT specific solution, even though such a solution is possible. _________________ A computer once beat me at chess, but it was no match for me at kick boxing.
I want all three records in one output file as below:
ABC should start from 48 th position in the new output file, XYZ should start from 56 position:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
111111111111111111111111111111111111111111111 ABC XYZ
ABC is always 3 bytes and XYZ is always 3 bytes and first record is always 45 bytes. I could not much understand your control cards and I was unable to frame from my end and I have tried but could not get the result.Please help me.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Thu May 27, 2010 2:46 pm Post subject:
RonB wrote:
------------------------------
I do feel free to post any type of utility solution in this, or any other forum, and the same freedom is offered to you or Kolusu to post DFSORT solutions, but I would greatly appreciate not being reprimanded because a solution that I offer is not a DFSORT specific solution, even though such a solution is possible.
Ronb,
I am not sure how you felt that you are reprimanded. I was merely pointing out that the features are available with DFSORT. It was more like an info share. Please free to post any type of utility solution you like. _________________ Kolusu
www.linkedin.com/in/kolusu
I want all three records in one output file as below:
ABC should start from 48 th position in the new output file, XYZ should start from 56 position:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
111111111111111111111111111111111111111111111 ABC XYZ
ABC is always 3 bytes and XYZ is always 3 bytes and first record is always 45 bytes. I could not much understand your control cards and I was unable to frame from my end and I have tried but could not get the result.Please help me.
yadav2005,
Is this the complete requirement ? or would you come back , "suppose I have 4 records ....." _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu May 27, 2010 3:05 pm Post subject:
I'm sure Kolusu will show you how to do the new variation with WHEN=GROUP, but FWIW here's a DFSORT/ICETOOL SPLICE solution which you might find easier to understand and extrapolate (then again, you might not):
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Last edited by Frank Yaeger on Thu May 27, 2010 3:09 pm; edited 1 time in total
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum