MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

join two records of 80 bytes each into one record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu May 27, 2010 8:27 am    Post subject: join two records of 80 bytes each into one record Reply with quote

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.
Code:

1111111111111111111111111111111111111111111111
XYZ

I want the output as below:
Code:

1111111111111111111111111111111111111111111111   XYZ

The first record is always 45 bytes and second record is always 3 bytes in the input file.
Back to top
View user's profile Send private message
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Thu May 27, 2010 8:43 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu May 27, 2010 10:06 am    Post subject: Reply with quote

yadav2005,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
1111111111111111111111111111111111111111111111             
XYZ                                                       
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:SEQ=1)),         
  IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,1),PUSH=(82:1,45))     
  OUTFIL INCLUDE=(81,1,ZD,EQ,2),BUILD=(82,45,48:1,33)         
//*



RonB,

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Thu May 27, 2010 12:11 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu May 27, 2010 12:38 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu May 27, 2010 1:06 pm    Post subject: Reply with quote

Thanks Kolusu, Frank and RonB for the neeful help and I was able to achieve desired output.
Back to top
View user's profile Send private message
RonB
Beginner


Joined: 02 Dec 2002
Posts: 93
Topics: 0
Location: Orlando, FL

PostPosted: Thu May 27, 2010 1:13 pm    Post subject: Reply with quote

Laughing 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.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu May 27, 2010 2:01 pm    Post subject: Reply with quote

Kolusu,

Suppose if I have three records as below:
Code:

1111111111111111111111111111111111111111111111
ABC
XYZ

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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu May 27, 2010 2:46 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu May 27, 2010 2:47 pm    Post subject: Reply with quote

yadav2005 wrote:
Kolusu,

Suppose if I have three records as below:
Code:

1111111111111111111111111111111111111111111111
ABC
XYZ

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu May 27, 2010 3:05 pm    Post subject: Reply with quote

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):

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//IN DD *
1111111111111111111111111111111111111111111111
ABC
XYZ
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(81,1,CH) WITHEACH WITH(48,3) WITH(56,3) -
  USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1',SEQNUM,1,ZD)),
    IFTHEN=(WHEN=(82,1,ZD,EQ,2),OVERLAY=(48:1,3)),
    IFTHEN=(WHEN=(82,1,ZD,EQ,3),OVERLAY=(56:1,3))
  OUTFIL FNAMES=OUT,BUILD=(1,80)
/*

_________________
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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu May 27, 2010 3:06 pm    Post subject: Reply with quote

Kolusu,

The three records is the final requirement.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu May 27, 2010 3:18 pm    Post subject: Reply with quote

yadav2005 wrote:
Kolusu,

The three records is the final requirement.


yadav2005,

Use the following DFSORT JCL
Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
1111111111111111111111111111111111111111111111               
ABC                                                         
XYZ                                                         
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(81:SEQ=1)),       
  IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,1),PUSH=(82:1,45)),   
  IFTHEN=(WHEN=GROUP,BEGIN=(81,1,ZD,EQ,2),PUSH=(127:1,8))   
  OUTFIL INCLUDE=(81,1,ZD,EQ,3),BUILD=(82,45,48:127,8,1,25) 
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu May 27, 2010 11:36 pm    Post subject: Reply with quote

Thanks Kolusu and Frank.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group